/** * Gets the component type. * * @return Component type. */ public ComponentType getComponentType() { return implementation != null ? getImplementation().getComponentType() : null; }
private Set<Intent> getRequestedIntents(LogicalComponent<?> logicalComponent, LogicalOperation operation) throws PolicyResolutionException { // Aggregate all the intents from the ancestors Set<QName> intentNames = new LinkedHashSet<>(); intentNames.addAll(operation.getIntents()); ComponentDefinition<? extends Implementation<?>> definition = logicalComponent.getDefinition(); Implementation<?> implementation = definition.getImplementation(); ComponentType componentType = implementation.getComponentType(); intentNames.addAll(implementation.getIntents()); intentNames.addAll(componentType.getIntents()); intentNames.addAll(aggregateIntents(logicalComponent)); // Expand all the profile intents Set<Intent> requiredIntents = resolveIntents(intentNames); // Remove intents not applicable to the artifact filterInvalidIntents(Intent.IMPLEMENTATION, requiredIntents); filterMutuallyExclusiveIntents(requiredIntents); return requiredIntents; }
/** * Aggregate intents from ancestors of a component. Components are handled differently than other SCA artifacts as implementation intents are inherited. * * @param component the logical artifact to aggregate intents for * @return the aggregated intents */ protected Set<QName> aggregateIntents(LogicalComponent<?> component) { LogicalComponent<?> current = component; Set<QName> aggregatedIntents = new LinkedHashSet<>(); while (current != null) { Set<QName> currentIntents = current.getIntents(); processIntents(currentIntents, aggregatedIntents); ComponentDefinition<? extends Implementation<?>> definition = current.getDefinition(); if (definition != null) { processIntents(definition.getIntents(), aggregatedIntents); Implementation<?> implementation = definition.getImplementation(); if (implementation != null) { processIntents(implementation.getIntents(), aggregatedIntents); ComponentType componentType = implementation.getComponentType(); if (componentType != null) { processIntents(componentType.getIntents(), aggregatedIntents); } } } current = current.getParent(); } return aggregatedIntents; }
private void processPropertyValues(LogicalComponent<?> component, PhysicalSpringComponent springComponent) { for (LogicalProperty property : component.getAllProperties().values()) { String name = property.getName(); boolean many = property.isMany(); if (property.getXmlValue() != null) { Document document = property.getXmlValue(); ComponentType componentType = component.getDefinition().getImplementation().getComponentType(); QName type = componentType.getProperties().get(property.getName()).getType(); PhysicalProperty physicalProperty = PhysicalProperty.Builder.newBuilder(name).xmlValue(document).many(many).type(type).build(); springComponent.setProperty(physicalProperty); } else if (property.getInstanceValue() != null) { Object value = property.getInstanceValue(); PhysicalProperty physicalProperty = PhysicalProperty.Builder.newBuilder(name).instanceValue(value).many(many).build(); springComponent.setProperty(physicalProperty); } } }
private void processPropertyValues(LogicalComponent<?> component, PhysicalSpringComponent springComponent) { for (LogicalProperty property : component.getAllProperties().values()) { String name = property.getName(); boolean many = property.isMany(); if (property.getXmlValue() != null) { Document document = property.getXmlValue(); ComponentType componentType = component.getDefinition().getImplementation().getComponentType(); QName type = componentType.getProperties().get(property.getName()).getType(); PhysicalProperty physicalProperty = PhysicalProperty.Builder.newBuilder(name).xmlValue(document).many(many).type(type).build(); springComponent.setProperty(physicalProperty); } else if (property.getInstanceValue() != null) { Object value = property.getInstanceValue(); PhysicalProperty physicalProperty = PhysicalProperty.Builder.newBuilder(name).instanceValue(value).many(many).build(); springComponent.setProperty(physicalProperty); } } }
if (implementation != null) { processIntents(implementation.getIntents(), aggregatedIntents); ComponentType componentType = implementation.getComponentType(); if (componentType != null) { processIntents(componentType.getIntents(), aggregatedIntents);
if (implementation != null) { processIntents(implementation.getIntents(), aggregatedIntents); ComponentType componentType = implementation.getComponentType(); if (componentType != null) { processIntents(componentType.getIntents(), aggregatedIntents);
metadata.addAll(parentImplementation.getMetadata()); metadata.addAll(parentImplementation.getComponentType().getMetadata());