Search in sources :

Example 1 with AzureStorageBlobService

use of org.talend.components.azurestorage.blob.AzureStorageBlobService in project components by Talend.

the class AzureStoragePutRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStoragePutProperties componentProperties = (TAzureStoragePutProperties) properties;
    localFolder = componentProperties.localFolder.getValue();
    remoteFolder = componentProperties.remoteFolder.getValue();
    useFileList = componentProperties.useFileList.getValue();
    files = componentProperties.files;
    this.dieOnError = componentProperties.dieOnError.getValue();
    this.azureStorageBlobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    // checks local folder
    String errorMessage = "";
    if (!new File(localFolder).exists()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyLocalFolder");
    } else // checks file list if set.
    if (useFileList && files.fileMask.getValue().isEmpty()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyFileList");
    }
    if (errorMessage.isEmpty()) {
        // everything is OK.
        return ValidationResult.OK;
    } else {
        return new ValidationResult(ValidationResult.Result.ERROR, errorMessage);
    }
}
Also used : TAzureStoragePutProperties(org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) File(java.io.File) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Example 2 with AzureStorageBlobService

use of org.talend.components.azurestorage.blob.AzureStorageBlobService in project components by Talend.

the class AzureStorageContainerDeleteRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStorageContainerDeleteProperties componentProperties = (TAzureStorageContainerDeleteProperties) properties;
    this.dieOnError = componentProperties.dieOnError.getValue();
    this.blobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    return ValidationResult.OK;
}
Also used : TAzureStorageContainerDeleteProperties(org.talend.components.azurestorage.blob.tazurestoragecontainerdelete.TAzureStorageContainerDeleteProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Example 3 with AzureStorageBlobService

use of org.talend.components.azurestorage.blob.AzureStorageBlobService in project components by Talend.

the class AzureStorageContainerExistRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStorageContainerExistProperties componentProperties = (TAzureStorageContainerExistProperties) properties;
    this.dieOnError = componentProperties.dieOnError.getValue();
    this.azureStorageBlobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    return ValidationResult.OK;
}
Also used : TAzureStorageContainerExistProperties(org.talend.components.azurestorage.blob.tazurestoragecontainerexist.TAzureStorageContainerExistProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Example 4 with AzureStorageBlobService

use of org.talend.components.azurestorage.blob.AzureStorageBlobService in project components by Talend.

the class AzureStorageGetRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStorageGetProperties componentProperties = (TAzureStorageGetProperties) properties;
    localFolder = componentProperties.localFolder.getValue();
    remoteBlobsGet = componentProperties.remoteBlobsGet;
    this.dieOnError = componentProperties.dieOnError.getValue();
    azureStorageBlobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    String errorMessage = "";
    if (remoteBlobsGet.prefix.getValue() == null || remoteBlobsGet.prefix.getValue().isEmpty()) {
        // $NON-NLS-1$
        errorMessage = messages.getMessage("error.EmptyBlobs");
    }
    if (errorMessage.isEmpty()) {
        // everything is OK.
        return ValidationResult.OK;
    } else {
        return new ValidationResult(ValidationResult.Result.ERROR, errorMessage);
    }
}
Also used : TAzureStorageGetProperties(org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Example 5 with AzureStorageBlobService

use of org.talend.components.azurestorage.blob.AzureStorageBlobService in project components by Talend.

the class AzureStorageContainerCreateRuntime method initialize.

@Override
public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) {
    ValidationResult validationResult = super.initialize(runtimeContainer, properties);
    if (validationResult.getStatus() == ValidationResult.Result.ERROR) {
        return validationResult;
    }
    TAzureStorageContainerCreateProperties componentProperties = (TAzureStorageContainerCreateProperties) properties;
    this.access = componentProperties.accessControl.getValue();
    this.dieOnError = componentProperties.dieOnError.getValue();
    this.blobService = new AzureStorageBlobService(getAzureConnection(runtimeContainer));
    return ValidationResult.OK;
}
Also used : TAzureStorageContainerCreateProperties(org.talend.components.azurestorage.blob.tazurestoragecontainercreate.TAzureStorageContainerCreateProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) AzureStorageBlobService(org.talend.components.azurestorage.blob.AzureStorageBlobService)

Aggregations

AzureStorageBlobService (org.talend.components.azurestorage.blob.AzureStorageBlobService)6 ValidationResult (org.talend.daikon.properties.ValidationResult)6 File (java.io.File)1 TAzureStorageContainerCreateProperties (org.talend.components.azurestorage.blob.tazurestoragecontainercreate.TAzureStorageContainerCreateProperties)1 TAzureStorageContainerDeleteProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerdelete.TAzureStorageContainerDeleteProperties)1 TAzureStorageContainerExistProperties (org.talend.components.azurestorage.blob.tazurestoragecontainerexist.TAzureStorageContainerExistProperties)1 TAzureStorageDeleteProperties (org.talend.components.azurestorage.blob.tazurestoragedelete.TAzureStorageDeleteProperties)1 TAzureStorageGetProperties (org.talend.components.azurestorage.blob.tazurestorageget.TAzureStorageGetProperties)1 TAzureStoragePutProperties (org.talend.components.azurestorage.blob.tazurestorageput.TAzureStoragePutProperties)1