use of com.genexus.util.GXService in project JavaClasses by genexuslabs.
the class GXWebSocketCommon method getHandlerClassName.
private String getHandlerClassName(HandlerType hType) {
int idx = hType.ordinal();
String handlerClassName = handlerCache[idx];
if (handlerClassName == null) {
String type = getPtyTypeName(hType);
GXService service = GXServices.getInstance().get(GXServices.WEBNOTIFICATIONS_SERVICE);
if (service != null && service.getProperties() != null) {
String className = service.getProperties().get(type);
if (className != null && className.length() > 0) {
handlerClassName = GXutil.getClassName(className.toLowerCase());
handlerCache[idx] = handlerClassName;
}
}
}
return handlerClassName;
}
use of com.genexus.util.GXService in project JavaClasses by genexuslabs.
the class CacheFactory method getInstance.
public static ICacheService getInstance() {
if (instance == null) {
synchronized (syncRoot) {
if (instance == null) {
GXService providerService = Application.getGXServices().get(GXServices.CACHE_SERVICE);
if (providerService != null) {
String warnMsg = "Couldn't create CACHE_PROVIDER as ICacheService: " + providerService.getClassName();
try {
logger.info("Loading providerService:" + providerService.getClassName());
Class<?> type = Class.forName(providerService.getClassName());
if (type != null) {
ICacheService cacheInstance = (ICacheService) type.getDeclaredConstructor().newInstance();
if (cacheInstance != null) {
instance = cacheInstance;
if (providerService.getProperties().containsKey(FORCE_HIGHEST_TIME_TO_LIVE)) {
if (Integer.parseInt(providerService.getProperties().get(FORCE_HIGHEST_TIME_TO_LIVE)) == 1) {
forceHighestTimetoLive = true;
}
}
} else {
logger.error(warnMsg);
System.err.println(warnMsg);
}
}
} catch (Exception ex) {
logger.error(warnMsg, ex);
System.err.println(warnMsg);
ex.printStackTrace();
}
}
if (instance == null) {
instance = new InProcessCache();
}
LoadTTLFromPreferences();
}
}
}
return instance;
}
use of com.genexus.util.GXService in project JavaClasses by genexuslabs.
the class DataSource method setDBMS.
private void setDBMS(String dbmsName) {
String className = "com.genexus.db.driver.GXDBMS" + dbmsName.toLowerCase();
try {
dbms = (GXDBMS) Class.forName(className).getConstructor().newInstance();
} catch (Exception e) {
throw new InternalError("Unrecognized DBMS in configuration file : " + dbmsName + " / " + className);
}
GXService providerService = Application.getGXServices().get(GXServices.DATA_ACCESS_SERVICE);
if (providerService != null) {
String providerClassName = providerService.getClassName();
try {
logger.info("Loading providerService:" + providerClassName);
dbms = (GXDBMS) Class.forName(providerClassName).getConstructor(new Class[] { GXDBMS.class }).newInstance(new Object[] { dbms });
} catch (Exception ex) {
logger.error("Couldn't create DATA_ACCESS_PROVIDER as : " + providerClassName, ex);
}
}
}
Aggregations