Package org.apache.tuscany.sca.assembly

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


                                        break;
                                    }
                                }
                            }
                        }
                        OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
                        optimizableBinding.setTargetComponent(targetComponent);
                        optimizableBinding.setTargetComponentService(targetService);
                        if (targetService != null) {
                            for (Binding serviceBinding : targetService.getBindings()) {
                                if (serviceBinding.getClass() == binding.getClass()) {
                                    optimizableBinding.setTargetBinding(serviceBinding);
                                    break;
                                }
                            }
                        }
                    }
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

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

    public boolean isTargetRemote() {
        boolean targetIsRemote = false;

        // first look at the target service and see if this has been resolved
        OptimizableBinding optimizableBinding = (OptimizableBinding)binding;

        // The descision is based primary on the results of the wiring process in the assembly model
        // however there are two notable situations when this process doesn't give the right answer
        // 1. When a callback is in operation. A callback reference bindings sometimes has to
        //    act as though there is a local wire and sometimes as if there is a remote wire
        // 2. When a reference is retrieved from the domain. In this case the reference
        //    will not have been part of the original wiring process and will only have
        //    a target set if the target is local
        if (optimizableBinding.getTargetComponentService() != null) {
            if (optimizableBinding.getTargetComponentService().isUnresolved() == true) {
                targetIsRemote = true;
            } else {
                targetIsRemote = false;
            }
        } else {
View Full Code Here

    public boolean isTargetRemote() {
        boolean targetIsRemote = false;

        // first look at the target service and see if this has been resolved
        OptimizableBinding optimizableBinding = (OptimizableBinding)binding;

        // The decision is based on the results of the wiring process in the assembly model
        // The SCA binding is used to represent unresolved reference targets, i.e. those
        // reference targets that need resolving at run time. We can tell by lookin if the
        // service to which this binding refers is resolved or not.
        //
        // TODO - When a callback is in operation. A callback reference bindings sometimes has to
        //        act as though there is a local wire and sometimes as if there is a remote wire
        //        what are the implications of this here?

        if (RemoteBindingHelper.isTargetRemote()) {
            if (reference.getInterfaceContract() != null) {
                targetIsRemote = reference.getInterfaceContract().getInterface().isRemotable();
            } else {
                targetIsRemote = true;
            }
        } else if (optimizableBinding.getTargetComponentService() != null) {
            if (optimizableBinding.getTargetComponentService().isUnresolved() == true) {
                targetIsRemote = true;
            } else {
                targetIsRemote = false;
            }
        } else {
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

                            if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
                                targetService = promotedComponentService;
                            }
                        }
                       
                        OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
                        optimizableBinding.setTargetComponent(targetComponent);
                        optimizableBinding.setTargetComponentService(targetService);
                        if (targetService != null) {
                            for (Binding serviceBinding : targetService.getBindings()) {
                                if (serviceBinding.getClass() == binding.getClass()) {
                                    optimizableBinding.setTargetBinding(serviceBinding);
                                    break;
                                }
                            }
                        }
                    }
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

            }
            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

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.