@Override public Map<String, Object> getApplicationMap() { return graniteContext.getApplicationMap(); }
private DefaultConstructorFactory getDefaultConstructorFactory( GraniteContext context, String key) { lock.lock(); try { DefaultConstructorFactory factory = (DefaultConstructorFactory)context.getApplicationMap().get(key); if (factory == null) { try { factory = new SunDefaultConstructorFactory(); } catch (Exception e) { // fall down... } if (factory == null) factory = new NoDefaultConstructorFactory(); context.getApplicationMap().put(key, factory); } return factory; } finally { lock.unlock(); } }
private DefaultConstructorFactory getDefaultConstructorFactory( GraniteContext context, String key) { lock.lock(); try { DefaultConstructorFactory factory = (DefaultConstructorFactory)context.getApplicationMap().get(key); if (factory == null) { try { factory = new SunDefaultConstructorFactory(); } catch (Exception e) { // fall down... } if (factory == null) factory = new NoDefaultConstructorFactory(); context.getApplicationMap().put(key, factory); } return factory; } finally { lock.unlock(); } }
private DefaultConstructorFactory getDefaultConstructorFactory( GraniteContext context, String key) { lock.lock(); try { DefaultConstructorFactory factory = (DefaultConstructorFactory)context.getApplicationMap().get(key); if (factory == null) { try { factory = new SunDefaultConstructorFactory(); } catch (Exception e) { // fall down... } if (factory == null) factory = new NoDefaultConstructorFactory(); context.getApplicationMap().put(key, factory); } return factory; } finally { lock.unlock(); } }
private DefaultConstructorFactory getDefaultConstructorFactory( GraniteContext context, String key) { lock.lock(); try { DefaultConstructorFactory factory = (DefaultConstructorFactory)context.getApplicationMap().get(key); if (factory == null) { try { factory = new SunDefaultConstructorFactory(); } catch (Exception e) { // fall down... } if (factory == null) factory = new NoDefaultConstructorFactory(); context.getApplicationMap().put(key, factory); } return factory; } finally { lock.unlock(); } }
public void removeFromCache(String destinationId) { GraniteContext context = GraniteContext.getCurrentInstance(); String key = getUniqueKey(destinationId); // Synchronize on unique key. synchronized (key) { context.getApplicationMap().remove(key); Map<String, Object> sessionMap = context.getSessionMap(false); if (sessionMap != null) context.getSessionMap().remove(key); } }
@Override public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException { String messageType = request.getClass().getName(); String destinationId = request.getDestination(); GraniteContext context = GraniteContext.getCurrentInstance(); Map<String, Object> cache = context.getApplicationMap(); Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId); String key = TideServiceInvoker.class.getName() + '.' + destinationId; return getServiceInvoker(cache, destination, key); }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
private Map<String, Object> getCache(Destination destination) throws ServiceException { GraniteContext context = GraniteManager.getCurrentInstance(); String scope = destination.getProperties().get("scope"); Map<String, Object> cache = null; if (scope == null || "request".equals(scope)) cache = context.getRequestMap(); else if ("session".equals(scope)) cache = context.getSessionMap(); else if ("application".equals(scope)) cache = Collections.synchronizedMap(context.getApplicationMap()); else throw new ServiceException("Illegal scope in destination: " + destination); return cache; } }
invoker = (EjbServiceInvoker)context.getApplicationMap().get(key); if (invoker == null) { Map<String, Object> sessionMap = context.getSessionMap(false); context.getApplicationMap();
public static ServiceFactory getFactoryInstance(RemotingMessage request) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String messageType = request.getClass().getName(); String destinationId = request.getDestination(); log.debug(">> Finding factoryId for messageType: %s and destinationId: %s", messageType, destinationId); Destination destination = ((ServicesConfig)context.getServicesConfig()).findDestinationById(messageType, destinationId); if (destination == null) throw new ServiceException("Destination not found: " + destinationId); String factoryId = destination.getProperties().get("factory"); log.debug(">> Found factoryId: %s", factoryId); Map<String, Object> cache = context.getApplicationMap(); String key = ServiceFactory.class.getName() + '.' + factoryId; return getServiceFactory(cache, context, factoryId, key); }
public static ServiceFactory getFactoryInstance(RemotingMessage request) throws ServiceException { GraniteContext context = GraniteContext.getCurrentInstance(); String messageType = request.getClass().getName(); String destinationId = request.getDestination(); log.debug(">> Finding factoryId for messageType: %s and destinationId: %s", messageType, destinationId); Destination destination = context.getServicesConfig().findDestinationById(messageType, destinationId); if (destination == null) throw new ServiceException("Destination not found: " + destinationId); String factoryId = destination.getProperties().get("factory"); log.debug(">> Found factoryId: %s", factoryId); Map<String, Object> cache = context.getApplicationMap(); String key = ServiceFactory.class.getName() + '.' + factoryId; return getServiceFactory(cache, context, factoryId, key); }
protected void initValidator() { Map<String, Object> applicationMap = GraniteContext.getCurrentInstance().getApplicationMap(); Boolean validatorNotAvailable = (Boolean)applicationMap.get(VALIDATOR_NOT_AVAILABLE); validator = (EntityValidator)applicationMap.get(VALIDATOR_KEY);