Examples of InvocationChain


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);
        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());
        assertEquals(inter4, chain.getTailInvoker());
    }
View Full Code Here

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

            }
        }

        setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());

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

        try {
View Full Code Here

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

    public Invoker getInvoker(Binding binding, Operation operation) {
        return getInvoker(binding, null, operation);
    }

    public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
        InvocationChain chain = getInvocationChain(binding, interfaceContract, operation);
        if (chain != null) {
            return chain.getHeadInvoker();
        } else {
            return null;
        }
    }
View Full Code Here

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

                        + " is found in reference "
                        + wireSource.getComponent().getURI()
                        + "#"
                        + reference.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(reference, refBinding, chain);
                }
                addReferenceBindingInterceptor(reference, refBinding, chain, operation);
                chains.add(chain);
            }
           
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
            RuntimeComponent serviceComponent = wireTarget.getComponent();
            Binding serviceBinding = wireTarget.getBinding();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in service "
                        + serviceComponent.getURI()
                        + "#"
                        + service.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(service, serviceBinding, chain);
                }
                addServiceBindingInterceptor(service, serviceBinding, chain, operation);
                addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
View Full Code Here

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

    public Invoker getInvoker(Binding binding, Operation operation) {
        RuntimeWire wire = getRuntimeWire(binding);
        if (wire == null) {
            return null;
        }
        InvocationChain chain = wire.getInvocationChain(operation);
        return chain == null ? null : chain.getHeadInvoker();
    }
View Full Code Here

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

        return invoke(wire, operation, msg);
    }

    public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
        RuntimeWire runtimeWire = wire == null ? this.wire : wire;
        InvocationChain chain = runtimeWire.getInvocationChain(operation);
        return invoke(chain, msg, runtimeWire);
    }
View Full Code Here

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

    public Invoker getInvoker(Binding binding, Operation operation) {
        return getInvoker(binding, null, operation);
    }

    public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
        InvocationChain chain = getInvocationChain(binding, interfaceContract, operation);
        if (chain != null) {
            return chain.getHeadInvoker();
        } else {
            return null;
        }
    }
View Full Code Here

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

                        + " is found in reference "
                        + endpointReference.getComponent().getURI()
                        + "#"
                        + reference.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(reference, refBinding, chain);
                }
                addReferenceBindingInterceptor(reference, refBinding, chain, operation);
                chains.add(chain);
            }
           
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
            RuntimeComponent serviceComponent = (RuntimeComponent)endpoint.getComponent();
            Binding serviceBinding = endpoint.getBinding();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in service "
                        + serviceComponent.getURI()
                        + "#"
                        + service.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(service, serviceBinding, chain);
                }
                addServiceBindingInterceptor(service, serviceBinding, chain, operation);
                addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
View Full Code Here

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

            }
        }

        setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());

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

        try {
View Full Code Here

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

        return invoke(wire, operation, msg);
    }

    public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
        RuntimeWire runtimeWire = wire == null ? this.wire : wire;
        InvocationChain chain = runtimeWire.getInvocationChain(operation);
        return invoke(chain, msg, runtimeWire);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.