Package org.apache.tuscany.sca.runtime

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


     */
    private void removeServiceWires(ComponentService service) {
        if (!(service instanceof RuntimeComponentService)) {
            return;
        }
        RuntimeComponentService runtimeService = (RuntimeComponentService)service;
        runtimeService.getRuntimeWires().clear();
    }
View Full Code Here


     */
    private RuntimeWire addServiceWire(Component serviceComponent, ComponentService service, Binding serviceBinding) {
        if (!(service instanceof RuntimeComponentService)) {
            return null;
        }
        RuntimeComponentService runtimeService = (RuntimeComponentService)service;

        // FIXME: [rfeng] We might need a better way to get the impl interface contract
        Service targetService = service.getService();
        if (targetService == null) {
            targetService = service;
        }
        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,
                                messageFactory, conversationManager);
        runtimeService.getRuntimeWires().add(wire);

        return wire;
    }
View Full Code Here

    public boolean supportsOneWayInvocation() {
        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

        final Object operationReturnValue = "Operation Success";

        // Mock up the Service. Basically, it is going to call:
        // List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
        final InterfaceContract ifaceContract = EasyMock.createStrictMock(InterfaceContract.class);
        final RuntimeComponentService service = EasyMock.createStrictMock(RuntimeComponentService.class);
        final Interface iface = EasyMock.createStrictMock(Interface.class);
        EasyMock.expect(iface.getOperations()).andReturn(operations);
        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

    public void start() {
        if (started) {
            return;
        }
       
        RuntimeComponentService componentService = (RuntimeComponentService) service;
        wire = componentService.getRuntimeWire(notificationBinding);
       
        for (InvocationChain ch : wire.getInvocationChains()) {
            ch.setAllowsPassByReference(true);
        }
       
View Full Code Here

//            jmsBinding.setJmsResourceFactoryName(MockJMSResourceFactoryQueueNotExist.class.getName());
//        }
        jmsBinding.setDestinationName(destinationName);
        jmsBinding.setName(jmsBindingName);

        RuntimeComponentService service = new RuntimeComponentServiceImpl();
        service.setName(serviceName);

        // Try and create the JMS Binding Service for the JMS Binding
        try {
            JMSBindingServiceBindingProvider jmsService =
                new JMSBindingServiceBindingProvider(null, service, jmsBinding, null);
View Full Code Here

     * @param wire
     */
    private Invoker getInvoker(RuntimeWire wire, Operation operation) {
        EndpointReference target = wire.getTarget();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService)target.getContract();
            if (service != null) { // not a callback wire
                SCABinding scaBinding = service.getBinding(SCABinding.class);
                InvocationChain chain =
                    service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
                return chain == null ? null : new SCABindingInvoker(chain);
            }
        }
        return null;
    }
View Full Code Here

                configure(chain, chain.getSourceOperation());
            }
        } else if (subject instanceof RuntimeComponent) {
            RuntimeComponent component = (RuntimeComponent)subject;
            for (ComponentService s : component.getServices()) {
                RuntimeComponentService service = (RuntimeComponentService)s;
                for (Endpoint ep : service.getEndpoints()) {
                    List<InvocationChain> chains = ((RuntimeEndpoint)ep).getInvocationChains();
                    for (InvocationChain chain : chains) {
                        configure(chain, chain.getTargetOperation());
                    }
                }
View Full Code Here

        Invoker result = null;
        BindingSCATransformer bindingTransformer = null;
           
        Endpoint target = endpointReference.getTargetEndpoint();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService) target.getService();
            if (service != null) { // not a callback wire
                               
                InvocationChain chain = ((RuntimeEndpoint) target).getInvocationChain(operation);

                boolean passByValue = false;
View Full Code Here

            // spun up a new thread inside their component implementation
            return null;
        }
       
        Endpoint to = msgContext.getTo();
        RuntimeComponentService service = (RuntimeComponentService) to.getService();
        RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
        if (callbackReference == null) {
            return null;
        }
        JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
        Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
View Full Code Here

TOP

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

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.