use of com.genexus.common.classes.AbstractGXFile 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.common.classes.AbstractGXFile in project JavaClasses by genexuslabs.
the class URLRouter method load.
private static void load() {
String line;
InputStream is = null;
String defaultPath = SpecificImplementation.Application.getModelContext().getHttpContext().getDefaultPath();
String appPackage = SpecificImplementation.Application.getClientPreferences().getPACKAGE();
if (!appPackage.equals(""))
appPackage = File.separatorChar + appPackage.replace('.', File.separatorChar);
String classesDirectoryPath = defaultPath + File.separator + "WEB-INF" + File.separatorChar + "classes" + appPackage;
GXDirectory classesDirectory = new GXDirectory(classesDirectoryPath);
GXFileCollection rewriteFiles = classesDirectory.getFiles(".rewrite");
if (rewriteFiles != null) {
for (int i = 1; i <= rewriteFiles.getItemCount(); i++) {
serverRelative = true;
AbstractGXFile rewriteFile = rewriteFiles.item(i);
try {
is = SpecificImplementation.Messages.getInputStream(rewriteFile.getName());
if (is != null) {
BufferedReader bufread = new BufferedReader(new InputStreamReader(is, "UTF8"));
line = bufread.readLine();
while (line != null) {
parseLine(line);
line = bufread.readLine();
}
bufread.close();
}
} catch (UnsupportedEncodingException e) {
logger.error(e.toString(), e);
} catch (FileNotFoundException e) {
logger.info("There is no URLRouter file");
} catch (IOException e) {
logger.error(e.toString(), e);
}
}
}
}
Aggregations