Package org.switchyard

Examples of org.switchyard.ServiceDomain


                String tns = getTargetNamespace();
                if (tns != null) {
                    serviceName = XMLHelper.createQName(tns, serviceName.getLocalPart());
                }
            }
            ServiceDomain serviceDomain = getServiceDomain();
            if (serviceDomain == null) {
                throw CommonKnowledgeMessages.MESSAGES.serviceDomainNull();
            }
            ServiceReference serviceReference = serviceDomain.getServiceReference(serviceName);
            if (serviceReference == null) {
                throw CommonKnowledgeMessages.MESSAGES.serviceReferenceNull(serviceName.toString());
            }
            final Exchange exchangeIn;
            FaultHandler handler = new FaultHandler();
View Full Code Here


        ClassLoader setTCCL = null;
        boolean transactionPropagated = false;
       
        try {
            // Grab the right service domain based on the service header
            ServiceDomain domain = findDomain(request);
            // Set our TCCL to the domain's deployment loader
            ClassLoader loader = (ClassLoader) domain.getProperty(Deployment.CLASSLOADER_PROPERTY);
            setTCCL = Classes.setTCCL(loader);
           
            transactionPropagated = bridgeIncomingTransaction(request);

            RemoteMessage msg = _serializer.deserialize(request.getInputStream(), RemoteMessage.class);
            if (_log.isDebugEnabled()) {
                _log.debug("Remote servlet received request for service " + msg.getService());
            }
           
            ServiceReference service = domain.getServiceReference(msg.getService());
            SynchronousInOutHandler replyHandler = new SynchronousInOutHandler();
            Exchange ex = msg.getOperation() == null
                    ? service.createExchange(replyHandler)
                    : service.createExchange(msg.getOperation(), replyHandler);
            Message m = ex.createMessage();
View Full Code Here

            throw new SwitchYardException(th);
        }
    }
   
    private ServiceDomain findDomain(HttpServletRequest request) throws SwitchYardException {
        ServiceDomain domain = null;
        String service = request.getHeader(HttpInvoker.SERVICE_HEADER);
       
        if (service == null || service.trim().length() == 0) {
            throw SCAMessages.MESSAGES.requiredHeaderIsMissingOrEmpty(HttpInvoker.SERVICE_HEADER);
        }
View Full Code Here

    @Override
    public void process(final org.apache.camel.Exchange camelExchange) throws Exception {
        final String namespace = camelExchange.getProperty(CamelConstants.APPLICATION_NAMESPACE, String.class);
        final String targetUri = camelExchange.getProperty(org.apache.camel.Exchange.TO_ENDPOINT, String.class);
        ServiceDomain domain = ((SwitchYardCamelContext) camelExchange.getContext()).getServiceDomain();
        final ServiceReference serviceRef = lookupServiceReference(targetUri, namespace, domain,
                camelExchange.getProperty(SwitchYardConsumer.COMPONENT_NAME, QName.class));

        // set a flag to indicate whether this producer endpoint is used within a service route
        boolean isGatewayRoute = camelExchange.getProperty(SwitchYardConsumer.IMPLEMENTATION_ROUTE) == null;
View Full Code Here

       
        BindingDataCreator<?> bindingCreator = getBindingDataCreator(camelExchange);
        CamelBindingData bindingData = bindingCreator.createBindingData(camelExchange.getIn());
        if (bindingData instanceof SecurityBindingData) {
            // returned binding is contains some security bindings, let's move them to security context
            ServiceDomain serviceDomain = ((SwitchYardCamelContext)camelExchange.getContext()).getServiceDomain();
            SecurityContextManager securityContextManager = new SecurityContextManager(serviceDomain);
            securityContextManager.addCredentials(switchyardExchange, ((SecurityBindingData)bindingData).extractCredentials());
        }
       
        /*
 
View Full Code Here

    @Test (expected = SwitchYardException.class)
    public void should_throw_if_serviceReference_is_missing() throws Exception {
        final SwitchYardModel model = pullSwitchYardModel();
        final Deployment deployment = new Deployment(model);
        final ServiceDomain domain = new ServiceDomainManager().createDomain(ROOT_DOMAIN, deployment.getConfig());
        final List<Activator> activators = ActivatorLoader.createActivators(domain);
        deployment.init(domain, activators);
        deployment.start();
    }
View Full Code Here

                }
            }
            try {
                _simpleCdiDeployment = simpleCdiDeploymentType.newInstance();
                _simpleCdiDeployment.setParentDeployment(deployment);
                ServiceDomain domain = new ServiceDomainManager().createDomain();
                _simpleCdiDeployment.init(domain, getTestKit().getActivators());
                _simpleCdiDeployment.start();
            } catch (Exception e) {
                e.printStackTrace();
                Assert.fail("Failed to manually deploy Bean Service.  Exception: " + e.getMessage());
View Full Code Here

    @Test
    public void testHandlerRegistration() throws Exception {
        SwitchYardModel switchyard = new ModelPuller<SwitchYardModel>().pull(
                "/switchyard-config-properties-01.xml", getClass());
       
        ServiceDomain domain = new ServiceDomainManager().createDomain(
                new QName("test"), switchyard);
       
        Assert.assertEquals("abc-value", domain.getProperty("abc"));
        Assert.assertEquals("xyz-value", domain.getProperty("xyz"));
        Assert.assertNull(domain.getProperty("nothing"));
    }
View Full Code Here

                .addLabels(BehaviorLabel.TRANSIENT.label());
        }
    }

    private void sendInternal() {
        ServiceDomain domain = ((SwitchYardCamelContext) _exchange.getContext()).getServiceDomain();
        ExchangePhase sendPhase = getPhase();

        // Publish exchange initiation event
        if (ExchangePhase.IN.equals(getPhase())) {
            getContext().setProperty(ExchangeInitiatedEvent.EXCHANGE_INITIATED_TIME, Long.toString(System.nanoTime()), Scope.EXCHANGE)
                .addLabels(BehaviorLabel.TRANSIENT.label());
            domain.getEventPublisher().publish(new ExchangeInitiatedEvent(this));
        }

        _exchange.getProperty(DISPATCHER, ExchangeDispatcher.class).dispatch(this);

        if (isDone(sendPhase)) {
         // Publish exchange completion event
            long duration = System.nanoTime() - _exchange.getProperty(ExchangeInitiatedEvent.EXCHANGE_INITIATED_TIME, 0, Long.class);
            getContext().setProperty(ExchangeCompletionEvent.EXCHANGE_DURATION, TimeUnit.NANOSECONDS.toMillis(duration))
                .addLabels(BehaviorLabel.TRANSIENT.label());
            domain.getEventPublisher().publish(new ExchangeCompletionEvent(this));
        }
    }
View Full Code Here

     * @param exchange the Exchange
     * @return the SecurityMetadata
     */
    public static final SecurityMetadata getSecurityMetadata(Exchange exchange) {
        Source source = null;
        ServiceDomain serviceDomain = null;
        ServiceSecurity serviceSecurity = null;
        Service service = exchange.getProvider();
        if (service != null) {
            source = Source.PROVIDER;
            serviceDomain = service.getDomain();
View Full Code Here

TOP

Related Classes of org.switchyard.ServiceDomain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.