Skip to content

Commit

Permalink
Compat with old build.xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinfish committed Nov 6, 2018
1 parent 8500985 commit f0ff86d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
Expand Up @@ -155,9 +155,9 @@ public void doProcessDownloadRequest(
}

private String generateSASURL(StorageAccountInfo storageAccountInfo, String fileName) throws Exception {
if (storageType.equalsIgnoreCase(Constants.BLOB_STORAGE)) {
if (getStorageType().equalsIgnoreCase(Constants.BLOB_STORAGE)) {
return AzureUtils.generateBlobSASURL(storageAccountInfo, containerName, fileName);
} else if (storageType.equalsIgnoreCase(Constants.FILE_STORAGE)) {
} else if (getStorageType().equalsIgnoreCase(Constants.FILE_STORAGE)) {
return AzureUtils.generateFileSASURL(storageAccountInfo, fileShareName, fileName);
}

Expand All @@ -171,4 +171,11 @@ public boolean isAnonymousAccess(Authentication auth) {
public Api getApi() {
return new Api(this);
}

public String getStorageType() {
if (Constants.FILE_STORAGE.equals(storageType)) {
return storageType;
}
return Constants.BLOB_STORAGE;
}
}
Expand Up @@ -121,7 +121,7 @@ public void setIncludeArchiveZips(boolean includeArchiveZips) {

@DataBoundSetter
public void setContainerName(String containerName) {
if (downloadType.equals(DOWNLOAD_TYPE_CONTAINER)) {
if (getDownloadType().equals(DOWNLOAD_TYPE_CONTAINER)) {
this.containerName = containerName;
}
}
Expand All @@ -133,14 +133,14 @@ public void setFileShare(String fileShare) {

@DataBoundSetter
public void setBuildSelector(BuildSelector buildSelector) {
if (downloadType.equals(DOWNLOAD_TYPE_PROJECT)) {
if (getDownloadType().equals(DOWNLOAD_TYPE_PROJECT)) {
this.buildSelector = buildSelector;
}
}

@DataBoundSetter
public void setProjectName(String projectName) {
if (downloadType.equals(DOWNLOAD_TYPE_PROJECT)) {
if (getDownloadType().equals(DOWNLOAD_TYPE_PROJECT)) {
this.projectName = projectName;
}
}
Expand Down Expand Up @@ -175,7 +175,10 @@ public String getStorageAccName(Item owner) {
}

public String getDownloadType() {
return downloadType;
if (DOWNLOAD_TYPE_FILE_SHARE.equals(downloadType) || DOWNLOAD_TYPE_PROJECT.equals(downloadType)) {
return downloadType;
}
return DOWNLOAD_TYPE_CONTAINER;
}

public String getContainerName() {
Expand Down Expand Up @@ -286,7 +289,7 @@ public synchronized void perform(
builderServiceData.setFileShare(expShareName);
builderServiceData.setFlattenDirectories(flattenDirectories);
builderServiceData.setDeleteFromAzureAfterDownload(deleteFromAzureAfterDownload);
builderServiceData.setDownloadType(downloadType);
builderServiceData.setDownloadType(getDownloadType());
builderServiceData.setProjectName(Util.replaceMacro(projectName, envVars));
builderServiceData.setBuildSelector(buildSelector);

Expand All @@ -306,7 +309,7 @@ public synchronized void perform(
}

private StoragePluginService getDownloadService(DownloadServiceData data) {
switch (this.downloadType) {
switch (getDownloadType()) {
case DOWNLOAD_TYPE_FILE_SHARE:
return new DownloadFromFileService(data);
case DOWNLOAD_TYPE_PROJECT:
Expand Down
Expand Up @@ -440,7 +440,7 @@ public synchronized void perform(
if (existAction != null) {
existAction.getIndividualBlobs().addAll(individualBlobs);
} else {
run.addAction(new AzureBlobAction(expContainerName, expShareName, storageType,
run.addAction(new AzureBlobAction(expContainerName, expShareName, getStorageType(),
individualBlobs, zipArchiveBlob, allowAnonymousAccess,
getStorageCredentialId()));
}
Expand Down

0 comments on commit f0ff86d

Please sign in to comment.