protected ServiceEndpoint[] getEndpoints() throws JBIException { ServiceEndpoint[] endpoints; if (endpointName != null && serviceName != null) { ServiceEndpoint ep = context.getEndpoint(serviceName, endpointName); if (ep == null) { endpoints = new ServiceEndpoint[0]; } else { this.endpoint = ep; endpoints = new ServiceEndpoint[] {ep }; } } else if (serviceName != null) { endpoints = context.getEndpointsForService(serviceName); } else if (interfaceName != null) { endpoints = context.getEndpoints(interfaceName); } else { throw new IllegalStateException("One of interfaceName or serviceName should be provided"); } return endpoints; }
public DeliveryChannel getDeliveryChannel() throws MessagingException { if (channel == null) { channel = context.getDeliveryChannel(); } return channel; }
protected ServiceEndpoint chooseEndpoint(ServiceEndpoint[] endpoints) throws JBIException { for (int i = 0; i < endpoints.length; i++) { if (context.getEndpointDescriptor(endpoints[i]) != null) { return endpoints[i]; } } return null; }
targetEndpoint = componentContext.getEndpoint(getTargetService(), getTargetEndpoint()); ServiceEndpoint[] endPoints = componentContext.getEndpointsForService(this.getTargetService()); if (endPoints != null && endPoints.length > 0) { targetEndpoint = endPoints[0]; ServiceEndpoint[] endPoints = componentContext.getEndpoints(this.getTargetInterface()); if (endPoints != null && endPoints.length > 0) { targetEndpoint = endPoints[0]; Document targetEndpointDescriptor = componentContext.getEndpointDescriptor(targetEndpoint); if (targetEndpointDescriptor == null) { throw new JBIException("The target endpoint descriptor is null.");
String u = this.uri.substring(10); String[] parts = split2(u); return context.getEndpoints(new QName(parts[0], parts[1])); } else if (uri.startsWith("operation:")) { return context.getEndpoints(new QName(parts[0], parts[1])); } else if (uri.startsWith("service:")) { String u = this.uri.substring(8); String[] parts = split2(u); return context.getEndpointsForService(new QName(parts[0], parts[1])); } else if (uri.startsWith("endpoint:")) { String u = this.uri.substring(9); String[] parts = split3(u); ServiceEndpoint se = context.getEndpoint(new QName(parts[0], parts[1]), parts[2]); if (se != null) { return new ServiceEndpoint[] {se }; ServiceEndpoint se = context.resolveEndpointReference(epr); if (se != null) { return new ServiceEndpoint[] {se };
protected void doInit() throws Exception { configuration.setRootDir(context.getWorkspaceRoot()); configuration.setComponentName(context.getComponentName()); configuration.load(); try { String name = configuration.getKeystoreManagerName(); Object km = context.getNamingContext().lookup(name); configuration.setKeystoreManager(km); } catch (Throwable e) { try { String name = configuration.getAuthenticationServiceName(); Object as = context.getNamingContext().lookup(name); configuration.setAuthenticationService(as); } catch (Throwable e) { } else { JettyContextManager jcm = new JettyContextManager(); jcm.setMBeanServer(context.getMBeanServer()); this.server = jcm;
protected void doInit() throws Exception { super.doInit(); configuration.setRootDir(context.getWorkspaceRoot()); configuration.setComponentName(this.context.getComponentName()); configuration.load(); try { String name = configuration.getKeystoreManagerName(); Object km = context.getNamingContext().lookup(name); configuration.setKeystoreManager(km); } catch (Exception e) { try { String name = configuration.getAuthenticationServiceName(); Object as = context.getNamingContext().lookup(name); configuration.setAuthenticationService(as); } catch (Exception e) {
public ServiceEndpoint[] resolveAvailableEndpoints(ComponentContext context, MessageExchange exchange) throws JBIException { ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName); if (endpoint != null) { return new ServiceEndpoint[] {endpoint }; } else { return new ServiceEndpoint[0]; } }
/** * TODO getEndpointDescriptor works only with implementation InternalEndpoint * Retrieve the service description metadata for the specified endpoint. * <p> * Note that the result can use either the WSDL 1.1 or WSDL 2.0 description * language. * * @param endpoint * endpoint reference; must be non-null. * @return metadata describing endpoint, or <code>null</code> if metadata * is unavailable. * @throws javax.jbi.JBIException * invalid endpoint reference. * @throws RemoteException * impossible to realize a remote access */ public Document getEndpointDescriptor(final ServiceEndpoint endpoint) throws JBIException, RemoteException { Document doc = null; ServiceEndpoint se = this.componentContext.getEndpoint(endpoint.getServiceName(), endpoint.getEndpointName()); if (se != null) { doc = this.componentContext.getEndpointDescriptor(se); } return doc; }
/** * @see javax.jbi.component.ComponentContext#getWorkspaceRoot() */ public String getWorkspaceRoot() { return this.context.getWorkspaceRoot(); }
public DSBServiceServerImpl(ComponentContext componentContext) { this.componentContext = componentContext; try { this.channel = this.componentContext.getDeliveryChannel(); } catch (MessagingException e) { e.printStackTrace(); } try { this.logger = this.componentContext.getLogger("", null); } catch (MissingResourceException e) { e.printStackTrace(); } catch (JBIException e) { e.printStackTrace(); } }
/** * Get the unique component name of this component, as assigned by the * identification section of this component's installation descriptor. * * @throws RemoteException * impossible to realize a remote access * @return the component name; must be non-null and non-empty. */ public String getComponentName() throws RemoteException { return this.componentContext.getComponentName(); }
/** * TODO : not allowed in the specification but necessary to manage the * loggers properly * * @see javax.jbi.component.ComponentContext#getLogger(java.lang.String, * java.lang.String) */ public Logger getLogger(String suffix, String resourceBundleName) throws MissingResourceException, JBIException { // throw new JBIException("Not allowed in InstallationContext"); return this.context.getLogger(suffix, resourceBundleName); }
public void sendMessages(int messageCount, boolean sync) throws MessagingException { LOGGER.info("Looking for services for interface: {}", interfaceName); ServiceEndpoint[] endpoints = context.getEndpointsForService(interfaceName); if (endpoints.length > 0) { ServiceEndpoint endpoint = endpoints[0]; LOGGER.info("Sending to endpoint: {}", endpoint); for (int i = 0; i < messageCount; i++) { InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange(); NormalizedMessage message = exchange.createMessage(); exchange.setEndpoint(endpoint); exchange.setInMessage(message); // lets set the XML as a byte[], String or DOM etc String xml = "<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'>" + " <s12:Body><foo>Hello!</foo> </s12:Body>" + "</s12:Envelope>"; message.setContent(new StringSource(xml)); LOGGER.info("sending message: {}", i); DeliveryChannel deliveryChannel = context.getDeliveryChannel(); LOGGER.info("sync send on deliverychannel: {}", deliveryChannel); if (sync) { deliveryChannel.sendSync(exchange); } else { deliveryChannel.send(exchange); } } } else { LOGGER.warn("No endpoints available for interface: {}", interfaceName); } }
@Override protected void doInit() throws Exception { //Load configuration configuration.setRootDir(context.getWorkspaceRoot()); configuration.setComponentName(context.getComponentName()); configuration.load(); if (configuration.getBusCfg() != null && configuration.getBusCfg().length() > 0) { CXF_CONFIG[0] = configuration.getBusCfg(); } if (bus == null) { bus = new SpringBusFactory().createBus(CXF_CONFIG); bus.getProperties().put(org.apache.cxf.interceptor.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, "true"); } super.doInit(); }
/** * Deactivates the given endpoint with the NMR. Deactivation indicates to * the NMR that this component will no longer process requests sent to the * named endpoint. * * @param endpoint * reference to the endpoint to be deactivated; must be non-null. * @throws javax.jbi.JBIException * if the endpoint cannot be deactivated. * @throws RemoteException * impossible to realize a remote access */ public void deactivateEndpoint(final ServiceEndpoint endpoint) throws JBIException, RemoteException { try { ServiceEndpoint se = this.componentContext.getEndpoint(endpoint.getServiceName(), endpoint.getEndpointName()); this.componentContext.deactivateEndpoint(se); } catch (JBIException e) { throw Convert.convertJBIException(e); } }
/** * @see javax.jbi.component.ComponentContext#getMBeanNames() */ public MBeanNames getMBeanNames() { return context.getMBeanNames(); }
assert operationName != null; final ServiceEndpoint[] endpoints = this.context.getEndpointsForService(serviceName); if (endpoints.length == 0) { throw new MessagingException("No endpoint is registered for service k" + serviceName + "'"); for (final ServiceEndpoint endpoint : endpoints) { try { doc = this.context.getEndpointDescriptor(endpoint); if (doc != null) { endpointName = endpoint.getEndpointName();
protected void doInit() throws Exception { // Register extension mbean MBeanServer server = this.context.getMBeanServer(); Object mbean = getExtensionMBean(); if (server != null && mbean != null) { MBeanServerHelper.register(server, createExtensionMBeanName(), mbean); } // Obtain or create the work manager // When using the WorkManager from ServiceMix, // some class loader problems can appear when // trying to uninstall the components. // Some threads owned by the work manager have a // security context referencing the component class loader // so that every loaded classes are locked // this.workManager = findWorkManager(); if (this.executorFactory == null) { this.executorFactory = findExecutorFactory(); } if (this.executorFactory == null) { this.executorFactory = createExecutorFactory(); } this.consumerExecutor = this.executorFactory.createExecutor("component." + getContext().getComponentName() + ".consumer"); this.providerExecutor = this.executorFactory.createExecutor("component." + getContext().getComponentName() + ".provider"); }
private void registerMBean() throws JBIException { ProcessAndInstanceManagementMBean pmapi = new ProcessAndInstanceManagementMBean(_ode._server,_ode._store); MBeanServer server = _ode.getContext().getMBeanServer(); try { if (server != null) { _mbeanName = _ode.getContext().getMBeanNames().createCustomComponentMBeanName("Management"); if (server.isRegistered(_mbeanName)) { server.unregisterMBean(_mbeanName); } server.registerMBean(pmapi, _mbeanName); } } catch (Exception e) { throw new JBIException(e); } }