Examples of RuntimeComponentService


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

    }

    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

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()) {
                final ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
                if (bindingProvider != null) {
                    // bindingProvider.start();
                    // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
                    AccessController.doPrivileged(new PrivilegedAction<Object>() {
                        public Object run() {
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

                chains.add(chain);
            }
           
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
            RuntimeComponent serviceComponent = wireTarget.getComponent();
            Binding serviceBinding = wireTarget.getBinding();
            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, false);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(service, serviceBinding, chain);
                }
View Full Code Here

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

            }
        }              
    }   
   
    private void initServiceBindingInvocationChains() {
        RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
        Binding serviceBinding = wireTarget.getBinding();
       
        // add the binding interceptors to the service binding wire
        ServiceBindingProvider provider = service.getBindingProvider(serviceBinding);
        if ((provider != null) &&
            (provider instanceof ServiceBindingProviderRRB)){
            ((ServiceBindingProviderRRB)provider).configureBindingChain(this);
        }
       
View Full Code Here

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

    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();
        ((CallableReferenceExt<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

                chains.add(chain);
            }
           
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
            RuntimeComponent serviceComponent = (RuntimeComponent)endpoint.getComponent();
            Binding serviceBinding = endpoint.getBinding();
            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, false);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(service, serviceBinding, chain);
                }
View Full Code Here

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

            }
        }              
    }   
   
    private void initServiceBindingInvocationChains() {
        RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
        Binding serviceBinding = endpoint.getBinding();
       
        // add the binding interceptors to the service binding wire
        ServiceBindingProvider provider = service.getBindingProvider(serviceBinding);
        if ((provider != null) &&
            (provider instanceof ServiceBindingProviderRRB)){
            ((ServiceBindingProviderRRB)provider).configureBindingChain(this);
        }
       
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.