Examples of RuntimeComponentService


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

    // TODO - EPR - why static & convert to ne endpoint reference
    private static RuntimeComponentReference bind(RuntimeComponentReference reference,
                                                  EndpointReference resolvedEndpoint) throws CloneNotSupportedException {
        RuntimeComponent component = resolvedEndpoint.getComponent();
        RuntimeComponentService service = (RuntimeComponentService)resolvedEndpoint.getContract();
       
        RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
        ref.getTargets().add(service);
        ref.getBindings().clear();
        for (Binding binding : service.getBindings()) {
            if (binding instanceof OptimizableBinding) {
                OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
                optimizableBinding.setTargetBinding(binding);
                optimizableBinding.setTargetComponent(component);
                optimizableBinding.setTargetComponentService(service);
View Full Code Here

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

    private void addServiceWires(Component serviceComponent, ComponentService service) {
        if (!(service instanceof RuntimeComponentService)) {
            return;
        }
       
        RuntimeComponentService runtimeService = (RuntimeComponentService)service;

        // Add a wire for each service Endpoint
        for ( Endpoint2 endpoint : runtimeService.getEndpoints()){
           
            // fluff up a fake endpoint reference as we are on the service side
            // so we need to represent the reference that will call us
            EndpointReference2 endpointReference = assemblyFactory.createEndpointReference();
            endpointReference.setBinding(endpoint.getBinding());
            endpointReference.setTargetEndpoint(endpoint);
           
            // create the interface contract for the binding and service ends of the wire
            // that are created as forward only contracts
            // FIXME: [rfeng] We might need a better way to get the impl interface contract
            Service targetService = service.getService();
            if (targetService == null) {
                targetService = service;
            }
            endpoint.setInterfaceContract(targetService.getInterfaceContract().makeUnidirectional(false));
            endpointReference.setInterfaceContract(getServiceBindingInterfaceContract(service, endpoint.getBinding()));
           
            // create the wire
            RuntimeWire wire = new RuntimeWireImpl2(false,
                                                    endpointReference,
                                                    endpoint,
                                                    interfaceContractMapper,
                                                    workScheduler,
                                                    wireProcessor,
                                                    messageFactory,
                                                    conversationManager);
           
            runtimeService.getRuntimeWires().add(wire);
        }
    } 
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

        for (ComponentService service : component.getServices()) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
            }
            RuntimeComponentService runtimeService = (RuntimeComponentService)service;
            for (Endpoint2 endpoint : service.getEndpoints()) {
                final ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(endpoint.getBinding());
                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 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

    }

    private Invoker getInvoker(RuntimeEndpointReference epr, Operation operation) {
        Endpoint target = epr.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;
                Operation targetOp = chain.getTargetOperation();
View Full Code Here

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

    private void initInvocationChains() {
        chains = new ArrayList<InvocationChain>();
        InterfaceContract sourceContract = getBindingInterfaceContract();

        // It's the service wire
        RuntimeComponentService service = (RuntimeComponentService)getService();
        RuntimeComponent serviceComponent = (RuntimeComponent)getComponent();

        //InterfaceContract targetContract = getInterfaceContract();
        // TODO - EPR - why is this looking at the component types. The endpoint should have the right interface contract by this time
        InterfaceContract targetContract = getComponentTypeServiceInterfaceContract();
        // setInterfaceContract(targetContract);
        validateServiceInterfaceCompatibility();
        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, phaseManager);
            if (operation.isNonBlocking()) {
                addNonBlockingInterceptor(chain);
            }
View Full Code Here

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

                addReferenceBindingInterceptor(reference, refBinding, chain, operation);
                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
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.