Package org.apache.tuscany.sca.runtime

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


        if (conversationID != null) {
            parameters.setConversationID(conversationID);
        }

        // find the runtime wire and invoke it with the message
        RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
        return wire.invoke(op, msg);
    }
View Full Code Here


        return false;
    }

    public void start() {
        RuntimeComponentService componentService = (RuntimeComponentService)service;
        RuntimeWire wire = componentService.getRuntimeWire(binding);

        AtomBindingListenerServlet servlet =
            new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle());

        servletMapping = binding.getURI();
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

        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

        EasyMock.expect(ifaceContract.getInterface()).andReturn(iface);
        EasyMock.expect(service.getInterfaceContract()).andReturn(ifaceContract);

        // Mock up getting and invoking the RuntimeWire. It is going to call:
        // service.getRuntimeWire(jmsBinding).invoke(operation, (Object[])requestPayload);
        final RuntimeWire runtimeWire = EasyMock.createStrictMock(RuntimeWire.class);
        EasyMock.expect(service.getRuntimeWire(jmsBinding)).andReturn(runtimeWire);
        EasyMock.expect(runtimeWire.invoke(expectedOperation, new Object[] {operationParams}))
            .andReturn(operationReturnValue);

        // Create the JMS Binding Listener
        final JMSBindingListener bindingListener = new JMSBindingListener(jmsBinding, jmsResourceFactory, service);
View Full Code Here

       
        // Create a Java proxy to the target service
        Class<?> type = ((JavaInterface)rcs.getInterfaceContract().getInterface()).getJavaClass();
        Object proxy = Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, new InvocationHandler() {
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                RuntimeWire wire = rcs.getRuntimeWire(binding);
                Operation op = JavaInterfaceUtil.findOperation(method, rcs.getInterfaceContract().getInterface().getOperations());
                return wire.invoke(op, args);
            }});

        servlet.addService(binding.getName(), type, proxy);
    }
View Full Code Here

    public Invoker createInvoker(Operation operation) {
        if (isTargetRemote()) {
            return getDistributedProvider().createInvoker(operation);
        } else {
            RuntimeWire wire = reference.getRuntimeWire(binding);
            Invoker invoker = getInvoker(wire, operation);
            if (invoker == null) {
                throw new ServiceUnavailableException("Service not found for component " + component.getName()
                    + " reference "
                    + reference.getName()
View Full Code Here

   
    protected org.osgi.framework.ServiceReference getOSGiServiceReference(
            EndpointReference from, Interface callbackInterface)
            throws ObjectCreationException {
       
        RuntimeWire refWire = null;
        String filter = null;
        for (RuntimeWire wire : referenceWires.keySet()) {
            if (wire.getSource() == from) {
                refWire = wire;
                break;
View Full Code Here

            } else {
                if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
                    throw new IllegalStateException("Required reference is missing: " + ref.getName());
                }
                if (wireList != null && !wireList.isEmpty()) {
                    RuntimeWire wire = wireList.get(0);
                    referenceWires.put(wire, ref);
                    componentReferenceWires.put(wire, compRef);
                }
               
            }
View Full Code Here

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