/** * Get the service endpoints in this Node * TODO: needs review, works for the very simple testcase but i expect there are * other endpoints to be included */ public List<Endpoint> getServiceEndpoints() { List<Endpoint> endpoints = new ArrayList<Endpoint>(); if (compositeActivator != null) { if (domainComposite != null) { for (Component component : domainComposite.getComponents()) { for (Service service : component.getServices()) { // MJE 28/05/2009 - changed to RuntimeComponentService from RuntimeComponentServiceImpl // - no need to access the Impl directly here if (service instanceof RuntimeComponentService) { endpoints.addAll(((RuntimeComponentService)service).getEndpoints()); } } } } } return endpoints; }
/** * Get the service endpoints in this Node * TODO: needs review, works for the very simple testcase but i expect there are * other endpoints to be included */ public List<Endpoint> getServiceEndpoints() { List<Endpoint> endpoints = new ArrayList<Endpoint>(); if (compositeActivator != null) { if (domainComposite != null) { for (Component component : domainComposite.getComponents()) { for (Service service : component.getServices()) { // MJE 28/05/2009 - changed to RuntimeComponentService from RuntimeComponentServiceImpl // - no need to access the Impl directly here if (service instanceof RuntimeComponentService) { endpoints.addAll(((RuntimeComponentService)service).getEndpoints()); } } } } } return endpoints; }
/** * @param component */ public static ComponentService getSingleService(Component component) { ComponentService targetService; List<ComponentService> services = component.getServices(); List<ComponentService> regularServices = new ArrayList<ComponentService>(); for (ComponentService service : services) { if (service.isForCallback()) { continue; } String name = service.getName(); if (!name.startsWith("$") || name.startsWith("$dynamic$")) { regularServices.add(service); } } if (regularServices.size() == 0) { throw new ServiceRuntimeException("No service is declared on component " + component.getURI()); } if (regularServices.size() != 1) { throw new ServiceRuntimeException("More than one service is declared on component " + component.getURI() + ". Service name is required to get the service."); } targetService = regularServices.get(0); return targetService; }
Composite composite = (Composite)model; Component component = composite.getComponents().get(0); ComponentService service = component.getServices().get(0); Binding binding = service.getBindings().isEmpty() ? null : service.getBindings().get(0); endpoint.setComponent(component);
Composite composite = (Composite)model; Component component = composite.getComponents().get(0); ComponentService service = component.getServices().get(0); Binding binding = service.getBindings().isEmpty() ? null : service.getBindings().get(0); endpoint.setComponent(component);
continue; for (Service service : component.getServices()) { if (serviceName != null && !service.getName().equals(serviceName)) { continue;
continue; for (Service service : component.getServices()) { if (serviceName != null && !service.getName().equals(serviceName)) { continue;
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
public void deactivateComponent(Component component) throws ActivationException { try { if (logger.isLoggable(Level.FINE)) { logger.fine("Deactivating component: " + component.getURI()); } for (ComponentService service : component.getServices()) { deactivate((RuntimeComponent) component, (RuntimeComponentService) service); } for (ComponentReference reference : component.getReferences()) { deactivate((RuntimeComponent) component, (RuntimeComponentReference) reference); } Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { deactivate((Composite) implementation); } else if (implementation != null) { removeImplementationProvider((RuntimeComponent) component); removeScopeContainer(component); } } catch (Exception e) { throw new ActivationException(e); } }
public void activateComponent(CompositeContext compositeContext, Component component) throws ActivationException { try { if (logger.isLoggable(Level.FINE)) { logger.fine("Activating component: " + component.getURI()); } Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { activate(compositeContext, (Composite) implementation); } else if (implementation != null) { addImplementationProvider((RuntimeComponent) component, implementation); addScopeContainer(component); } for (ComponentService service : component.getServices()) { activate(compositeContext, (RuntimeComponent) component, (RuntimeComponentService) service); } for (ComponentReference reference : component.getReferences()) { activate(compositeContext, (RuntimeComponent) component, (RuntimeComponentReference) reference); } } catch (Exception e) { throw new ActivationException(e); } }
private void buildServiceBindings(Composite composite, BuilderContext context) { // build bindings recursively for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { buildServiceBindings((Composite)implementation, context); } } // find all the component service bindings for (Component component : composite.getComponents()) { for (ComponentService componentService : component.getServices()) { for (Binding binding : componentService.getBindings()) { BindingBuilder builder = builders.getBindingBuilder(binding.getType()); if (builder != null) { builder.build(component, componentService, binding, context, false); } } } } }
private void buildServiceBindings(Composite composite, BuilderContext context) { // build bindings recursively for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { buildServiceBindings((Composite)implementation, context); } } // find all the component service bindings for (Component component : composite.getComponents()) { for (ComponentService componentService : component.getServices()) { for (Binding binding : componentService.getBindings()) { BindingBuilder builder = builders.getBindingBuilder(binding.getType()); if (builder != null) { builder.build(component, componentService, binding, context, false); } } } } }
for (ComponentService componentService : component.getServices()) {
for (ComponentService componentService : component.getServices()) {
for (ComponentService componentService : component.getServices()) { monitor.pushContext("Service: " + componentService.getName()); try { for (ComponentService componentService : component.getServices()) { monitor.pushContext("Service: " + componentService.getName()); try {
private void addServicesFromComponentType(Component component, Monitor monitor) { // Create a component service for each service if (component.getImplementation() != null) { for (Service service : component.getImplementation().getServices()) { // check for duplicate service names in implementation if (service != component.getImplementation().getService(service.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationServiceName", component.getName(), service.getName()); } ComponentService componentService = (ComponentService)component.getService(service.getName()); // if the component doesn't have a service with the same name as the // component type service then create one if (componentService == null) { componentService = assemblyFactory.createComponentService(); componentService.setForCallback(service.isForCallback()); String name = service.getName(); componentService.setName(name); component.getServices().add(componentService); } } } }
private void addServicesFromComponentType(Component component, Monitor monitor) { // Create a component service for each service if (component.getImplementation() != null) { for (Service service : component.getImplementation().getServices()) { // check for duplicate service names in implementation if (service != component.getImplementation().getService(service.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationServiceName", component.getName(), service.getName()); } ComponentService componentService = (ComponentService)component.getService(service.getName()); // if the component doesn't have a service with the same name as the // component type service then create one if (componentService == null) { componentService = assemblyFactory.createComponentService(); componentService.setForCallback(service.isForCallback()); String name = service.getName(); componentService.setName(name); component.getServices().add(componentService); } } } }
private void populateLocalRegistry(Composite composite, DomainRegistry registry, BuilderContext context){ for (Component component : composite.getComponents()) { // recurse for composite implementations Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { populateLocalRegistry((Composite)implementation, registry, context); } // add all endpoints to the local registry for (ComponentService service : component.getServices()) { for (Endpoint endpoint : service.getEndpoints()){ registry.addEndpoint(endpoint); } } // add endpoint references that we want to match to the registry for (ComponentReference reference : component.getReferences()) { for (EndpointReference epr : reference.getEndpointReferences()){ if (epr.getStatus().equals(EndpointReference.Status.WIRED_TARGET_NOT_FOUND)|| epr.getStatus().equals(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI)){ registry.addEndpointReference(epr); } } } } }
private void connectServicesToComponentType(Component component, Monitor monitor) { for (ComponentService componentService : component.getServices()) {