Package org.apache.tuscany.sca.runtime

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


                RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
                if (callbackReference != null) {
                    List<EndpointReference> wires = callbackReference.getEndpointReferences();
                    if (!wires.isEmpty()) {
                        RuntimeEndpointReference epr = (RuntimeEndpointReference) wires.get(0);
                        callbackWires.put(epr.getComponentTypeReferenceInterfaceContract().getInterface().toString(),
                                          wires);
                    }
                }
            }
View Full Code Here


    public void process(RuntimeEndpointReference endpointReference) {
        if(!(endpointReference instanceof RuntimeEndpointReference)) {
            return;
        }
        RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference;
        Contract contract = epr.getReference();
        if (!(contract instanceof RuntimeComponentReference)) {
            return;
        }
        RuntimeComponent component = (RuntimeComponent) epr.getComponent();
        if (component == null) {
            return;
        }
        Implementation implementation = component.getImplementation();
        if (!(implementation instanceof JavaImplementation)) {
            return;
        }
        JavaImplementation javaImpl = (JavaImplementation)implementation;
        Endpoint callbackEndpoint = epr.getCallbackEndpoint();
        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getService().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : epr.getInvocationChains()) {
                    chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
            }
        }
    }
View Full Code Here

            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName());
            }

            for (EndpointReference endpointReference : reference.getEndpointReferences()) {
                RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference;
                stop(epr);
            }
        }
        Implementation implementation = component.getImplementation();
        if (implementation instanceof Composite) {
View Full Code Here

        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
        }
       
        for (EndpointReference endpointReference : reference.getEndpointReferences()){
            RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference;

            // If the reference is already resolved then start it now. This currently
            // important for async references which have native async bindings as the
            // reference provider has to register a response listener regardless of
            // whether the reference has been used or not.
            if (epr.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED ||
                epr.getStatus() == EndpointReference.Status.RESOLVED_BINDING){
               
                // As we only care about starting references at build time in the
                // async case at the moment check that the binding supports native async
                // and that the reference is an async reference
                ReferenceBindingProvider bindingProvider = epr.getBindingProvider();
                if (bindingProvider instanceof EndpointReferenceAsyncProvider &&
                    ((EndpointReferenceAsyncProvider)bindingProvider).supportsNativeAsync() &&
                    epr.isAsyncInvocation()){
                    // it's resolved so start it now
                    start(compositeContext, epr);
                }
            }
        }
View Full Code Here

        if (logger.isLoggable(Level.FINE)) {
            logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName());
        }
        RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
        for ( EndpointReference endpointReference : runtimeRef.getEndpointReferences()){
            RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference;
            stop(epr);
        }
    }
View Full Code Here

            JMSBindingContext context = tuscanyMsg.getBindingContext();
            javax.jms.Message jmsMsg = tuscanyMsg.getBody();
           
            Operation operation = tuscanyMsg.getOperation();
            String operationName = operation.getName();
            RuntimeEndpointReference reference = runtimeWire;
           
            // OASIS spec suggests we do not need to do anything with
            // @nativeOperation here on the reference side.
            requestMessageProcessor.setOperationName(operationName, jmsMsg);
View Full Code Here

            logger.warning("Mapped binding for binding.sca is not supported: " + bindingType);
            return null;
        }
       
        // create a copy of the endpoint  but with the web service binding in
        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

            msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation));
        } // 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

        @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

        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

Related Classes of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

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.