@Override protected Destination buildDestination(Adapter adapter) { Destination destination = super.buildDestination(adapter); destination.getProperties().put("server", null); destination.getProperties().put("server/broker-url", brokerUrl); destination.getProperties().put("server/create-broker", String.valueOf(createBroker)); if (createBroker) { destination.getProperties().put("server/wait-for-start", String.valueOf(waitForStart)); destination.getProperties().put("server/durable", String.valueOf(durable)); if (durable) destination.getProperties().put("server/file-store-root", fileStoreRoot); } return destination; } }
@Override protected Destination buildDestination(Adapter adapter) { Destination destination = super.buildDestination(adapter); destination.getProperties().put("jms", null); destination.getProperties().put("jms/destination-type", "Topic"); destination.getProperties().put("jms/destination-name", name); destination.getProperties().put("jms/destination-jndi-name", destinationJndiName); destination.getProperties().put("jms/connection-factory", connectionFactoryJndiName); if (textMessages) destination.getProperties().put("jms/message-type", "javax.jms.TextMessage"); destination.getProperties().put("jms/acknowledge-mode", acknowledgeMode); destination.getProperties().put("jms/transacted-sessions", String.valueOf(transactedSessions)); destination.getProperties().put("jms/no-local", String.valueOf(isNoLocal())); return destination; } }
protected Destination buildDestination(Adapter adapter) { List<String> channelIds = new ArrayList<String>(); channelIds.add("gravityamf"); Destination destination = new Destination(id, channelIds, new XMap(), roles, adapter, null); destination.getProperties().put("no-local", String.valueOf(noLocal)); destination.getProperties().put("session-selector", String.valueOf(sessionSelector)); if (getSecurizerClassName() != null) destination.getProperties().put("securizer", securizerClassName); if (getSecurizer() != null) destination.setSecurizer(getSecurizer()); return destination; } }
@Override public ServiceInvoker<?> getServiceInstance(RemotingMessage request) throws ServiceException { String messageType = request.getClass().getName(); String destinationId = request.getDestination(); ServicesConfig servicesConfig = GraniteContext.getCurrentInstance().getServicesConfig(); Destination destination = servicesConfig.findDestinationById(messageType, destinationId); if (destination == null) throw new ServiceException("No matching destination: " + destinationId); if (!destination.getProperties().containsKey(TideServiceInvoker.VALIDATOR_CLASS_NAME)) destination.getProperties().put(TideServiceInvoker.VALIDATOR_CLASS_NAME, "org.granite.tide.validation.BeanValidation"); @SuppressWarnings("unchecked") Bean<PersistenceConfiguration> pcBean = (Bean<PersistenceConfiguration>)manager.getBeans(PersistenceConfiguration.class).iterator().next(); PersistenceConfiguration persistenceConfiguration = (PersistenceConfiguration)manager.getReference(pcBean, PersistenceConfiguration.class, manager.createCreationalContext(pcBean)); if (destination.getProperties().containsKey(ENTITY_MANAGER_FACTORY_JNDI_NAME)) persistenceConfiguration.setEntityManagerFactoryJndiName(destination.getProperties().get(ENTITY_MANAGER_FACTORY_JNDI_NAME)); else if (destination.getProperties().containsKey(ENTITY_MANAGER_JNDI_NAME)) persistenceConfiguration.setEntityManagerJndiName(destination.getProperties().get(ENTITY_MANAGER_JNDI_NAME)); // Create an instance of the component CDIServiceInvoker invoker = new CDIServiceInvoker(destination, this); return invoker; } }
private ServiceInvoker<?> getServiceInvoker(Map<String, Object> cache, Destination destination, String key) { GraniteContext context = GraniteContext.getCurrentInstance(); synchronized (context.getSessionLock()) { ServiceInvoker<?> invoker = (ServiceInvoker<?>)cache.get(key); if (invoker == null) { String lookup = getLookup(); if (destination.getProperties().containsKey("lookup")) lookup = destination.getProperties().get("lookup"); EjbServiceContext tideContext = new EjbServiceContext(lookup, initialContext); if (destination.getProperties().containsKey(ENTITY_MANAGER_FACTORY_JNDI_NAME)) { tideContext.setEntityManagerFactoryJndiName(destination.getProperties().get(ENTITY_MANAGER_FACTORY_JNDI_NAME)); } else if (destination.getProperties().containsKey(ENTITY_MANAGER_JNDI_NAME)) { tideContext.setEntityManagerJndiName(destination.getProperties().get(ENTITY_MANAGER_JNDI_NAME)); } invoker = new TideServiceInvoker<EjbServiceFactory>(destination, this, tideContext); cache.put(key, invoker); } return invoker; } } }
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; } }
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; } }
protected SimpleServiceInvoker(Destination destination, SimpleServiceFactory factory) throws ServiceException { super(destination, factory); String className = destination.getProperties().get("source"); if (className == null) throw new ServiceException("No source property for destination: " + destination); className = className.trim(); log.debug(">> New SimpleServiceInvoker constructing new: %s", className); // Invokee class set at runtime (RemoteObject.source). if ("*".equals(className)) sources = new HashMap<String, Object>(); else { try { if (destination.getScannedClass() != null) this.invokee = destination.getScannedClass().newInstance(); else this.invokee = TypeUtil.newInstance(className); } catch (Exception e) { throw new ServiceException("Invalid source property for destination: " + destination, e); } sources = null; } }
protected SimpleServiceInvoker(Destination destination, SimpleServiceFactory factory) throws ServiceException { super(destination, factory); String className = destination.getProperties().get("source"); if (className == null) throw new ServiceException("No source property for destination: " + destination); className = className.trim(); log.debug(">> New SimpleServiceInvoker constructing new: %s", className); // Invokee class set at runtime (RemoteObject.source). if ("*".equals(className)) sources = new HashMap<String, Object>(); else { try { if (destination.getScannedClass() != null) this.invokee = destination.getScannedClass().newInstance(); else this.invokee = TypeUtil.newInstance(className); } catch (Exception e) { throw new ServiceException("Invalid source property for destination: " + destination, e); } sources = null; } }
public EjbServiceInvoker(Destination destination, EjbServiceFactory factory) throws ServiceException { super(destination, factory); String lookup = factory.getLookup(); if (destination.getProperties().containsKey("lookup")) lookup = destination.getProperties().get("lookup"); // Compute EJB JNDI binding. String name = destination.getId(); if (lookup != null) { name = lookup; if (lookup.contains(CAPITALIZED_DESTINATION_ID)) name = lookup.replace(CAPITALIZED_DESTINATION_ID, capitalize(destination.getId())); if (lookup.contains(DESTINATION_ID)) name = lookup.replace(DESTINATION_ID, destination.getId()); } log.debug(">> New EjbServiceInvoker looking up: %s", name); try { invokee = factory.lookup(name); } catch (NamingException e) { throw new ServiceException("Could not lookup for: " + name, e); } this.metadata = destination.getScannedClass() != null ? new EjbServiceMetadata(destination.getScannedClass(), invokee.getClass()) : new EjbServiceMetadata(destination.getProperties(), invokee.getClass()); }
return; String className = this.destination.getProperties().get(VALIDATOR_CLASS_NAME); if (className != null) { initValidatorWithClassName(className, null); String name = this.destination.getProperties().get(VALIDATOR_NAME); if (name != null) { try {
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); }
String factoryId = destination.getProperties().get("factory"); if (factoryId == null) { GraniteDestination gd;
serviceAdapter.setId(adapterId); serviceAdapter.setGravity(gravity); serviceAdapter.configure(config.getProperties(), destination.getProperties()); serviceAdapter.start();
List<String> tideRoles = serverFilter.tideRoles().length == 0 ? null : Arrays.asList(serverFilter.tideRoles()); Destination destination = new Destination(type, channelIds, new XMap(), tideRoles, null, null); destination.getProperties().put("factory", "tide-" + type + "-factory"); if (!("".equals(serverFilter.entityManagerFactoryJndiName()))) destination.getProperties().put("entity-manager-factory-jndi-name", serverFilter.entityManagerFactoryJndiName()); else if (!("".equals(serverFilter.entityManagerJndiName()))) destination.getProperties().put("entity-manager-jndi-name", serverFilter.entityManagerJndiName()); if (!("".equals(serverFilter.validatorClassName()))) destination.getProperties().put("validator-class-name", serverFilter.validatorClassName()); service.getDestinations().put(type, destination);
if (Boolean.TRUE.toString().equals(destination.getProperties().get("session-selector"))) { String selector = gdd.getDestinationSelector(destination.getId()); log.debug("Session selector found: %s", selector);