/** * <p> * Associates an endpoint with a service unit. The service unit is used by the container to manage the endpoint's lifecycle. * </p> * * @param serviceUnit a <code>ServiceUnit</code> to which the endpoint will be associated * @org.apache.xbean.Property description="the service unit responsible for the endpoint" hidden="true */ public void setServiceUnit(ServiceUnit serviceUnit) { this.serviceUnit = serviceUnit; this.logger = serviceUnit.getComponent().getLogger(); }
public AbstractEndpoint(ServiceUnit serviceUnit, QName service, String endpoint) { this.serviceUnit = serviceUnit; this.logger = serviceUnit.getComponent().getLogger(); this.service = service; this.endpoint = endpoint; }
protected Container getContainer() { try { ComponentContext ctx = getServiceUnit().getComponent().getComponentContext(); Field field = ctx.getClass().getDeclaredField("container"); field.setAccessible(true); return (Container) field.get(ctx); } catch (Exception e) { logger.debug("Unable to retrieve JBIContainer: {}", e.getMessage()); return null; } }
protected HttpConfiguration getConfiguration() { HttpComponent comp = (HttpComponent) endpoint.getServiceUnit().getComponent(); return comp.getConfiguration(); } }
public JmsConfiguration getConfiguration() { JmsComponent component = (JmsComponent) getServiceUnit().getComponent(); return component.getConfiguration(); }
protected void doStart() throws Exception { synchronized (running) { endpoint.getServiceUnit().getComponent().getExecutor(MessageExchange.Role.CONSUMER).execute(new Runnable() { public void run() { StandardConsumerProcessor.this.poll(); } }); running.wait(); } }
private long obtainTimeout() { long to = this.timeout; if (to == 0) { to = ((HttpComponent) getServiceUnit().getComponent()).getConfiguration().getConsumerProcessorSuspendTime(); } return to; }
public void deactivate() throws Exception { if (activated == null) { throw new IllegalStateException("Endpoint not activated: " + this); } ServiceEndpoint ep = activated; activated = null; ComponentContext ctx = getServiceUnit().getComponent().getComponentContext(); ctx.deactivateEndpoint(ep); super.deactivate(); }
public EndpointDeliveryChannel(Endpoint endpoint) throws MessagingException { this.endpoint = endpoint; this.channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel(); }
protected void handleExchange(MessageExchange exchange, boolean add) throws MessagingException { Endpoint ep = getEndpoint(); ep.getServiceUnit().getComponent().handleExchange(ep, exchange, add); }
protected HttpClient getClient() { HttpComponent comp = (HttpComponent) endpoint.getServiceUnit().getComponent(); //TODO apply the same changes what was applied to HttpProviderEndpoint during last 5 years // it can work only when there is only one http:endpoint with role provider in the whole jvm HttpClient client = comp.getClient(); client.getParams().setSoTimeout(endpoint.getTimeout()); return client; }
public AuthenticationService getAuthenticationService() { HttpComponent comp = (HttpComponent)getServiceUnit().getComponent(); return AuthenticationService.Proxy.create(comp.getAuthenticationService()); }
public void activate() throws Exception { super.activate(); ComponentContext ctx = getServiceUnit().getComponent().getComponentContext(); activated = ctx.activateEndpoint(service, endpoint); }
public synchronized void deactivate() throws Exception { ServiceMixComponent component = getServiceUnit().getComponent(); ComponentContext ctx = component.getComponentContext(); if (activated != null) { ServiceEndpoint se = activated; activated = null; ctx.deregisterExternalEndpoint(se); } super.deactivate(); }
public void start() throws Exception { InitialContext ctx = getInitialContext(); connectionFactory = getConnectionFactory(ctx); channel = endpoint.getServiceUnit().getComponent().getComponentContext().getDeliveryChannel(); destination = endpoint.getDestination(); if (destination == null) { if (endpoint.getJndiDestinationName() != null) { destination = (Destination) ctx.lookup(endpoint.getJndiDestinationName()); } else if (endpoint.getJmsProviderDestinationName() == null) { throw new IllegalStateException("No destination provided"); } } }
protected Bus getBus() { if (providedBus != null) { return providedBus; } else if (getBusCfg() != null) { if (bus == null) { SpringBusFactory bf = new SpringBusFactory(); bus = bf.createBus(getBusCfg()); } return bus; } else { return ((CxfBcComponent) getServiceUnit().getComponent()).getBus(); } }
public void start() throws Exception { super.start(); OSWorkflowComponent component = (OSWorkflowComponent) getServiceUnit().getComponent(); executor = component.getExecutorFactory().createExecutor("component." + component.getComponentName() + "." + EndpointSupport.getKey(this)); }
protected ServiceEndpoint createExternalEndpoint() { return new ExternalEndpoint(getServiceUnit().getComponent().getEPRElementName(), getLocationURI(), getService(), getEndpoint(), getInterfaceName()); }
public synchronized void activate() throws Exception { super.activate(); ServiceMixComponent component = getServiceUnit().getComponent(); ComponentContext ctx = component.getComponentContext(); activated = new ExternalEndpoint(component.getEPRElementName(), getLocationURI(), getService(), getEndpoint(), getInterfaceName()); ctx.registerExternalEndpoint(activated); }
protected DeploymentException failure(String task, String info, Throwable e) { ManagementSupport.Message msg = new ManagementSupport.Message(); msg.setComponent(serviceUnit.getComponent().getComponentName()); msg.setTask(task); msg.setResult("FAILED"); msg.setType("ERROR"); msg.setMessage(info); msg.setException(e); return new DeploymentException(ManagementSupport.createComponentMessage(msg)); }