use of com.genexus.util.GXProperty in project JavaClasses by genexuslabs.
the class ExternalStorage method create.
public boolean create(String name, GXProperties properties, GXStorageProvider[] storageProvider, GXBaseCollection<SdtMessages_Message>[] messages) {
storageProvider[0] = null;
if (isNullOrEmpty(name)) {
GXutil.ErrorToMessages("Unsupported", "Provider name cannot be empty", messages[0]);
return false;
}
try {
if (providerService == null || !providerService.getName().equals(name)) {
providerService = new GXService();
providerService.setType(GXServices.STORAGE_SERVICE);
providerService.setName(name);
providerService.setAllowMultiple(false);
providerService.setAllowOverrideWithEnvVarSettings(false);
providerService.setProperties(new GXProperties());
}
preprocess(name, properties);
GXProperty prop = properties.first();
while (!properties.eof()) {
providerService.getProperties().set(prop.name, prop.value);
prop = properties.next();
}
String classFullName = providerService.getClassName();
logger.debug("Loading storage provider: " + classFullName);
final Class<?> providerClass = Class.forName(classFullName);
this.provider = (ExternalProvider) providerClass.getConstructor(GXService.class).newInstance(providerService);
} catch (final Exception ex) {
logger.error("Couldn't connect to external storage provider. ", ex.getMessage(), ex);
storageMessages(ex, messages[0]);
return false;
}
storageProvider[0] = this;
return true;
}
Aggregations