Examples of RuntimeEndpointReference


Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

        if (source == null) {
            throw new ServiceRuntimeException("No runtime source is available");
        }

        if (source instanceof RuntimeEndpointReference) {
            RuntimeEndpointReference epr = (RuntimeEndpointReference)source;
            if (epr.isOutOfDate()) {
                epr.rebuild();
                chains.clear();
            }
        } // end if

        InvocationChain chain = getInvocationChain(method, source);
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

     * @return - the RuntimeEndpoint of the async callback
     */
    private RuntimeEndpoint getAsyncCallback(Invocable source) {
        if (!(source instanceof RuntimeEndpointReference))
            return null;
        RuntimeEndpointReference epr = (RuntimeEndpointReference)source;
        if (!isAsyncInvocation(epr))
            return null;
        RuntimeEndpoint endpoint;
        synchronized (epr) {
            endpoint = (RuntimeEndpoint)epr.getCallbackEndpoint();
            // If the async callback endpoint is already created, return it...
            if (endpoint != null)
                return endpoint;
            // Create the endpoint for the async callback
            endpoint = createAsyncCallbackEndpoint(epr);
            epr.setCallbackEndpoint(endpoint);
        } // end synchronized

        // Activate the new callback endpoint
        startEndpoint(epr.getCompositeContext(), endpoint);
        endpoint.getInvocationChains();

        return endpoint;
    } // end method setupAsyncCallback
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

     * @return - true if the invocation is async
     */
    private boolean isAsyncInvocation(Invocable source) {
        if (!(source instanceof RuntimeEndpointReference))
            return false;
        RuntimeEndpointReference epr = (RuntimeEndpointReference)source;
        // First check is to see if the EPR itself has the asyncInvocation intent marked
        for (Intent intent : epr.getRequiredIntents()) {
            if (intent.getName().equals(ASYNC_INVOKE))
                return true;
        } // end for

        // Second check is to see if the target service has the asyncInvocation intent marked
        Endpoint ep = epr.getTargetEndpoint();
        for (Intent intent : ep.getRequiredIntents()) {
            if (intent.getName().equals(ASYNC_INVOKE))
                return true;
        } // end for
        return false;
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

            msg.setBody(transformedBody);
        } // end if

        ep.getInvocationChains();
        if ( !ep.getCallbackEndpointReferences().isEmpty() ) {
            RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) ep.getCallbackEndpointReferences().get(0);
            // Place a link to the callback EPR into the message headers...
            msg.getHeaders().put("ASYNC_CALLBACK", asyncEPR );
        } // end if

        if( ep.isAsyncInvocation() ) {
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

        @SuppressWarnings("unchecked")
        AsyncResponseInvoker<RuntimeEndpointReference> respInvoker =
            (AsyncResponseInvoker<RuntimeEndpointReference>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
        // TODO - this deals with the Local case only - not distributed
        if( respInvoker != null && "SCA_LOCAL".equals(respInvoker.getBindingType()) ) {
            RuntimeEndpointReference responseEPR = respInvoker.getResponseTargetAddress();
            msg.setFrom(responseEPR);
            String msgID = respInvoker.getRelatesToMsgID();
            msg.getHeaders().put("RELATES_TO", msgID);
        } // end if
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

        @SuppressWarnings("unchecked")
    AsyncResponseInvoker<?> respInvoker =
          (AsyncResponseInvoker<?>)msg.getHeaders().get("ASYNC_RESPONSE_INVOKER");
        if( respInvoker != null && "SCA_LOCAL".equals(respInvoker.getBindingType()) ) {
          // Handle the locally optimised case
          RuntimeEndpointReference responseEPR = (RuntimeEndpointReference)respInvoker.getResponseTargetAddress();
          msg.setFrom(responseEPR);
          // Handle async response Relates_To message ID value
          String msgID = respInvoker.getRelatesToMsgID();
          msg.getHeaders().put("RELATES_TO", msgID);
         
          // Call the processing on the reference chain directly
          responseEPR.invokeAsyncResponse(msg);
         
          // Prevent the response being processed by the rest of the service chain
          return;
        } else {
          // Carry on processing the response by the rest of the service chain
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

            return null;
        }

        // create a copy of the endpoint reference ready to set the remote binding. The original
        // endpoint reference reatins binding.sca
        RuntimeEndpointReference epr = null;
        try {
            epr = (RuntimeEndpointReference)endpointReference.clone();
        } catch (Exception ex) {
            // we know we can clone endpoint references
        }

        Binding binding = map(endpointReference.getBinding(), bindingType);
        epr.setBinding(binding);

        // epr.setTargetEndpoint(map((RuntimeEndpoint)epr.getTargetEndpoint()));

        BindingBuilder builder = getBindingBuilder(bindingType);
        if (builder != null) {
            builder.build(epr.getComponent(), epr.getReference(), binding, new BuilderContext(registry), false);
        }

        return epr;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

     */
    private void setupAsyncResponse(Message msg, String callbackAddress) {
      if( !endpoint.isAsyncInvocation() ) return;

      endpoint.createAsyncServerCallback();
      RuntimeEndpointReference asyncCallback = endpoint.getAsyncServerCallback();
     
      // Create a response invoker, containing the callback address and add it to the message headers
        AsyncResponseInvoker<String> respInvoker =
          new AsyncResponseInvoker<String>(endpoint, asyncCallback,
              callbackAddress,
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

            for (InvocationChain chain : chains) {
                configure(chain, chain.getTargetOperation());
            }

        } else if (subject instanceof RuntimeEndpointReference) {
            RuntimeEndpointReference endpointReference = (RuntimeEndpointReference)subject;
            List<InvocationChain> chains = endpointReference.getInvocationChains();
            for (InvocationChain chain : chains) {
                configure(chain, chain.getSourceOperation());
            }
        } else if (subject instanceof RuntimeComponent) {
            RuntimeComponent component = (RuntimeComponent)subject;
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

        if (source == null) {
            throw new ServiceRuntimeException("No runtime source is available");
        }
       
        if (source instanceof RuntimeEndpointReference) {
            RuntimeEndpointReference epr = (RuntimeEndpointReference)source;
            if (epr.isOutOfDate()) {
                epr.rebuild();
                chains.clear();
            }
        }
       
        InvocationChain chain = getInvocationChain(method, source);
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.