protected ServiceUnit createServiceUnit(String name, String rootPath) { DefaultServiceUnit su = new DefaultServiceUnit(); su.setComponent(component); su.setName(name); su.setRootPath(rootPath); return su; }
public ClassLoader getConfigurationClassLoader() { if (classLoader != null) { return classLoader; } else { return super.getConfigurationClassLoader(); } } }
public synchronized void shutDown() throws Exception { if (this.status == LifeCycleMBean.STARTED) { stop(); } if (this.status == LifeCycleMBean.STOPPED) { this.status = LifeCycleMBean.SHUTDOWN; // Deactivate endpoints Exception exception = null; for (Endpoint endpoint : getEndpoints()) { try { // TODO: uncomment when all tests in various components work fine // TODO: we also need to find a way to not wait forever on this call //component.prepareShutdown(endpoint); endpoint.deactivate(); } catch (Exception e) { exception = e; } } if (exception != null) { throw exception; } } }
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { // We receive an exchange for an EPR that has not been used yet. // Register a provider endpoint and restart processing. JmsEndpoint jmsEp = new JmsEndpoint(true); jmsEp.setServiceUnit(new DefaultServiceUnit(component)); jmsEp.setService(ep.getServiceName()); jmsEp.setEndpoint(ep.getEndpointName()); jmsEp.setRole(MessageExchange.Role.PROVIDER); URI uri = new URI(ep.getEndpointName()); Map map = URISupport.parseQuery(uri.getQuery()); if (IntrospectionSupport.setProperties(jmsEp, map, "jms.")) { uri = URISupport.createRemainingURI(uri, map); } if (uri.getPath() != null) { String path = uri.getSchemeSpecificPart(); while (path.startsWith("/")) { path = path.substring(1); } if (path.startsWith(AbstractJmsProcessor.STYLE_QUEUE + "/")) { jmsEp.setDestinationStyle(AbstractJmsProcessor.STYLE_QUEUE); jmsEp.setJmsProviderDestinationName(path.substring(AbstractJmsProcessor.STYLE_QUEUE.length() + 1)); } else if (path.startsWith(AbstractJmsProcessor.STYLE_TOPIC + "/")) { jmsEp.setDestinationStyle(AbstractJmsProcessor.STYLE_TOPIC); jmsEp.setJmsProviderDestinationName(path.substring(AbstractJmsProcessor.STYLE_TOPIC.length() + 1)); } } return jmsEp; }
public synchronized void stop() throws Exception { if (this.status == LifeCycleMBean.STARTED) { this.status = LifeCycleMBean.STOPPED; // Stop endpoints Exception exception = null; for (Endpoint endpoint : getEndpoints()) { try { endpoint.stop(); } catch (Exception e) { exception = e; } } if (exception != null) { throw exception; } } }
public void shutDown() throws Exception { super.shutDown(); classLoader = null; try { if (applicationContext != null) { applicationContext.destroy(); } applicationContext = null; } catch (Exception e) { throw new JBIException("Unable to close application context", e); } }
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { // We receive an exchange for an EPR that has not been used yet. // Register a provider endpoint and restart processing. HttpEndpoint httpEp = new HttpEndpoint(true); httpEp.setServiceUnit(new DefaultServiceUnit(component)); httpEp.setService(ep.getServiceName()); httpEp.setEndpoint(ep.getEndpointName()); httpEp.setRole(MessageExchange.Role.PROVIDER); URI uri = new URI(ep.getEndpointName()); Map map = URISupport.parseQuery(uri.getQuery()); if (IntrospectionSupport.setProperties(httpEp, map, "http.")) { uri = URISupport.createRemainingURI(uri, map); } if (httpEp.getLocationURI() == null) { httpEp.setLocationURI(uri.toString()); } return httpEp; }
public synchronized void init() throws Exception { if (this.status == LifeCycleMBean.SHUTDOWN) { // Activate endpoints List<Endpoint> activated = new ArrayList<Endpoint>(); try { for (Endpoint endpoint : getEndpoints()) { endpoint.activate(); activated.add(endpoint); } this.status = LifeCycleMBean.STOPPED; } catch (Exception e) { // Deactivate activated endpoints for (Endpoint endpoint : activated) { try { endpoint.deactivate(); } catch (Exception e2) { // do nothing } } throw e; } } }
public synchronized void start() throws Exception { if (this.status == LifeCycleMBean.STOPPED) { // Activate endpoints List<Endpoint> activated = new ArrayList<Endpoint>(); try { for (Endpoint endpoint : getEndpoints()) { endpoint.start(); } this.status = LifeCycleMBean.STARTED; } catch (Exception e) { // Deactivate activated endpoints for (Endpoint endpoint : activated) { try { endpoint.stop(); } catch (Exception e2) { // do nothing } } throw e; } } }