use of com.genexus.xml.XMLReader in project JavaClasses by genexuslabs.
the class BaseProvider method loadQueryTables.
private void loadQueryTables() {
if (isEnabled()) {
String path = SpecificImplementation.Application.getModelContext().getHttpContext().getDefaultPath();
String configurationDirectoryPath = path + File.separatorChar + "Metadata" + File.separatorChar + "TableAccess";
ConcurrentHashMap<String, Vector<String>> qTables = new ConcurrentHashMap<String, Vector<String>>();
GXDirectory configurationDirectory = new GXDirectory(configurationDirectoryPath);
GXFileCollection files = configurationDirectory.getFiles();
XMLReader reader = new XMLReader();
short ok;
for (int i = 1; i <= files.getItemCount(); i++) {
Vector<String> lst = new Vector<String>();
// Caso en que se invalido el cache manualmente
lst.add(FORCED_INVALIDATE);
AbstractGXFile xmlFile = files.item(i);
reader.open(xmlFile.getAbsoluteName());
ok = reader.readType(1, "Table");
while (ok == 1) {
lst.add(normalizeKey((String) reader.getAttributeByName("name")));
ok = reader.readType(1, "Table");
}
reader.close();
qTables.put(normalizeKey((String) xmlFile.getNameNoExt()), lst);
}
startupDate = CommonUtil.now(false, false);
queryTables = qTables;
}
}
use of com.genexus.xml.XMLReader in project JavaClasses by genexuslabs.
the class GXReportMetadata method load.
public void load() {
XMLReader reader = new XMLReader();
reader.open(fileName);
if (reader.getErrCode() != 0) {
System.out.println("ERROR1");
System.err.println("Error opening metadata file: " + fileName);
return;
}
while (reader.readType(1, "PrintBlock") > 0) {
processPrintBlock(reader);
}
reader.close();
}
use of com.genexus.xml.XMLReader in project JavaClasses by genexuslabs.
the class GXDataInitialization method execDataInitialization.
public int execDataInitialization(String dynTrnInitializersFile) {
XMLReader reader = new XMLReader();
reader.open(dynTrnInitializersFile);
short ok = reader.readType(1, "Object");
Vector<String> lst = new Vector<String>();
while (ok == 1) {
lst.add((String) reader.getAttributeByName("Name"));
ok = reader.readType(1, "Object");
}
reader.close();
try {
for (String fullName : lst) {
System.out.println(localUtil.getMessages().getMessage("GXM_runpgm", new Object[] { fullName }));
Class<?> dpClass = Class.forName(packagePath + fullName.toLowerCase());
Object dp = dpClass.getConstructor(new Class<?>[] { int.class, ModelContext.class }).newInstance(new Object[] { new Integer(remoteHandle), context });
Class[] parameterTypes = new Class[] {};
Object[] arguments = new Object[] {};
GXBCCollection bcs = (GXBCCollection) dp.getClass().getMethod("executeUdp", parameterTypes).invoke(dp, arguments);
if (!bcs.insertOrUpdate()) {
int idx = 1;
while (idx <= bcs.size()) {
GxSilentTrnSdt bc = ((GxSilentTrnSdt) bcs.elementAt(-1 + idx));
if (!bc.Success()) {
System.out.println(MessagesToString(bc.GetMessages()));
}
idx = (int) (idx + 1);
}
}
}
cleanup();
return 0;
} catch (Exception e) {
System.out.println("ERROR:" + e.getMessage());
e.printStackTrace();
return 1;
}
}
use of com.genexus.xml.XMLReader in project JavaClasses by genexuslabs.
the class GXServices method loadFromFile.
public static void loadFromFile(String basePath, String fileName, GXServices services) {
if (basePath.equals("")) {
basePath = services.configBaseDirectory();
}
String fullPath = basePath + fileName;
XMLReader reader = new XMLReader();
reader.open(fullPath);
reader.readType(1, "Services");
reader.read();
if (reader.getErrCode() == 0) {
while (!reader.getName().equals("Services")) {
services.processService(reader);
reader.read();
if (// </Service>
reader.getName().equals("Service") && reader.getNodeType() == 2)
reader.read();
}
reader.close();
} else {
if (!ApplicationContext.getInstance().getReorganization()) {
logger.debug("GXServices - Could not load Services Config: " + fullPath + " - " + reader.getErrDescription());
}
}
}
use of com.genexus.xml.XMLReader in project JavaClasses by genexuslabs.
the class WebUtils method AddExternalServicesFile.
public static void AddExternalServicesFile(Class<?> gxAppClass, Set<Class<?>> rrcs, String servicesClassesFileName) {
try {
InputStream is = getInputStreamFile(gxAppClass, servicesClassesFileName);
if (is != null) {
// BOMInputStream bomInputStream = new BOMInputStream(is);// Avoid using BOMInputStream because of runtime error (java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.length([Ljava/lang/Object;)I) issue 94611
// IOUtils.toString(bomInputStream, "UTF-8");
String xmlstring = PrivateUtilities.BOMInputStreamToStringUTF8(is);
XMLReader reader = new XMLReader();
reader.openFromString(xmlstring);
if (reader.getErrCode() == 0) {
while (reader.readType(1, "Service") > 0) {
Class serviceClass = processRestService(reader);
if (serviceClass != null)
rrcs.add(serviceClass);
}
reader.close();
}
is.close();
}
} catch (FileNotFoundException fnfe) {
} catch (UnsupportedEncodingException e) {
logger.error("Error loading External Services classes ", e);
} catch (IOException ioe) {
logger.error("Error loading External Services classes ", ioe);
}
}
Aggregations