Examples of CompositeService


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

                // Process the component services declared on components in this composite
                for (ComponentService componentService : component.getServices()) {
                    Service implService = componentService.getService();
                    if (implService != null && implService instanceof CompositeService) {
                        CompositeService compositeService = (CompositeService)implService;

                        // Get the innermost promoted service
                        ComponentService promotedService =
                            ServiceConfigurationUtil.getPromotedComponentService(compositeService);
                        if (promotedService != null) {
                            Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);

                            // Create a new component service to represent this
                            // component service on the promoted component
                            ComponentService newComponentService = assemblyFactory.createComponentService();
                            newComponentService.setName("$promoted$" + component.getName() + "$slash$" + componentService.getName());
                            promotedComponent.getServices().add(newComponentService);
                            newComponentService.setService(promotedService.getService());
                            newComponentService.getBindings().addAll(componentService.getBindings());
                            newComponentService.setInterfaceContract(componentService.getInterfaceContract());
                           
                            if (componentService.getInterfaceContract() != null &&
                                componentService.getInterfaceContract().getCallbackInterface() != null) {
                                newComponentService.setCallback(assemblyFactory.createCallback());
                                newComponentService.getCallback().getBindings()
                                        .addAll(componentService.getCallback().getBindings());
                            }

                            // Change the composite service to now promote the
                            // newly created component service directly
                            compositeService.setPromotedComponent(promotedComponent);
                            compositeService.setPromotedService(newComponentService);
                        }
                    }
                }
            }
        }
View Full Code Here

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

                        ComponentService targetService = resolveServiceURI(bindingURI, targetComponent);

                        // if the target service is a promoted service then find the
                        // service it promotes
                        if ((targetService != null) && (targetService.getService() instanceof CompositeService)) {
                            CompositeService compositeService = (CompositeService)targetService.getService();
                            // Find the promoted component service
                            ComponentService promotedComponentService = getPromotedComponentService(compositeService);
                            if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
                                targetService = promotedComponentService;
                            }
View Full Code Here

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

        // Process nested composites recursively
        configureNestedCompositeServices(composite);

        // Process top level composite services
        for (Service service : composite.getServices()) {
            CompositeService compositeService = (CompositeService)service;

            // Get the next lower level promoted service
            ComponentService promotedService = compositeService.getPromotedService();
            if (promotedService != null) {

                // Set the bindings using the top level bindings to override the lower level bindings
                if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
                    bindingsSpecifiedManually(promotedService.getBindings())) {
                    compositeService.getBindings().clear();
                    for (Binding binding : promotedService.getBindings()) {
                        try {
                            compositeService.getBindings().add((Binding)binding.clone());
                        } catch (CloneNotSupportedException ex) {
                            // this binding can't be used in the promoted service
                        }
                    }                   
                }
                if (compositeService.getInterfaceContract() != null &&
                    compositeService.getInterfaceContract().getCallbackInterface() != null) {
                    if (!(compositeService.getCallback() != null &&
                          bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
                        promotedService.getCallback() != null &&
                        bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
                        if (compositeService.getCallback() != null) {
                            compositeService.getCallback().getBindings().clear();
                        } else {
                            compositeService.setCallback(assemblyFactory.createCallback());
                        }
                        for (Binding binding : promotedService.getCallback().getBindings()) {
                            try {
                                compositeService.getCallback().getBindings().add((Binding)binding.clone());
                            } catch (CloneNotSupportedException ex) {
                                // this binding can't be used in the promoted service
                            }
                        }                         
                    }
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.