@SuppressWarnings({"unchecked"}) private void instantiateChildComponents(LogicalCompositeComponent component, Composite composite, InstantiationContext context) { // create the child components List<LogicalComponent<?>> children = new ArrayList<>(); for (Component<? extends Implementation<?>> child : composite.getComponents().values()) { LogicalComponent<?> childComponent = atomicInstantiator.instantiate(child, component, context); component.addComponent(childComponent); children.add(childComponent); } // resolve the reference wires after the children have been instantiated and added to the parent, otherwise targets will not resolve for (LogicalComponent<?> child : children) { wireInstantiator.instantiateReferenceWires(child, context); } }
@SuppressWarnings({"unchecked"}) private void instantiateChildComponents(LogicalCompositeComponent component, Composite composite, InstantiationContext context) { // create the child components List<LogicalComponent<?>> children = new ArrayList<>(); for (Component<? extends Implementation<?>> child : composite.getComponents().values()) { LogicalComponent<?> childComponent = atomicInstantiator.instantiate(child, component, context); component.addComponent(childComponent); children.add(childComponent); } // resolve the reference wires after the children have been instantiated and added to the parent, otherwise targets will not resolve for (LogicalComponent<?> child : children) { wireInstantiator.instantiateReferenceWires(child, context); } }
/** * Instantiates components in included composites. * * @param composite the root composite to instantiate * @param newComponents the collection to hold instantiated components * @param synthetic true if the root composite is synthetic * @param domain the domain * @param context the instantiation context */ private void instantiateIncludes(Composite composite, List<LogicalComponent<?>> newComponents, boolean synthetic, LogicalCompositeComponent domain, InstantiationContext context) { // instantiate the included components for (Include include : composite.getIncludes().values()) { for (Component<? extends Implementation<?>> definition : include.getIncluded().getComponents().values()) { LogicalComponent<?> logicalComponent = instantiate(definition, domain, context); newComponents.add(logicalComponent); // add to the domain since includes starting from a deployable composite are "collapsed" to the domain level domain.addComponent(logicalComponent); } } }
@SuppressWarnings({"unchecked"}) private void instantiateChildComponents(LogicalCompositeComponent component, Composite composite, InstantiationContext context) { // create the child components List<LogicalComponent<?>> children = new ArrayList<LogicalComponent<?>>(); for (ComponentDefinition<? extends Implementation<?>> child : composite.getComponents().values()) { LogicalComponent<?> childComponent; if (child.getImplementation() instanceof CompositeImplementation) { childComponent = instantiate((ComponentDefinition<CompositeImplementation>) child, component, context); } else { childComponent = atomicInstantiator.instantiate(child, component, context); } component.addComponent(childComponent); children.add(childComponent); } // resolve the reference wires after the children have been instantiated and added to the parent, otherwise targets will not resolve for (LogicalComponent<?> child : children) { wireInstantiator.instantiateReferenceWires(child, context); } }
/** * Instantiates components in included composites. * * @param composite the root composite to instantiate * @param newComponents the collection to hold instantiated components * @param synthetic true if the root composite is synthetic * @param domain the domain * @param context the instantiation context */ private void instantiateIncludes(Composite composite, List<LogicalComponent<?>> newComponents, boolean synthetic, LogicalCompositeComponent domain, InstantiationContext context) { // instantiate the included components for (Include include : composite.getIncludes().values()) { for (Component<? extends Implementation<?>> definition : include.getIncluded().getComponents().values()) { LogicalComponent<?> logicalComponent = instantiate(definition, domain, context); newComponents.add(logicalComponent); // add to the domain since includes starting from a deployable composite are "collapsed" to the domain level domain.addComponent(logicalComponent); } } }
domain.addComponent(logicalComponent);
public LogicalComponent<CompositeImplementation> instantiate(Component<CompositeImplementation> component, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + component.getName()); Composite composite = Composite.class.cast(component.getComponentType()); LogicalCompositeComponent logicalComponent = new LogicalCompositeComponent(uri, component, parent); initializeProperties(logicalComponent, component, context); instantiateChildComponents(logicalComponent, composite, context); wireInstantiator.instantiateCompositeWires(composite, logicalComponent, context); instantiateResources(logicalComponent, composite); wireInstantiator.instantiateCompositeWires(composite, logicalComponent, context); if (channelInstantiator != null) { channelInstantiator.instantiateChannels(composite, logicalComponent, context); } if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(logicalComponent); return logicalComponent; }
public LogicalComponent<CompositeImplementation> instantiate(Component<CompositeImplementation> component, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + component.getName()); Composite composite = Composite.class.cast(component.getComponentType()); LogicalCompositeComponent logicalComponent = new LogicalCompositeComponent(uri, component, parent); initializeProperties(logicalComponent, component, context); instantiateChildComponents(logicalComponent, composite, context); wireInstantiator.instantiateCompositeWires(composite, logicalComponent, context); instantiateResources(logicalComponent, composite); wireInstantiator.instantiateCompositeWires(composite, logicalComponent, context); if (channelInstantiator != null) { channelInstantiator.instantiateChannels(composite, logicalComponent, context); } if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(logicalComponent); return logicalComponent; }
@SuppressWarnings({"unchecked"}) public LogicalComponent instantiate(Component<?> component, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + component.getName()); LogicalComponent<?> logicalComponent = new LogicalComponent(uri, component, parent); if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(logicalComponent); ComponentType componentType = component.getComponentType(); if (componentType == null) { return logicalComponent; } initializeProperties(logicalComponent, component, context); createServices(component, logicalComponent, componentType); createReferences(component, logicalComponent, componentType); createProducers(component, logicalComponent, componentType); createConsumers(component, logicalComponent, componentType); createResourceReferences(logicalComponent, componentType); return logicalComponent; }
@SuppressWarnings({"unchecked"}) public LogicalComponent instantiate(Component<?> component, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + component.getName()); LogicalComponent<?> logicalComponent = new LogicalComponent(uri, component, parent); if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(logicalComponent); ComponentType componentType = component.getComponentType(); if (componentType == null) { return logicalComponent; } initializeProperties(logicalComponent, component, context); createServices(component, logicalComponent, componentType); createReferences(component, logicalComponent, componentType); createProducers(component, logicalComponent, componentType); createConsumers(component, logicalComponent, componentType); createResourceReferences(logicalComponent, componentType); return logicalComponent; }
@SuppressWarnings({"unchecked"}) public LogicalComponent instantiate(ComponentDefinition<?> definition, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + definition.getName()); LogicalComponent<?> component = new LogicalComponent(uri, definition, parent); if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(component); Implementation<?> impl = definition.getImplementation(); if (impl == null) { return component; } ComponentType componentType = impl.getComponentType(); if (componentTypeOverride) { // SCA policy conformance: override policy sets configured on the component type component.getPolicySets().removeAll(definition.getPolicySets()); } initializeProperties(component, definition, context); createServices(definition, component, componentType); createReferences(definition, component, componentType); createProducers(definition, component, componentType); createConsumers(definition, component, componentType); createResourceReferences(component, componentType); return component; }
public LogicalComponent<CompositeImplementation> instantiate(ComponentDefinition<CompositeImplementation> definition, LogicalCompositeComponent parent, InstantiationContext context) { URI uri = URI.create(parent.getUri() + "/" + definition.getName()); Composite composite = definition.getImplementation().getComponentType(); LogicalCompositeComponent component = new LogicalCompositeComponent(uri, definition, parent); if (componentTypeOverride) { // SCA policy conformance: override policy sets configured on the component type component.getPolicySets().removeAll(definition.getPolicySets()); } initializeProperties(component, definition, context); instantiateChildComponents(component, composite, context); instantiateCompositeServices(component, composite); wireInstantiator.instantiateCompositeWires(composite, component, context); instantiateCompositeReferences(component, composite); instantiateResources(component, composite); wireInstantiator.instantiateCompositeWires(composite, component, context); if (channelInstantiator != null) { channelInstantiator.instantiateChannels(composite, component, context); } if (parent.getComponent(uri) != null) { DuplicateComponent error = new DuplicateComponent(uri, parent); context.addError(error); } parent.addComponent(component); return component; }