Package org.apache.tuscany.sca.assembly

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


        }

        // 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();
View Full Code Here


        EndpointReference wireSource =
            new EndpointReferenceImpl((RuntimeComponent)refComponent, reference, refBinding, sourceContract);
        ComponentService callbackService = reference.getCallbackService();
        if (callbackService != null) {
            // select a reference callback binding to pass with invocations on this wire
            Binding callbackBinding = null;
            for (Binding binding : callbackService.getBindings()) {
                // first look for a callback binding whose name matches the reference binding name
              if (refBinding.getName().startsWith(binding.getName())) {
                    callbackBinding = binding;
                    break;
View Full Code Here

    private void generateJavaScriptReferenceFunction (PrintWriter pw) throws IOException {
       
        pw.println("var referenceMap = new Object();");
        for(ComponentReference reference : component.getReferences()) {
            String referenceName = reference.getName();
            Binding binding = reference.getBindings().get(0);
            if (binding != null) {
               
                String proxyClient = WidgetProxyHelper.getJavaScriptProxyClient(binding.getClass().getName());
                if(proxyClient != null) {
                   
                    //FIXME Eventually the binding URI should be initialized from the SCA domain
                    // for now point to the target binding model directly, assuming that it's available
                    // in the same node
                    String targetURI = null;
                    if (binding instanceof OptimizableBinding) {
                        Binding targetBinding = ((OptimizableBinding)binding).getTargetBinding();
                        if (targetBinding != null) {
                            targetURI = URI.create(targetBinding.getURI()).getPath();
                        }
                    }
                    if (targetURI == null) {
                        targetURI = URI.create(binding.getURI()).getPath();
                        if (!targetURI.startsWith("/")) {
View Full Code Here

        // the sca binding can decide whether to provide local or remote invokers.
        // TODO - there is a problem here though in that I'm setting a target on a
        //        binding that may possibly be trying to point at two things in the multi threaded
        //        case. Need to confirm the general model here and how the clone and bind part
        //        is intended to work
        Binding binding = wire.getSource().getBinding();
        binding.setURI(resolvedEndpoint.getURI());

        // also need to set the target contract as it varies for the sca binding depending on
        // whether it is local or remote
        RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
        wire.getTarget().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
View Full Code Here

            for (Binding serviceBinding : target) {
                if (binding.getClass() == serviceBinding.getClass() &&
                    hasCompatiblePolicySets(binding, serviceBinding)) {

                    try {
                        Binding cloned = (Binding)binding.clone();
                       
                        //Customise the binding name to make it unique
                        // regardless of how many bindings or targets there are
                        if ( component != null){
                            cloned.setName(binding.getName() + "#" + component.getName() + "/" + serviceBinding.getName());
                        } else {
                            cloned.setName(binding.getName() + "#" + serviceBinding.getName());
                        }
                       
                        // Set the binding URI to the URI of the target service
                        // that has been matched
                        if (binding.getURI() == null) {
                            cloned.setURI(serviceBinding.getURI());
                        }
                       
                        if (binding instanceof OptimizableBinding) {
                            OptimizableBinding endpoint = ((OptimizableBinding)cloned);
                            endpoint.setTargetComponent(component);
View Full Code Here

                       
                        if ( targetService.isUnresolved()){
                           
                            if (service != null){
                                // Find the binding already in use for this target
                                Binding binding = null;
                               
                                for (Binding tmpBinding : reference.getBindings()){
                                    if ((tmpBinding.getName() != null) &&
                                        (tmpBinding.getName().startsWith(reference.getName() + "#" + targetName))){
                                        binding = tmpBinding;
                                    }
                                }

                                // Resolve the binding that should be used for this target
                                // TODO - hang onto the old bindings at the domain level, i.e.
                                //        don't rely on the target objects as we still need the
                                //        bindings if we are going to do autowiring
                                List<Binding> source = targetService.getBindings();
                                List<Binding> target = service.getBindings();
                                Binding newBinding = BindingUtil.matchBinding(serviceComponent, (ComponentService)service, source, target);
                               
                                // update the existing binding to the new binding if required
                                if (newBinding != null) {
                                    if (binding != null){
                                        // there is a binding already so see if the URI has changed
                                        if ((binding.getURI() == null) ||
                                            (!binding.getURI().equals(newBinding.getURI()))){
                                            binding.setURI(newBinding.getURI());
                                            compositeChanged = true;
                                        }
                                    } else {
                                        // this is a newly configured binding so add it
                                        reference.getBindings().add(newBinding);
View Full Code Here

                    }
                }
            }
        };
        configurationBuilder = new CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor);
        Binding defaultBinding = new TestBindingImpl();
        defaultBinding.setURI("http://myhost:8080/root");
        defaultBindings.add(defaultBinding);
    }
View Full Code Here

       
        ComponentService s2 = assemblyFactory.createComponentService();
        c1.getServices().add(s2);
        s2.setName("s2");       
       
        Binding b1 = new TestBindingImpl();
        s1.getBindings().add(b1);
       
        Binding b2 = new TestBindingImpl();
        s2.getBindings().add(b2);       
       
        return composite1;
    }
View Full Code Here

       
        CompositeService s1 = assemblyFactory.createCompositeService();
        s1.setName("s1");
        composite1.getServices().add(s1);
       
        Binding b1 = new TestBindingImpl();
        s1.getBindings().add(b1);
       
        CompositeService s2 = assemblyFactory.createCompositeService();
        s2.setName("s2");
        composite1.getServices().add(s2);
       
        Binding b2 = new TestBindingImpl();
        s2.getBindings().add(b2);
       
        return composite1;
    }
View Full Code Here

       
        ComponentService s2 = assemblyFactory.createComponentService();
        c2.getServices().add(s2);
        s2.setName("s2");       
       
        Binding b1 = new TestBindingImpl();
        s1.getBindings().add(b1);
       
        Binding b2 = new TestBindingImpl();
        s2.getBindings().add(b2)
       
        return composite1;      
    }
View Full Code Here

TOP

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

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.