Package org.apache.tuscany.sca.runtime

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


        }
        InterfaceContract targetContract = targetService.getInterfaceContract().makeUnidirectional(false);

        InterfaceContract sourceContract = getInterfaceContract(service, serviceBinding);

        EndpointReference wireSource = new EndpointReferenceImpl(null, null, serviceBinding, sourceContract);

        EndpointReference wireTarget =
            new EndpointReferenceImpl((RuntimeComponent)serviceComponent, (RuntimeComponentService)service,
                                      serviceBinding, targetContract);

        RuntimeWire wire =
            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
View Full Code Here


    /**
     * @param msgContext
     */
    private static EndpointReference getCallbackEndpoint(Message msgContext) {
        EndpointReference from = msgContext.getFrom();
        if (from == null) {
            return null;
        }
        return from.getReferenceParameters().getCallbackReference();
    }
View Full Code Here

        }
        return from.getReferenceParameters().getCallbackReference();
    }

    private static RuntimeWire cloneAndBind(Message msgContext, RuntimeWire wire) {
        EndpointReference callback = getCallbackEndpoint(msgContext);
        if (callback != null) {
            try {
                if (callback.getContract() == null) {
                    return (RuntimeWire)wire.clone()//FIXME: add caching
                }
                RuntimeComponentReference ref = null;
                if (callback.getContract() instanceof RuntimeComponentReference) {
                    ref = (RuntimeComponentReference)callback.getContract();
                    return ref.getRuntimeWire(callback.getBinding());
                } else {
                    ref =
                        bind((RuntimeComponentReference)wire.getSource().getContract(),
                             callback.getComponent(),
                             (RuntimeComponentService)callback.getContract());

                    return ref.getRuntimeWires().get(0);
                }
            } catch (CloneNotSupportedException e) {
                // will not happen
View Full Code Here

        }

        Object callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
        ((CallbackReferenceImpl)callableReference).attachCallbackID(callbackID);

        EndpointReference epr = msgContext.getFrom().getReferenceParameters().getCallbackReference();
        setEndpoint(epr);

        // need to set the endpoint on the binding also so that when the chains are created next
        // the sca binding can decide whether to provide local or remote invokers.
        // TODO - there is a problem here though in that I'm setting a target on a
        //        binding that may possibly be trying to point at two things in the multi threaded
        //        case. Need to confirm the general model here and how the clone and bind part
        //        is intended to work
        wire.getSource().getBinding().setURI(epr.getURI());

        // also need to set the target contract as it varies for the sca binding depending on
        // whether it is local or remote
        RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
        Binding binding = wire.getSource().getBinding();
View Full Code Here

        ConversationSequence sequence = op.getConversationSequence();
        Object payload = msg.getBody();

        Object contextId = null;

        EndpointReference from = msg.getFrom();
        ReferenceParameters parameters = null;
        if (from != null) {
            parameters = from.getReferenceParameters();
        }
        // check what sort of context is required
        if (scopeContainer != null) {
            Scope scope = scopeContainer.getScope();
            if (scope == Scope.REQUEST) {
View Full Code Here

        ConversationSequence sequence = op.getConversationSequence();
        Object payload = msg.getBody();

        Object contextId = null;

        EndpointReference from = msg.getFrom();
        ReferenceParameters parameters = null;
        if (from != null) {
            parameters = from.getReferenceParameters();
        }
        // check what sort of context is required
        if (scopeContainer != null) {
            Scope scope = scopeContainer.getScope();
            if (scope == Scope.REQUEST) {
View Full Code Here

        Implementation implementation = component.getImplementation();
        if (!(implementation instanceof JavaImplementation)) {
            return;
        }
        JavaImplementation javaImpl = (JavaImplementation)implementation;
        EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
        if (callbackEndpoint != null) {
            Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
            if (!supportsCallbackInterface(iface, javaImpl)) {
                // callback to this impl is not possible, so ensure a callback object is set
                for (InvocationChain chain : wire.getInvocationChains()) {
                    chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
                }
View Full Code Here

    protected ReferenceParameters getReferenceParameters() {
        ReferenceParameters parameters = super.getReferenceParameters();
        if (callback != null) {
            if (callback instanceof ServiceReference) {
                EndpointReference callbackRef = ((CallableReferenceImpl)callback).getEndpointReference();
                parameters.setCallbackReference(callbackRef);
            } else {
                EndpointReference callbackRef = getRuntimeWire().getSource().getCallbackEndpoint();
                parameters.setCallbackReference(callbackRef);
                parameters.setCallbackObjectID(callback);
            }
        }
        return parameters;
View Full Code Here

        }

        Interface interfaze = msg.getOperation().getInterface();
        if (callbackObject != null) {
            if (callbackObject instanceof ServiceReference) {
                EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                parameters.setCallbackReference(callbackRef);
            } else {
                if (interfaze != null) {
                    if (!interfaze.isConversational()) {
                        throw new IllegalArgumentException(
View Full Code Here

    }

    public static RuntimeComponent getCurrentComponent() {
        Message message = ThreadMessageContext.getMessageContext();
        if (message != null) {
            EndpointReference to = message.getTo();
            if (to == null) {
                return null;
            }
            RuntimeComponent component = message.getTo().getComponent();
            return component;
View Full Code Here

TOP

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

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.