Search in sources :

Example 6 with GXService

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;
}
Also used : GXService(com.genexus.util.GXService)

Example 7 with GXService

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;
}
Also used : GXService(com.genexus.util.GXService) InProcessCache(com.genexus.db.InProcessCache)

Example 8 with GXService

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);
        }
    }
}
Also used : GXService(com.genexus.util.GXService) SQLException(java.sql.SQLException)

Aggregations

GXService (com.genexus.util.GXService)8 SQLException (java.sql.SQLException)2 InProcessCache (com.genexus.db.InProcessCache)1 ExternalProvider (com.genexus.db.driver.ExternalProvider)1 GXProperties (com.genexus.util.GXProperties)1 GXProperty (com.genexus.util.GXProperty)1 IOException (java.io.IOException)1 BinaryConnectionFactory (net.spy.memcached.BinaryConnectionFactory)1 ConnectionFactoryBuilder (net.spy.memcached.ConnectionFactoryBuilder)1 MemcachedClient (net.spy.memcached.MemcachedClient)1 AuthDescriptor (net.spy.memcached.auth.AuthDescriptor)1 PlainCallbackHandler (net.spy.memcached.auth.PlainCallbackHandler)1