Examples of RuntimeComponentService


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

        return service.getInterfaceContract();
    }

    public void start() {

        RuntimeComponentService componentService = (RuntimeComponentService) service;
        RuntimeWire wire = componentService.getRuntimeWire(binding);
        InvocationChain chain = wire.getInvocationChains().get(0);
       
        // Register with the hosting server
        String uri = binding.getURI();
        EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory));
View Full Code Here

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

    public void start() {

        // Get the target component implementation, for now we are assuming
        // that it's an implementation.resource
        RuntimeComponentService componentService = (RuntimeComponentService) service;
        RuntimeWire wire = componentService.getRuntimeWire(binding);
       
        // Get the getLocationURL invoker
        Invoker getLocationInvoker = null;
        for (InvocationChain invocationChain : wire.getInvocationChains()) {
            String operationName = invocationChain.getSourceOperation().getName();
View Full Code Here

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

                addBindingInterceptor(reference, refBinding, chain, operation);
                chains.add(chain);
            }
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
            RuntimeComponent serviceComponent = wireTarget.getComponent();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in service "
                        + serviceComponent.getURI()
                        + "#"
                        + service.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
                addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
                chains.add(chain);
            }
View Full Code Here

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

    @SuppressWarnings("unchecked")
    public <B> CallableReference<B> getServiceReference() {
        Message msgContext = ThreadMessageContext.getMessageContext();
        // FIXME: [rfeng] Is this the service reference matching the caller side?
        EndpointReference to = msgContext.getTo();
        RuntimeComponentService service = (RuntimeComponentService) to.getContract();
        RuntimeComponent component = (RuntimeComponent) to.getComponent();
       
        CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
        ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
        ((CallableReferenceImpl<B>) callableReference).attachCallbackID(parameters.getCallbackID());
View Full Code Here

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

    @SuppressWarnings("unchecked")
    public <CB> CallableReference<CB> getCallbackReference() {
        Message msgContext = ThreadMessageContext.getMessageContext();
        EndpointReference to = msgContext.getTo();
        RuntimeComponentService service = (RuntimeComponentService) to.getContract();
        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

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

        for (ComponentService service : component.getServices()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
            }
            RuntimeComponentService runtimeService = (RuntimeComponentService)service;
            for (Binding binding : service.getBindings()) {
                ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }
            }
        }
View Full Code Here

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

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

     */
    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

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

    public boolean supportsOneWayInvocation() {
        return false;
    }
   
    public void start() {
        RuntimeComponentService componentService = (RuntimeComponentService)service;

        // Set default databinding to json
        serviceContract.getInterface().setDefaultDataBinding(JSONDataBinding.NAME);

        // Determine the service business interface
View Full Code Here

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

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

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

        JMSHost jmsHost = new JMSHost(){
            public JMSResourceFactory createJMSResourceFactory(String connectionFactoryName, String initialContextFactoryName, String jndiURL) {
                return null;
            }};
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.