Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.OptimizableBinding


            }
            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);
                    ref.getBindings().add(optimizableBinding);
                } else {
                    ref.getBindings().add(binding);
                }
            }
View Full Code Here


        InvalidInterfaceException {
        ComponentReference componentReference = assemblyFactory.createComponentReference();
        componentReference.setName("$self$." + service.getName());
        for (Binding binding : service.getBindings()) {
            if (binding instanceof OptimizableBinding) {
                OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
                optimizableBinding.setTargetBinding(binding);
                optimizableBinding.setTargetComponent(component);
                optimizableBinding.setTargetComponentService(service);
                componentReference.getBindings().add(optimizableBinding);
            } else {
                componentReference.getBindings().add(binding);
            }
        }
View Full Code Here

        InvalidInterfaceException {
        ComponentReference componentReference = assemblyFactory.createComponentReference();
        componentReference.setName("$self$." + service.getName());
        for (Binding binding : service.getBindings()) {
            if (binding instanceof OptimizableBinding) {
                OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
                optimizableBinding.setTargetBinding(binding);
                optimizableBinding.setTargetComponent(component);
                optimizableBinding.setTargetComponentService(service);
                componentReference.getBindings().add(optimizableBinding);
            } else {
                componentReference.getBindings().add(binding);
            }
        }
View Full Code Here

        ref.setComponent(component);
        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);
                ref.getBindings().add(optimizableBinding);
            } else {
                ref.getBindings().add(binding);
            }
        }
View Full Code Here

                                        break;
                                    }
                                }
                            }
                        }
                        OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
                        optimizableBinding.setTargetComponent(targetComponet);
                        optimizableBinding.setTargetComponentService(targetService);
                        if (targetService != null) {
                            for (Binding serviceBinding : targetService.getBindings()) {
                                if (serviceBinding.getClass() == binding.getClass()) {
                                    optimizableBinding.setTargetBinding(serviceBinding);
                                    break;
                                }
                            }
                        }
                    }
View Full Code Here

                for (Binding binding : service.getBindings()) {
                    // TODO - we should look at all the bindings now associated with the
                    //        unresolved target but we assume the SCA binding here as
                    //        its currently the only wireable one
                    if (binding instanceof OptimizableBinding) {
                        OptimizableBinding scaBinding = (OptimizableBinding)binding;

                        // clone the SCA binding and fill in service details
                        // its cloned as each target
                        SCABinding clonedSCABinding = null;
                        try {
                            clonedSCABinding = (SCABinding)((OptimizableBinding)scaBinding).clone();
                            clonedSCABinding.setURI(service.getName());
                            // wireable binding stuff needs to go. SCA binding uses it
                            // currently to get to the service to work out if the service
                            // is resolved.
                            OptimizableBinding endpoint = ((OptimizableBinding)clonedSCABinding);
                            endpoint.setTargetComponentService(service);
                            //endpoint.setTargetComponent(component); - not known for unresolved target
                            //endpoint.setTargetBinding(serviceBinding); - not known for unresolved target

                            // add the cloned SCA binding to the reference as it will be used to look up the
                            // provider later
View Full Code Here

        // create wire if binding has an endpoint
        Component targetComponent = null;
        ComponentService targetComponentService = null;
        Binding targetBinding = null;
        if (binding instanceof OptimizableBinding) {
            OptimizableBinding endpoint = (OptimizableBinding)binding;
            targetComponent = endpoint.getTargetComponent();
            targetComponentService = endpoint.getTargetComponentService();
            targetBinding = endpoint.getTargetBinding();
        }

        // create a forward wire, either static or dynamic
        addReferenceWire(component, reference, binding, targetComponent, targetComponentService, targetBinding);
View Full Code Here

                        if (binding.getURI() == null) {
                            cloned.setURI(serviceBinding.getURI());
                        }
                       
                        if (binding instanceof OptimizableBinding) {
                            OptimizableBinding endpoint = ((OptimizableBinding)cloned);
                            endpoint.setTargetComponent(targetComponent);
                            endpoint.setTargetComponentService(targetComponentService);
                            endpoint.setTargetBinding(serviceBinding);
                        }
                          
                        matched.add(cloned);
                        break;
                    } catch (Exception ex) {
View Full Code Here

        Component targetComponent = null;
        ComponentService targetComponentService = null;
        Binding targetBinding = null;
   
        if (binding instanceof OptimizableBinding) {
            OptimizableBinding endpoint = (OptimizableBinding)binding;
            targetComponent = endpoint.getTargetComponent();
            targetComponentService = endpoint.getTargetComponentService();
            targetBinding = endpoint.getTargetBinding();
            // FIXME: TUSCANY-2136, For unresolved binding, don't add wire. Is it the right solution?
            if (!reference.isCallback() && binding.getURI() == null && targetComponentService == null) {
                return;
            }
        }
View Full Code Here

                        if (binding.getURI() == null) {
                            cloned.setURI(serviceBinding.getURI());
                        }
                       
                        if (binding instanceof OptimizableBinding) {
                            OptimizableBinding endpoint = ((OptimizableBinding)cloned);
                            endpoint.setTargetComponent(targetComponent);
                            endpoint.setTargetComponentService(targetComponentService);
                            endpoint.setTargetBinding(serviceBinding);
                        }
                          
                        matched.add(cloned);
                        break;
                    } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.OptimizableBinding

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.