/** * Creates or updates the text value of the element (or text or attribute) matched by * the supplied XPath expression. If the matched element (or text or attribute) does not exist, * it is created with the last segment of the XPath expression (but its parent must already exist). * * @param key an XPath expression. * @param value the value to set (may be null). * @return the previous value of the matched element (may be null). * @throws RuntimeException if the root element of this XMap is null, if the XPath expression is not valid, * or (creation case) if the parent node does not exist or is not an element instance. */ public String put(String key, String value) { return put(key, value, false); }
/** * Creates or updates the text value of the element (or text or attribute) matched by * the supplied XPath expression. If the matched element (or text or attribute) does not exist, * it is created with the last segment of the XPath expression (but its parent must already exist). * * @param key an XPath expression. * @param value the value to set (may be null). * @return the previous value of the matched element (may be null). * @throws RuntimeException if the root element of this XMap is null, if the XPath expression is not valid, * or (creation case) if the parent node does not exist or is not an element instance. */ public String put(String key, String value) { return put(key, value, false); }
/** * Creates or updates the text value of the element (or text or attribute) matched by * the supplied XPath expression. If the matched element (or text or attribute) does not exist, * it is created with the last segment of the XPath expression (but its parent must already exist). * * @param key an XPath expression. * @param value the value to set (may be null). * @return the previous value of the matched element (may be null). * @throws RuntimeException if the root element of this XMap is null, if the XPath expression is not valid, * or (creation case) if the parent node does not exist or is not an element instance. */ public String put(String key, String value) { return put(key, value, false); }
/** * Creates or updates the text value of the element (or text or attribute) matched by * the supplied XPath expression. If the matched element (or text or attribute) does not exist, * it is created with the last segment of the XPath expression (but its parent must already exist). * * @param key an XPath expression. * @param value the value to set (may be null). * @return the previous value of the matched element (may be null). * @throws RuntimeException if the root element of this XMap is null, if the XPath expression is not valid, * or (creation case) if the parent node does not exist or is not an element instance. */ public String put(String key, String value) { return put(key, value, false); }
@Property(name = "scope", mandatory = false) private void setScope(String scope) { this.properties.put("scope", scope); }
@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; } }
factoryId = anno.factory(); else if (this.factories.isEmpty()) { props.put("scope", anno.scope()); props.put("source", clazz.getName()); log.info("Default POJO factory selected for destination in class: " + clazz.getName() + " with scope: " + anno.scope()); props.put("factory", factoryId); if (!(anno.source().equals(""))) props.put("source", anno.source()); props.put("securizer", anno.securizer().getName());
factoryId = anno.factory(); else if (this.factories.isEmpty()) { props.put("scope", anno.scope()); props.put("source", clazz.getName()); log.info("Default POJO factory selected for destination in class: " + clazz.getName() + " with scope: " + anno.scope()); props.put("factory", factoryId); if (!(anno.source().equals(""))) props.put("source", anno.source()); props.put("securizer", anno.securizer().getName());
@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; } }
@Validate public void start() { log.debug("Start OSGiDestinationFactory: " + toString()); if (service.findDestinationById(id) == null) { this.properties.put("factory", factory.getId()); service.addDestination(this); started = true; } else { log.error("Destination \"" + id + "\" already registered"); } }
@Override public void configure(XMap properties) throws ServiceException { String sServiceExceptionHandler = properties.get("service-exception-handler"); if (sServiceExceptionHandler == null) { XMap props = new XMap(properties); props.put("service-exception-handler", ExtendedServiceExceptionHandler.class.getName()); super.configure(props); } else super.configure(properties); GraniteConfig config = GraniteContext.getCurrentInstance().getGraniteConfig(); config.registerExceptionConverter(PersistenceExceptionConverter.class); config.registerExceptionConverter(EJBAccessExceptionConverter.class); this.lookup = properties.get("lookup"); }
if (sServiceExceptionHandler == null) { XMap props = new XMap(properties); props.put("service-exception-handler", "org.granite.messaging.service.ExtendedServiceExceptionHandler"); super.configure(props);
factoryProperties.put("lookup", lookup); factoryProperties.put("enable-exception-logging", String.valueOf(serverFilter.enableExceptionLogging())); 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);