Package org.apache.tuscany.sca.runtime

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


        Reference ctref = endpoint.getSourceComponentReference().getReference();
        if (ctref != null && ctref.getInterfaceContract() == null) {
            ctref.setInterfaceContract(reference.getInterfaceContract());
        }
       
        RuntimeWire wire = new EndpointWireImpl(endpoint, this);
       
        RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
        runtimeRef.getRuntimeWires().add(wire);
    }
View Full Code Here


        // nested composite.
        if (serviceBinding != null) {
            wireTarget.setURI(serviceBinding.getURI());
        }

        RuntimeWire wire =
            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
                                messageFactory, conversationManager);
        runtimeRef.getRuntimeWires().add(wire);

        return wire;
View Full Code Here

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

        RuntimeWire wire =
            new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
                                messageFactory, conversationManager);
        runtimeService.getRuntimeWires().add(wire);

        return wire;
View Full Code Here

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

    private RuntimeWire cloneAndBind(RuntimeWire wire) {
        RuntimeWire boundWire = null;
        if (resolvedEndpoint != null) {
            boundWire = ((RuntimeWireImpl)wire).lookupCache(resolvedEndpoint);
            if (boundWire != null) {
                return boundWire;
            }
View Full Code Here

        this.businessInterface = (Class<B>) ji.getJavaClass();
       
        // We need to re-create the callback wire. We need to do this on a clone of the Service
        // wire since we need to change some details on it.
        // FIXME: Is this the best way to do this?
        final RuntimeWire cbWire = ((RuntimeComponentService) targetService).getRuntimeWires().get(0);
        try {
            this.wire = (RuntimeWireImpl) cbWire.clone();
        } catch (CloneNotSupportedException e) {
            throw new IOException(e.toString());
        }

        // Setup the reference on the cloned wire
View Full Code Here

        if (Object.class == method.getDeclaringClass()) {
            return invokeObjectMethod(method, args);
        }

        // obtain a dedicated wire to be used for this callback invocation
        RuntimeWire wire = ((CallbackReferenceImpl)callableReference).getCallbackWire();
        if (wire == null) {
            //FIXME: need better exception
            throw new ServiceRuntimeException("No callback wire found");
        }

        // set the conversational state based on the interface that
        // is specified for the reference that this wire belongs to
        initConversational(wire);

        // set the conversation id into the conversation object. This is
        // a special case for callbacks as, unless otherwise set manually,
        // the callback should use the same conversation id as was received
        // on the incoming call to this component
        if (conversational) {

            if (conversation == null || conversation.getState() == ConversationState.ENDED) {
                conversation = null;
            }
            Object convID = conversation == null ? null : conversation.getConversationID();

            // create a conversation id if one doesn't exist
            // already, i.e. the conversation is just starting
            if (convID == null) {
                convID = ((CallbackReferenceImpl)callableReference).getConvID();
                if (convID != null) {
                    conversation = ((RuntimeWireImpl)wire).getConversationManager().getConversation(convID);
                    if (callableReference != null) {
                        ((CallableReferenceImpl)callableReference).attachConversation(conversation);
                    }
                }
            }
        }

        setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());

        InvocationChain chain = getInvocationChain(method, wire);
        if (chain == null) {
            throw new IllegalArgumentException("No matching operation is found: " + method);
        }

        try {
            return invoke(chain, args, wire, wire.getSource());
        } catch (InvocationTargetException e) {
            Throwable t = e.getCause();
            if (t instanceof NoRegisteredCallbackException) {
                throw t;
            }
View Full Code Here

        if (basicAuthenticationPolicy != null) {
            Axis2BindingBasicAuthenticationConfigurator.parseHTTPHeader(inMC, msg, basicAuthenticationPolicy);
        }
       
        // find the runtime wire and invoke it with the message
        RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
        Object response =  wire.invoke(op, msg);
       
        for ( PolicyHandler policyHandler : policyHandlerList ) {
            policyHandler.afterInvoke(response, inMC);
        }       
       
View Full Code Here

        }
        return null;
    }

    public RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract) {
        RuntimeWire wire = getRuntimeWire(binding);
        if (wire == null) {
            return null;
        }
        if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
            try {
                // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
                wire = (RuntimeWire)wire.clone();
                wire.getSource().setInterfaceContract(interfaceContract);
                wire.rebuild();
            } catch (CloneNotSupportedException e) {
                throw new ServiceRuntimeException(e);
            }
        }
View Full Code Here

            return null;
        }
    }

    public InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation) {
        RuntimeWire wire = getRuntimeWire(binding);
        if (wire == null) {
            return null;
        }
        if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
            try {
                // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
                wire = (RuntimeWire)wire.clone();
                wire.getSource().setInterfaceContract(interfaceContract);
                wire.rebuild();
            } catch (CloneNotSupportedException e) {
                throw new ServiceRuntimeException(e);
            }
        }
        return wire.getInvocationChain(operation);
    }
View Full Code Here

    public void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver){
        endpointResolvers.put(endpoint, endpointResolver);
    }

    public Invoker getInvoker(Binding binding, Operation operation) {
        RuntimeWire wire = getRuntimeWire(binding);
        if (wire == null) {
            return null;
        }
        InvocationChain chain = wire.getInvocationChain(operation);
        return chain == null ? null : chain.getHeadInvoker();
    }
View Full Code Here

TOP

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

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.