Package org.apache.tuscany.sca.invocation

Examples of org.apache.tuscany.sca.invocation.InvocationChain


    }

    @Test
    public void testAddByPhase() throws Exception {
        Operation op = newOperation("foo");
        InvocationChain chain = new InvocationChainImpl(op, op, false, new PhaseManager(new DefaultExtensionPointRegistry()));
        Interceptor inter1 = new MockInterceptor();
        Interceptor inter2 = new MockInterceptor();
        Interceptor inter3 = new MockInterceptor();
        Interceptor inter4 = new MockInterceptor();
        chain.addInterceptor(inter3); // SERVICE
        chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
        chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
        chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
        Interceptor head = (Interceptor)chain.getHeadInvoker();
        assertEquals(inter1, head);
        assertEquals(inter2, inter1.getNext());
        assertEquals(inter3, inter2.getNext());
        assertEquals(inter4, inter3.getNext());
    }
View Full Code Here


    private Invoker getInvoker(RuntimeEndpointReference epr, Operation operation) {
        Endpoint target = epr.getTargetEndpoint();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService)target.getService();
            if (service != null) { // not a callback wire
                InvocationChain chain = ((RuntimeEndpoint)target).getInvocationChain(operation);

                boolean passByValue = false;
                Operation targetOp = chain.getTargetOperation();
                if (!operation.getInterface().isRemotable()) {
                    if (interfaceContractMapper.isCompatibleByReference(operation, targetOp, Compatibility.SUBSET)) {
                        passByValue = false;
                    }
                } else {
View Full Code Here

        }

    }

    public void start() {
        InvocationChain bindingChain = endpoint.getBindingInvocationChain();

        application = registerWithJAXRS();
        if (application != null) {
            return;
        }

        // Get the invokers for the supported operations
        Servlet servlet = null;
        Invoker bindingInvoker = bindingChain.getHeadInvoker();
        bindingListenerServlet = new RESTBindingListenerServlet(binding, bindingInvoker, messageFactory);
        for (InvocationChain invocationChain : endpoint.getInvocationChains()) {

            Operation operation = invocationChain.getTargetOperation();
            Invoker serviceInvoker = invocationChain.getHeadInvoker();
View Full Code Here

    /**
     * Add specific rest interceptor to invocation chain
     */
    public void configure() {

        InvocationChain bindingChain = endpoint.getBindingInvocationChain();

        if (wfProvider != null) {
            Interceptor interceptor = wfProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
            }
        }

        if (wfResponseProvider != null) {
            Interceptor interceptor = wfResponseProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, interceptor);
            }

        }

        if (osProvider != null) {
            Interceptor interceptor = osProvider.createInterceptor();
            if (interceptor != null) {
                bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, interceptor);
            }
        }

    }
View Full Code Here

            throw new ServiceRuntimeException("No callback wire found");
        }

        setEndpoint(((CallbackServiceReferenceImpl)callableReference).getResolvedEndpoint());

        InvocationChain chain = getInvocationChain(method, wire);
        if (chain == null) {
            throw new IllegalArgumentException("No matching operation is found: " + method);
        }

        try {
View Full Code Here

    /*
     * set up the reference binding wire with the right set of ws reference
     * interceptors
     */
    public void configure() {
        InvocationChain bindingChain = endpointReference.getBindingInvocationChain();
        
        // add transport interceptor
        bindingChain.addInterceptor(Phase.REFERENCE_BINDING_TRANSPORT,
                                    new TransportReferenceInterceptor());
       
    }
View Full Code Here

     * A dummy invocation chain representing null as ConcurrentHashMap doesn't allow null values
     */
    private static final InvocationChain NULL_CHAIN = new InvocationChainImpl(null, null, false, null);

    public InvocationChain getInvocationChain(Operation operation) {
        InvocationChain cached = invocationChainMap.get(operation);
        if (cached == null) {
            for (InvocationChain chain : getInvocationChains()) {
                Operation op = chain.getTargetOperation();

                // We used to check compatibility here but this is now validated when the
View Full Code Here

                    + " is found in service "
                    + serviceComponent.getURI()
                    + "#"
                    + service.getName());
            }
            InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false, phaseManager);
            if (operation.isNonBlocking()) {
                addNonBlockingInterceptor(chain);
            }
            addServiceBindingInterceptor(chain, operation);
            addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
View Full Code Here

                epr.rebuild();
                chains.clear();
            }
        }
       
        InvocationChain chain = getInvocationChain(method, source);
       
        if (chain == null) {
            throw new IllegalArgumentException("No matching operation is found: " + method);
        }       
View Full Code Here

     * set up the reference binding wire with the right set of jms reference
     * interceptors
     */
    public void configure() {
       
        InvocationChain bindingChain = endpointReference.getBindingInvocationChain();
       
        // add transport interceptor
        bindingChain.addInterceptor(Phase.REFERENCE_BINDING_TRANSPORT,
                                    new TransportReferenceInterceptor(jmsBinding,
                                                                      jmsResourceFactory,
                                                                      endpointReference) );
       
        // add request wire format
        bindingChain.addInterceptor(requestWireFormatProvider.getPhase(),
                                    requestWireFormatProvider.createInterceptor());
       
        // add response wire format, but only add it if it's different from the request
        if (!jmsBinding.getRequestWireFormat().equals(jmsBinding.getResponseWireFormat())){
            bindingChain.addInterceptor(responseWireFormatProvider.getPhase(),
                                        responseWireFormatProvider.createInterceptor());
        }
       
        // add the header processor that comes after the wire formatter but before the
        // policy interceptors
        bindingChain.addInterceptor(Phase.REFERENCE_BINDING_WIREFORMAT,
                                    new HeaderReferenceInterceptor(extensions,
                                                                   jmsBinding,
                                                                   jmsResourceFactory,
                                                                   endpointReference) );
    }   
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.invocation.InvocationChain

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.