use of org.voltdb.compiler.deploymentfile.PropertyType in project voltdb by VoltDB.
the class CatalogUtil method checkImportProcessorConfiguration.
private static ImportConfiguration checkImportProcessorConfiguration(ImportConfigurationType importConfiguration) {
String importBundleUrl = importConfiguration.getModule();
if (!importConfiguration.isEnabled()) {
return null;
}
switch(importConfiguration.getType()) {
case CUSTOM:
break;
case KAFKA:
importBundleUrl = "kafkastream.jar";
break;
case KINESIS:
importBundleUrl = "kinesisstream.jar";
break;
default:
throw new DeploymentCheckException("Import Configuration type must be specified.");
}
Properties moduleProps = new Properties();
Properties formatterProps = new Properties();
String formatBundle = importConfiguration.getFormat();
String formatName = null;
if (formatBundle != null && formatBundle.trim().length() > 0) {
if ("csv".equalsIgnoreCase(formatBundle) || "tsv".equalsIgnoreCase(formatBundle)) {
formatName = formatBundle;
formatBundle = "voltcsvformatter.jar";
} else if (JAR_EXTENSION_RE.matcher(formatBundle).matches()) {
int typeIndex = formatBundle.lastIndexOf("/");
formatName = formatBundle.substring(typeIndex + 1);
formatBundle = formatBundle.substring(0, typeIndex);
} else {
throw new DeploymentCheckException("Import format " + formatBundle + " not valid.");
}
formatterProps.setProperty(ImportDataProcessor.IMPORT_FORMATTER, buildBundleURL(formatBundle, true));
}
if (importBundleUrl != null && importBundleUrl.trim().length() > 0) {
moduleProps.setProperty(ImportDataProcessor.IMPORT_MODULE, buildBundleURL(importBundleUrl, false));
}
List<PropertyType> importProperties = importConfiguration.getProperty();
if (importProperties != null && !importProperties.isEmpty()) {
for (PropertyType prop : importProperties) {
String key = prop.getName();
String value = prop.getValue();
if (!key.toLowerCase().contains("passw")) {
moduleProps.setProperty(key, value.trim());
} else {
//Don't trim passwords
moduleProps.setProperty(key, value);
}
}
}
List<PropertyType> formatProperties = importConfiguration.getFormatProperty();
if (formatProperties != null && !formatProperties.isEmpty()) {
for (PropertyType prop : formatProperties) {
formatterProps.setProperty(prop.getName(), prop.getValue());
}
}
return new ImportConfiguration(formatName, moduleProps, formatterProps);
}
Aggregations