use of org.talend.components.azurestorage.table.AzureStorageTableProperties in project components by Talend.
the class AzureStorageComponentListProperties method afterFormFinishTable.
public ValidationResult afterFormFinishTable(Repository<Properties> repo) throws Exception {
connection.BlobSchema = selectedContainerNames.getValue();
connection.QueueSchema = selectedQueueNames.getValue();
connection.TableSchema = selectedTableNames.getValue();
String repoLoc = repo.storeProperties(connection, connection.name.getValue(), repositoryLocation, null);
String storeId;
if (selectedContainerNames.getValue() != null) {
for (NamedThing nl : selectedContainerNames.getValue()) {
String containerId = nl.getName();
AzureStorageContainerProperties containerProps = new AzureStorageContainerProperties(containerId);
containerProps.init();
containerProps.connection = connection;
containerProps.container.setValue(containerId);
containerProps.schema.schema.setValue(getContainerSchema());
repo.storeProperties(containerProps, formatSchemaName(containerId), repoLoc, "schema.schema");
}
}
if (selectedQueueNames.getValue() != null) {
for (NamedThing nl : selectedQueueNames.getValue()) {
String queueId = nl.getName();
AzureStorageQueueProperties queueProps = new AzureStorageQueueProperties(queueId);
queueProps.init();
queueProps.connection = connection;
queueProps.queueName.setValue(queueId);
queueProps.schema.schema.setValue(getQueueSchema());
repo.storeProperties(queueProps, formatSchemaName(queueId), repoLoc, "schema.schema");
}
}
if (selectedTableNames.getValue() != null) {
for (NamedThing nl : selectedTableNames.getValue()) {
String tableId = nl.getName();
AzureStorageTableProperties tableProps = new AzureStorageTableProperties(tableId);
tableProps.init();
tableProps.connection = connection;
tableProps.tableName.setValue(tableId);
try {
Schema schema = AzureStorageTableSourceOrSink.getSchema(null, connection, tableId);
tableProps.schema.schema.setValue(schema);
repo.storeProperties(tableProps, formatSchemaName(tableId), repoLoc, "schema.schema");
} catch (IOException e) {
LOGGER.error(e.getLocalizedMessage());
}
}
}
return ValidationResult.OK;
}
use of org.talend.components.azurestorage.table.AzureStorageTableProperties in project components by Talend.
the class AzureStorageTableSourceOrSink method validate.
@Override
public ValidationResult validate(RuntimeContainer container) {
ValidationResult vr = super.validate(container);
if (vr.getStatus() == ValidationResult.Result.ERROR) {
return vr;
}
AzureStorageTableProperties p = (AzureStorageTableProperties) properties;
String tn = p.tableName.getValue();
if (tn.isEmpty()) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("message.VacantName"));
}
if (!tableCheckNamePattern.matcher(tn).matches()) {
return new ValidationResult(ValidationResult.Result.ERROR, i18nMessages.getMessage("message.IncorrectName"));
}
return ValidationResult.OK;
}
Aggregations