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); } }
private void containsIntents(List<String> intentArgs, LogicalComponent<?> component, Set<LogicalScaArtifact> artifacts) { if (containsIntents(intentArgs, component.getDefinition().getImplementation().getIntents())) { artifacts.add(component); } if (containsIntents(intentArgs, component.getDefinition().getIntents())) { artifacts.add(component); } if (containsIntents(intentArgs, component.getIntents())) { artifacts.add(component); } for (LogicalService service : component.getServices()) { if (containsIntents(intentArgs, service.getIntents())) { artifacts.add(service); } } for (LogicalReference reference : component.getReferences()) { if (containsIntents(intentArgs, reference.getIntents())) { artifacts.add(reference); } } if (component instanceof LogicalCompositeComponent) { LogicalCompositeComponent composite = (LogicalCompositeComponent) component; for (LogicalComponent<?> childComponent : composite.getComponents()) { containsIntents(intentArgs, childComponent, artifacts); } } }
/** * 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; }
if (containsTransactionIntent(parent.getIntents())) { return true;
processIntents(parent.getIntents(), aggregatedIntents); ComponentDefinition<? extends Implementation<?>> definition = parent.getDefinition(); if (definition != null) {
processIntents(parent.getIntents(), aggregatedIntents);