Examples of SCAObject


Examples of org.apache.tuscany.spi.component.SCAObject

            }
        }
    }

    public void process(InboundWire source, OutboundWire target) {
        SCAObject container = source.getContainer();
        // Either Service or Reference
        boolean isReference = container instanceof Reference;

        Map<Operation<?>, InboundInvocationChain> chains = source.getInvocationChains();
        for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

                for (OutboundWire outboundWire : referenceWires) {
                    if (outboundWire instanceof OutboundAutowire) {
                        continue;
                    }
                    try {
                        SCAObject target;
                        if (sourceComponent.isSystem()) {
                            target = parent.getSystemChild(outboundWire.getTargetName().getPartName());
                        } else {
                            target = parent.getChild(outboundWire.getTargetName().getPartName());
                        }
                        connect(sourceComponent, outboundWire, target);
                    } catch (BuilderConfigException e) {
                        e.addContextName(source.getName());
                        e.addContextName(parent.getName());
                        throw e;
                    }
                }
            }
            // connect inbound wires
            for (InboundWire inboundWire : sourceComponent.getInboundWires().values()) {
                for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
                    Operation<?> operation = chain.getOperation();
                    String serviceName = inboundWire.getServiceName();
                    TargetInvoker invoker = sourceComponent.createTargetInvoker(serviceName, operation);
                    chain.setTargetInvoker(invoker);
                    chain.prepare();
                }
            }
        } else if (source instanceof Reference) {
            Reference reference = (Reference) source;
            InboundWire inboundWire = reference.getInboundWire();
            Map<Operation<?>, InboundInvocationChain> inboundChains = inboundWire.getInvocationChains();
            for (InboundInvocationChain chain : inboundChains.values()) {
                //TODO handle async
                // add target invoker on inbound side
                ServiceContract contract = inboundWire.getServiceContract();
                Operation operation = chain.getOperation();
                TargetInvoker invoker = reference.createTargetInvoker(contract, operation);
                chain.setTargetInvoker(invoker);
                chain.prepare();
            }
            OutboundWire outboundWire = reference.getOutboundWire();
            // connect the reference's inbound and outbound wires
            connect(inboundWire, outboundWire, true);
           
            if (reference instanceof CompositeReference) {
                // For a composite reference only, since its outbound wire comes
                // from its parent composite,
                // the corresponding target would not lie in its parent but
                // rather in its parent's parent
                parent = parent.getParent();
                assert parent != null : "Parent of parent was null";
                SCAObject target = parent.getChild(outboundWire.getTargetName().getPartName());
                connect((Component)parent, outboundWire, target);
            }           
        } else if (source instanceof Service) {
            Service service = (Service) source;
            InboundWire inboundWire = service.getInboundWire();
            OutboundWire outboundWire = service.getOutboundWire();
            // For a composite reference only, since its outbound wire comes from its parent composite,
            // the corresponding target would not lie in its parent but rather in its parent's parent
            if (source instanceof CompositeReference) {
                parent = parent.getParent();
                assert parent != null : "Parent of parent was null";
            }
            SCAObject target;
            if (service.isSystem()) {
                target = parent.getSystemChild(outboundWire.getTargetName().getPartName());
            } else {
                target = parent.getChild(outboundWire.getTargetName().getPartName());
            }
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

     * @param sourceWire  the source wire to connect
     * @param targetWire  the target wire to connect to
     * @param optimizable true if the wire connection can be optimized
     */
    void connect(OutboundWire sourceWire, InboundWire targetWire, boolean optimizable) {
        SCAObject source = sourceWire.getContainer();
        SCAObject target = targetWire.getContainer();
        ServiceContract contract = sourceWire.getServiceContract();
        Map<Operation<?>, InboundInvocationChain> targetChains = targetWire.getInvocationChains();
        // perform optimization, if possible
        // REVIEW: (kentaminator@gmail.com) shouldn't this check whether the interceptors in the
        // source & target chains are marked as optimizable?  (and if so, optimize them away?)
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

    public <B extends Binding> SCAObject build(CompositeComponent parent,
                                               BoundServiceDefinition<B> boundServiceDefinition,
                                               DeploymentContext deploymentContext) {
        Class<?> bindingClass = boundServiceDefinition.getBinding().getClass();
        BindingBuilder<B> bindingBuilder = (BindingBuilder<B>) bindingBuilders.get(bindingClass);
        SCAObject object = bindingBuilder.build(parent, boundServiceDefinition, deploymentContext);
        if (wireService != null) {
            // wireService.createWires((Service) object, boundServiceDefinition);
            String path = boundServiceDefinition.getTarget().getPath();
            ServiceContract<?> contract = boundServiceDefinition.getServiceContract();
            wireService.createWires((Service)object, path, contract);
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

    public <B extends Binding> SCAObject build(CompositeComponent parent,
                                               BoundReferenceDefinition<B> boundReferenceDefinition,
                                               DeploymentContext deploymentContext) {
        Class<B> bindingClass = (Class<B>) boundReferenceDefinition.getBinding().getClass();
        BindingBuilder<B> bindingBuilder = (BindingBuilder<B>) bindingBuilders.get(bindingClass);
        SCAObject object = bindingBuilder.build(parent, boundReferenceDefinition, deploymentContext);
        // create wires for the component
        if (wireService != null) {
            wireService.createWires((Reference) object, boundReferenceDefinition.getServiceContract());
        }
        return object;
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

    }

    public SCAObject build(CompositeComponent parent,
                           BindlessServiceDefinition serviceDefinition,
                           DeploymentContext deploymentContext) {
        SCAObject object = bindlessBuilder.build(parent, serviceDefinition, deploymentContext);
        if (wireService != null) {
            String path = serviceDefinition.getTarget().getPath();
            ServiceContract<?> contract = serviceDefinition.getServiceContract();
            wireService.createWires((Service)object, path, contract);
        }
View Full Code Here

Examples of org.apache.tuscany.spi.component.SCAObject

    }

    public SCAObject build(CompositeComponent parent,
                           ReferenceDefinition referenceDefinition,
                           DeploymentContext deploymentContext) {
        SCAObject object = bindlessBuilder.build(parent, referenceDefinition, deploymentContext);
        if (wireService != null) {
            wireService.createWires((Reference) object, referenceDefinition.getServiceContract());
        }
        return object;
    }
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.