Package org.apache.tuscany.sca.assembly

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


                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 WireableBinding) {
                        WireableBinding scaBinding = (WireableBinding)binding;

                        // clone the SCA binding and fill in service details
                        // its cloned as each target
                        SCABinding clonedSCABinding = null;
                        try {
                            clonedSCABinding = (SCABinding)((WireableBinding)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.
                            WireableBinding endpoint = ((WireableBinding)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 WireableBinding) {
            WireableBinding endpoint = (WireableBinding)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

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

     * @param binding
     */
    private void addServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
        // REVIEW: Is this the right way to mark the binding as remote?
        if ((binding instanceof WireableBinding) && (service.getInterfaceContract().getInterface().isRemotable())) {
            WireableBinding wireableBinding = (WireableBinding)binding;
            wireableBinding.setRemote(true);
        }
        BindingProviderFactory providerFactory =
            (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
        if (providerFactory != null) {
            @SuppressWarnings("unchecked")
View Full Code Here

            }
            ref.getTargets().add(service);
            ref.getBindings().clear();
            for (Binding binding : service.getBindings()) {
                if (binding instanceof WireableBinding) {
                    WireableBinding wireableBinding = (WireableBinding)((WireableBinding)binding).clone();
                    wireableBinding.setTargetBinding(binding);
                    wireableBinding.setTargetComponent(component);
                    wireableBinding.setTargetComponentService(service);
                    wireableBinding.setRemote(false);
                    ref.getBindings().add(wireableBinding);
                } 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 WireableBinding) {
                WireableBinding wireableBinding = (WireableBinding)((WireableBinding)binding).clone();
                wireableBinding.setTargetBinding(binding);
                wireableBinding.setTargetComponent(component);
                wireableBinding.setTargetComponentService(service);
                wireableBinding.setRemote(false);
                componentReference.getBindings().add(wireableBinding);
            } 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 WireableBinding) {
                WireableBinding wireableBinding = (WireableBinding)((WireableBinding)binding).clone();
                wireableBinding.setTargetBinding(binding);
                wireableBinding.setTargetComponent(component);
                wireableBinding.setTargetComponentService(service);
                wireableBinding.setRemote(false);
                componentReference.getBindings().add(wireableBinding);
            } 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 WireableBinding) {
                WireableBinding wireableBinding = (WireableBinding)((WireableBinding)binding).clone();
                wireableBinding.setTargetBinding(binding);
                wireableBinding.setTargetComponent(component);
                wireableBinding.setTargetComponentService(service);
                wireableBinding.setRemote(false);
                ref.getBindings().add(wireableBinding);
            } else {
                ref.getBindings().add(binding);
            }
        }
View Full Code Here

        RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
        ref.getTargets().add(service);
        ref.getBindings().clear();
        for (Binding binding : service.getBindings()) {
            if (binding instanceof WireableBinding) {
                WireableBinding wireableBinding = (WireableBinding)((WireableBinding)binding).clone();
                wireableBinding.setTargetBinding(binding);
                wireableBinding.setTargetComponent(component);
                wireableBinding.setTargetComponentService(service);
                wireableBinding.setRemote(false);
                ref.getBindings().add(wireableBinding);
            } else {
                ref.getBindings().add(binding);
            }
        }
View Full Code Here

                    Binding cloned = binding;
                    if (binding instanceof WireableBinding) {
                        // TODO: We need to clone the reference binding
                        try {
                            cloned = (Binding)((WireableBinding)binding).clone();
                            WireableBinding endpoint = ((WireableBinding)cloned);
                            endpoint.setTargetComponent(component);
                            endpoint.setTargetComponentService(service);
                            endpoint.setTargetBinding(serviceBinding);
                            cloned.setURI(serviceBinding.getURI());
                        } catch (Exception e) {
                            // warning("The binding doesn't support clone: " + binding.getClass().getSimpleName(), binding);
                        }
                    }
View Full Code Here

TOP

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

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.