Package org.apache.tuscany.sca.invocation

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


   

    @Override
    public Invoker createInvoker(Operation operation) {
        Invoker result = null;
        BindingSCATransformer bindingTransformer = null;
           
        Endpoint target = endpointReference.getTargetEndpoint();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService) target.getService();
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

   
    public void invokeAsyncResponse(Message msg){
      // If there is a Binding Chain, invoke it first...
        InvocationChain chain = this.getBindingInvocationChain();
        if( chain != null ) {
          Invoker tailInvoker = chain.getTailInvoker();
          if (tailInvoker != null) {
            ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg);
      } // end if
        } // end if
       
        chain = this.getInvocationChain(msg.getOperation());
        Invoker tailInvoker = chain.getTailInvoker();
        ((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg);  
    } // end method invokeAsyncResponse    
View Full Code Here

     * @param operation
     */
    private void addReferenceBindingInterceptor(InvocationChain chain, Operation operation) {
        ReferenceBindingProvider provider = getBindingProvider();
        if (provider != null) {
            Invoker invoker = provider.createInvoker(operation);
            if (invoker != null) {
                chain.addInvoker(invoker);
            }
        }
        List<PolicyProvider> pps = getPolicyProviders();
View Full Code Here

    /**
     * Gets the async response invoker for an asynchronous invocation.
     */
    public InvokerAsyncResponse getAsyncResponseInvoker(Operation op) {
        InvocationChain chain = getInvocationChain(op);
        Invoker headInvoker = chain.getHeadInvoker();
        if( headInvoker instanceof InterceptorAsync ) {
            InvokerAsyncResponse responseInvoker = ((InterceptorAsync)headInvoker).getPrevious();
          return responseInvoker;
        }
        return null;
View Full Code Here

        } else {
            if (source instanceof RuntimeEndpointReference) {
                msg.setTo(((RuntimeEndpointReference)source).getTargetEndpoint());
            }
        }
        Invoker headInvoker = chain.getHeadInvoker();
        Operation operation = null;
        if(source instanceof RuntimeEndpoint) {
            // [rfeng] We cannot use the targetOperation from the binding invocation chain.
            // For each method, we need to find the matching operation so that we can set the operation on to the message
            for (InvocationChain c : source.getInvocationChains()) {
                Operation op = c.getTargetOperation();
                if (method.getName().equals(op.getName())) {
                    operation = op;
                    break;
                }
            }
        } else {
            operation = chain.getTargetOperation();
        }
        msg.setOperation(operation);
        msg.setBody(args);

        Message msgContext = ThreadMessageContext.getMessageContext();
       
        // Deal with header information that needs to be copied from the message context to the new message...
        transferMessageHeaders( msg, msgContext);
       
        ThreadMessageContext.setMessageContext(msg);
       
        // If there is a supplied message ID, place its value into the Message Header under "MESSAGE_ID"
        if( msgID != null ){
          msg.getHeaders().put("MESSAGE_ID", msgID);
        } // end if

        try {
            // dispatch the source 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

        addHeadInterceptor(phase, interceptor);
  } // end method addHeadInterceptor

  public void addHeadInterceptor(String phase, Interceptor interceptor) {
    // TODO Auto-generated method stub
    Invoker invoker = (Invoker)interceptor;
   
        int index = phaseManager.getAllPhases().indexOf(phase);
        if (index == -1) {
            throw new IllegalArgumentException("Invalid phase name: " + phase);
        } // end if
View Full Code Here

        } // end if
       
        if( isAsyncInvocation((RuntimeEndpointReference)source ) ) {
          isAsyncService = true;
          // Get hold of the JavaAsyncResponseHandler from the chain dealing with the async response
          Invoker theInvoker = chain.getHeadInvoker();
          if( theInvoker instanceof InterceptorAsync ) {
            InvokerAsyncResponse responseInvoker = ((InterceptorAsync)theInvoker).getPrevious();
            if( responseInvoker instanceof JDKAsyncResponseInvoker ) {
              // Register the future as the response object with its ID
              ((JDKAsyncResponseInvoker)responseInvoker).registerAsyncResponse(future.getUniqueID(), future);
View Full Code Here

            }
        }
       
        msg.getHeaders().put(Constants.CALLBACK, ((CallbackServiceReferenceImpl)callableReference).getCallbackHandler());
       
        Invoker headInvoker = chain.getHeadInvoker();
       
        Operation operation = null;
        if(source instanceof RuntimeEndpoint) {
            for (InvocationChain c : source.getInvocationChains()) {
                Operation op = c.getTargetOperation();
                if (method.getName().equals(op.getName())) {
                    operation = op;
                    break;
                }
            }
        } else {
            operation = chain.getTargetOperation();
        }
        msg.setOperation(operation);
        msg.setBody(args);

        Message msgContext = ThreadMessageContext.getMessageContext();
       
        // Deal with header information that needs to be copied from the message context to the new message...
        transferMessageHeaders( msg, msgContext);
       
        ThreadMessageContext.setMessageContext(msg);
       
        // If there is a supplied message ID, place its value into the Message Header under "RELATES_TO"
        if( msgID != null ){
          msg.getHeaders().put(Constants.RELATES_TO, msgID);
        } // end if

        try {
            // dispatch the source 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

        }
        return null;
    }

    public Invoker createInvoker(Operation operation) {
        Invoker invoker = getInvoker(endpointReference, operation);
        if (invoker == null) {
            throw new ServiceUnavailableException(
                                                  "Unable to create SCA binding invoker for local target " + component
                                                      .getName()
                                                      + " reference "
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.