Package org.apache.tuscany.sca.invocation

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


        // that it's an implementation.resource
        RuntimeComponentService componentService = (RuntimeComponentService) service;
        RuntimeWire wire = componentService.getRuntimeWire(binding);
       
        // Get the getLocationURL invoker
        Invoker getLocationInvoker = null;
        for (InvocationChain invocationChain : wire.getInvocationChains()) {
            String operationName = invocationChain.getSourceOperation().getName();
            if (operationName.equals("getLocationURL")) {
                getLocationInvoker = invocationChain.getHeadInvoker();
            }
        }
        if (getLocationInvoker == null) {
            throw new IllegalStateException("No getLocationURL operation found on target component");
        }

        // Get the location URL
        Message message = messageFactory.createMessage();
        message = getLocationInvoker.invoke(message);
        URL locationURL = message.getBody();
       
        // If resource is a file, register the parent dir
        try {
            if( locationURL.getProtocol().equals("file")) {
View Full Code Here


       
        Interface serviceInterface = operation.getInterface();
        boolean isRemotable = serviceInterface.isRemotable();


        Invoker invoker = new OSGiTargetInvoker(operation, this, service);
        if (isRemotable) {
            return new OSGiRemotableInvoker(osgiAnnotations, dataBindingRegistry, operation, this, service);
        } else {
            return invoker;
        }
View Full Code Here

            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();
            String operationName = operation.getName();

            if (binding.getOperationSelector() != null || binding.getRequestWireFormat() != null) {
                bindingListenerServlet.setInvoker(serviceInvoker);
                servlet = bindingListenerServlet;
View Full Code Here

        bindingListenerServlet = new HTTPBindingListenerServlet(binding, messageFactory );
        for (InvocationChain invocationChain : endpoint.getInvocationChains()) {
            Operation operation = invocationChain.getTargetOperation();
            String operationName = operation.getName();
            if (operationName.equals("get")) {
                Invoker getInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setGetInvoker(getInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("conditionalGet")) {
                Invoker conditionalGetInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setConditionalGetInvoker(conditionalGetInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("delete")) {
                Invoker deleteInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setDeleteInvoker(deleteInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("conditionalDelete")) {
                Invoker conditionalDeleteInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setConditionalDeleteInvoker(conditionalDeleteInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("put")) {
                Invoker putInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setPutInvoker(putInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("conditionalPut")) {
                Invoker conditionalPutInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setConditionalPutInvoker(conditionalPutInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("post")) {
                Invoker postInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setPostInvoker(postInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("conditionalPost")) {
                Invoker conditionalPostInvoker = invocationChain.getHeadInvoker();
                bindingListenerServlet.setConditionalPostInvoker(conditionalPostInvoker);
                servlet = bindingListenerServlet;
            } else if (operationName.equals("service")) {
                Invoker serviceInvoker = invocationChain.getHeadInvoker();
//                servlet = new HTTPServiceListenerServlet(binding, serviceInvoker, messageFactory);
                break;
            }
        }
        if (servlet == null) {
View Full Code Here

        if (target != null) {
            msg.setTo(target);
        } else {
            msg.setTo(wire.getTarget());
        }
        Invoker headInvoker = chain.getHeadInvoker();
        Operation operation = chain.getTargetOperation();
        msg.setOperation(operation);
        msg.setBody(args);

        Message msgContext = ThreadMessageContext.getMessageContext();
        Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();

        conversationPreinvoke(msg, wire);
        handleCallback(msg, wire, currentConversationID);
        ThreadMessageContext.setMessageContext(msg);
        try {
            // dispatch the wire down the chain and get the response
            Message resp = headInvoker.invoke(msg);
            Object body = resp.getBody();
            if (resp.isFault()) {
                throw (Throwable)body;
            }
            return body;
View Full Code Here

                                       InvocationChain chain,
                                       Operation operation) {
        try {
            ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
            if (provider != null) {
                Invoker invoker = provider.createInvoker(operation);
                if (invoker != null) {
                    chain.addInvoker(invoker);
                }
            }
        } catch (RuntimeException e) {
View Full Code Here

                                              ComponentService service,
                                              InvocationChain chain,
                                              Operation operation) {
        ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
        if (provider != null) {
            Invoker invoker = null;
            invoker = provider.createInvoker((RuntimeComponentService)service, operation);
            chain.addInvoker(invoker);
        }
    }
View Full Code Here

    public void addInterceptor(Interceptor interceptor) {
        invokers.add(interceptor);
        int index = invokers.size() - 1;
        if (index - 1 >= 0) {
            Invoker before = invokers.get(index - 1);
            if (before instanceof Interceptor) {
                ((Interceptor)before).setNext(interceptor);
            }
        }
    }
View Full Code Here

    public void addInvoker(Invoker invoker) {
        invokers.add(invoker);
        int index = invokers.size() - 1;
        if (index - 1 >= 0) {
            Invoker before = invokers.get(index - 1);
            if (before instanceof Interceptor) {
                ((Interceptor)before).setNext(invoker);
            }
        }
    }
View Full Code Here

    }

    public void addInterceptor(int index, Interceptor interceptor) {
        invokers.add(index, interceptor);
        if (index - 1 >= 0) {
            Invoker before = invokers.get(index - 1);
            if (before instanceof Interceptor) {
                ((Interceptor)before).setNext(interceptor);
            }
        }
        if (index + 1 < invokers.size()) {
            Invoker after = invokers.get(index + 1);
            interceptor.setNext(after);
        }
    }
View Full Code Here

TOP

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

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.