/** * Use preProcess to validate and map the references and properties dynamically */ public void build(Component component) { for (Reference reference : component.getReferences()) { if (unresolvedBeanRef.containsKey(reference.getName())) { Reference ref = unresolvedBeanRef.get(reference.getName()); componentType.getReferences().add(createReference(reference, ref.getInterfaceContract())); unresolvedBeanRef.remove(reference.getName()); } } for (Property property : component.getProperties()) { if (unresolvedBeanRef.containsKey(property.getName())) { componentType.getProperties().add(createProperty(property)); this.setPropertyClass(property.getName(), property.getClass()); unresolvedBeanRef.remove(property.getName()); } } }
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 start(CompositeContext compositeContext, Composite composite) { if (logger.isLoggable(Level.FINE)) { logger.fine("Starting composite: " + composite.getName()); } for (Component component : composite.getComponents()) { start(compositeContext, component); } for (Component component : composite.getComponents()) { if (component instanceof ScopedRuntimeComponent) { start(compositeContext, (ScopedRuntimeComponent)component); } } // start reference last. In allowing references to start at "start" time // as well as when they are first used (for late bound references) we need // to make sure that all potential target services and component implementations // are started first to take account of the default binding optimization case for (Component component : composite.getComponents()) { for (ComponentReference reference : component.getReferences()) { start(compositeContext, (RuntimeComponent)component, (RuntimeComponentReference)reference); } } }
for (ComponentReference componentReference : component.getReferences()) { String uri = component.getName() + '/' + componentReference.getName(); componentReferences.put(uri, componentReference);
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); } }
Composite composite = (Composite)model; Component component = composite.getComponents().get(0); ComponentReference reference = component.getReferences().get(0); Binding binding = reference.getBindings().get(0); endpointReference.setComponent(component);
Composite composite = (Composite)model; Component component = composite.getComponents().get(0); ComponentReference reference = component.getReferences().get(0); Binding binding = reference.getBindings().get(0); endpointReference.setComponent(component);
private void validateReferenceMultiplicity(Composite composite, Component component, Monitor monitor) { for (ComponentReference componentReference : component.getReferences()) { if (!validateMultiplicity(componentReference.getMultiplicity(), componentReference.getEndpointReferences())) {
private void validateReferenceMultiplicity(Composite composite, Component component, Monitor monitor) { for (ComponentReference componentReference : component.getReferences()) { if (!validateMultiplicity(componentReference.getMultiplicity(), componentReference.getEndpointReferences())) {
private void buildReferenceBindings(Composite composite, BuilderContext context) { // find all the component reference bindings (starting at top level) for (Component component : composite.getComponents()) { for (ComponentReference componentReference : component.getReferences()) { for (Binding binding : componentReference.getBindings()) { BindingBuilder builder = builders.getBindingBuilder(binding.getType()); if (builder != null) { builder.build(component, componentReference, binding, context, false); } } } } // build bindings recursively for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { buildReferenceBindings((Composite)implementation, context); } } }
private void buildReferenceBindings(Composite composite, BuilderContext context) { // find all the component reference bindings (starting at top level) for (Component component : composite.getComponents()) { for (ComponentReference componentReference : component.getReferences()) { for (Binding binding : componentReference.getBindings()) { BindingBuilder builder = builders.getBindingBuilder(binding.getType()); if (builder != null) { builder.build(component, componentReference, binding, context, false); } } } } // build bindings recursively for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { buildReferenceBindings((Composite)implementation, context); } } }
private void addReferencesFromComponentType(Component component, Monitor monitor) { // Create a component reference for each reference if (component.getImplementation() != null) { for (Reference reference : component.getImplementation().getReferences()) { // check for duplicate reference names in implementation if (reference != component.getImplementation().getReference(reference.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationReferenceName", component.getName(), reference.getName()); } ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName()); // if the component doesn't have a reference with the same name as the // component type reference then create one if (componentReference == null) { componentReference = assemblyFactory.createComponentReference(); componentReference.setForCallback(reference.isForCallback()); componentReference.setName(reference.getName()); componentReference.setReference(reference); component.getReferences().add(componentReference); } } } }
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 addReferencesFromComponentType(Component component, Monitor monitor) { // Create a component reference for each reference if (component.getImplementation() != null) { for (Reference reference : component.getImplementation().getReferences()) { // check for duplicate reference names in implementation if (reference != component.getImplementation().getReference(reference.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationReferenceName", component.getName(), reference.getName()); } ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName()); // if the component doesn't have a reference with the same name as the // component type reference then create one if (componentReference == null) { componentReference = assemblyFactory.createComponentReference(); componentReference.setForCallback(reference.isForCallback()); componentReference.setName(reference.getName()); componentReference.setReference(reference); component.getReferences().add(componentReference); } } } }
private void connectReferencesToComponentType(Component component, Monitor monitor) { for (ComponentReference componentReference : component.getReferences()) {
private void connectReferencesToComponentType(Component component, Monitor monitor) { for (ComponentReference componentReference : component.getReferences()) {
for (ComponentReference componentReference : component.getReferences()) { monitor.pushContext("Reference: " + componentReference.getName()); try {
for (ComponentReference componentReference : component.getReferences()) { monitor.pushContext("Reference: " + componentReference.getName()); try {