/** * Returns the key specified on the component definition, component type, or {@link Integer#MIN_VALUE} * * @param component the component * @return the key or null */ private int getOrder(LogicalComponent component) { int order = component.getDefinition().getOrder(); if (order == Integer.MIN_VALUE) { ComponentDefinition<?> definition = component.getDefinition(); Implementation<?> implementation = definition.getImplementation(); if (implementation != null && implementation.getComponentType() != null) { order = implementation.getComponentType().getOrder(); } } return order; }
/** * Returns the key specified on the component definition, component type, or null * * @param component the component * @return the key or null */ private String getKey(LogicalComponent component) { String key = component.getDefinition().getKey(); if (key == null) { // check if the key was specified in the component type Implementation implementation = component.getDefinition().getImplementation(); if (implementation != null && implementation.getComponentType() != null) { key = implementation.getComponentType().getKey(); } } return key; }
public void visitMethod(PersistenceUnit annotation, Method method, Class<?> implClass, I implementation, IntrospectionContext context) { MethodInjectionSite site = new MethodInjectionSite(method, 0); PersistenceUnitResource definition = createDefinition(annotation); InjectingComponentType componentType = implementation.getComponentType(); componentType.add(definition, site); // record that the implementation requires JPA componentType.addRequiredCapability("jpa"); }
private boolean useByReference(LogicalOperation operation, boolean remote) { if (!passByValueEnabled || remote) { // Pass-by-value is disabled or the invocation chain is remote. Pass-by-reference semantics should be used for remote invocation chains // since the binding will enforce pass-by-value implicitly through serialization return true; } LogicalAttachPoint logicalAttachPoint = operation.getParent(); LogicalComponent<?> component = logicalAttachPoint.getParent(); return operation.getIntents().contains(ALLOWS_BY_REFERENCE) || logicalAttachPoint.getIntents().contains(ALLOWS_BY_REFERENCE) || component.getIntents().contains(ALLOWS_BY_REFERENCE) || component.getDefinition().getImplementation().getIntents().contains( ALLOWS_BY_REFERENCE) || component.getDefinition().getImplementation().getComponentType().getIntents().contains(ALLOWS_BY_REFERENCE); } }
public void visitField(PersistenceUnit annotation, Field field, Class<?> implClass, I implementation, IntrospectionContext context) { FieldInjectionSite site = new FieldInjectionSite(field); PersistenceUnitResource definition = createDefinition(annotation); InjectingComponentType componentType = implementation.getComponentType(); componentType.add(definition, site); // record that the implementation requires JPA componentType.addRequiredCapability("jpa"); }
public void visitField(PersistenceContext annotation, Field field, Class<?> implClass, I implementation, IntrospectionContext context) { FieldInjectionSite site = new FieldInjectionSite(field); InjectingComponentType componentType = implementation.getComponentType(); PersistenceContextResource definition = createDefinition(annotation, componentType); componentType.add(definition, site); // record that the implementation requires JPA componentType.addRequiredCapability("jpa"); }
public void visitMethod(PersistenceContext annotation, Method method, Class<?> implClass, I implementation, IntrospectionContext context) { MethodInjectionSite site = new MethodInjectionSite(method, 0); InjectingComponentType componentType = implementation.getComponentType(); PersistenceContextResource definition = createDefinition(annotation, componentType); componentType.add(definition, site); // record that the implementation requires JPA componentType.addRequiredCapability("jpa"); }
private void validateRequiredProperties(ComponentDefinition<? extends Implementation<?>> definition, XMLStreamReader reader, IntrospectionContext context) { AbstractComponentType<?, ?, ?, ?> type = definition.getImplementation().getComponentType(); Map<String, ? extends Property> properties = type.getProperties(); Map<String, PropertyValue> values = definition.getPropertyValues(); for (Property property : properties.values()) { if (property.isRequired() && !values.containsKey(property.getName())) { RequiredPropertyNotProvided failure = new RequiredPropertyNotProvided(property, definition.getName(), reader); context.addError(failure); } } }
if (impl == null || impl.getComponentType() == null) { AbstractComponentType<?, ?, ?, ?> componentType = impl.getComponentType();
private void processPropertyValues(LogicalComponent<?> component, SpringComponentDefinition physical) { for (LogicalProperty property : component.getAllProperties().values()) { Document document = property.getValue(); if (document != null) { String name = property.getName(); boolean many = property.isMany(); ComponentType componentType = component.getDefinition().getImplementation().getComponentType(); QName type = componentType.getProperties().get(property.getName()).getType(); PhysicalPropertyDefinition definition = new PhysicalPropertyDefinition(name, document, many, type); physical.setPropertyDefinition(definition); } } }
ComponentType componentType = impl.getComponentType(); Set<Contribution> extensions = new HashSet<Contribution>(); if (isGenerate(component.getState(), type)) {
@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; }