use of com.genexus.util.GXProperties 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;
}
use of com.genexus.util.GXProperties in project JavaClasses by genexuslabs.
the class GXXMLSerializable method toxml.
public String toxml(boolean includeHeader, boolean includeState, String header, String namespace) {
if (SpecificImplementation.Application.getProperty("SIMPLE_XML_SUPPORT", "0").equals("1")) {
try {
Class<?> me = getClass();
Object struct = me.getMethod("getStruct", new Class[] {}).invoke(this, (Object[]) null);
GXProperties stateAttributes = null;
if (isVisitorStrategy(includeState)) {
stateAttributes = getStateAttributes();
}
try {
return GXXMLSerializer.serializeSimpleXml(includeHeader, SpecificImplementation.Application.createCollectionWrapper(struct), stateAttributes);
} catch (ClassCastException e) {
return GXXMLSerializer.serializeSimpleXml(includeHeader, struct, stateAttributes);
}
} catch (Exception e) {
e.printStackTrace();
}
return "";
} else {
XMLWriter oWriter = new XMLWriter();
oWriter.openToString();
if (includeHeader)
oWriter.writeStartDocument("UTF-8");
writexml(oWriter, header, namespace, includeState);
oWriter.close();
return oWriter.getResultingString();
}
}
Aggregations