private void resolveServices(LogicalComponent<?> component, InstantiationContext context) { for (LogicalService logicalService : component.getServices()) { resolve(logicalService, context); } }
private void normalizeServicePromotions(LogicalComponent<?> component, InstantiationContext context) { for (LogicalService service : component.getServices()) { LinkedList<LogicalService> services = new LinkedList<LogicalService>(); // add the leaf service as the last element services.add(service); getPromotionHierarchy(service, services); if (services.isEmpty()) { continue; } processServicePromotions(services, context); } }
private void processComponent(LogicalComponent<?> component, QName policySet, boolean incremental) { // do not mark the component as new, just the wires since the implementation does not need to be reprovisioned for (LogicalReference reference : component.getReferences()) { processReference(reference, policySet, incremental); } for (LogicalService service : component.getServices()) { processService(service, policySet, incremental); } }
private void processDetachComponent(LogicalComponent<?> component, QName policySet, boolean incremental) { // do not mark the component as new, just the wires since the implementation does not need to be reprovisioned for (LogicalReference reference : component.getReferences()) { processDetachReference(reference, policySet, incremental); } for (LogicalService service : component.getServices()) { processDetachService(service, policySet, incremental); } }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent) { return Optional.empty(); } // determine if a binding is being added or removed. If so, an AttachWireCommand or DetachWireCommand must be generated. boolean bindingChange = false; for (LogicalService service : component.getServices()) { for (LogicalBinding<?> binding : service.getBindings()) { if (binding.getState() == LogicalState.NEW || binding.getState() == LogicalState.MARKED) { bindingChange = true; break; } } } if (LogicalState.PROVISIONED == component.getState() && !bindingChange) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); generatePhysicalWires(component, command); if (command.getAttachCommands().isEmpty() && command.getDetachCommands().isEmpty()) { return Optional.empty(); } return Optional.of(command); }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent) { return Optional.empty(); } // determine if a binding is being added or removed. If so, an AttachWireCommand or DetachWireCommand must be generated. boolean bindingChange = false; for (LogicalService service : component.getServices()) { for (LogicalBinding<?> binding : service.getBindings()) { if (binding.getState() == LogicalState.NEW || binding.getState() == LogicalState.MARKED) { bindingChange = true; break; } } } if (LogicalState.PROVISIONED == component.getState() && !bindingChange) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); generatePhysicalWires(component, command); if (command.getAttachCommands().isEmpty() && command.getDetachCommands().isEmpty()) { return Optional.empty(); } return Optional.of(command); }
/** * Updates the list of services with the promotion hierarchy for the given service. The list is populated in reverse order so that the leaf * (promoted) service is stored last. * * @param service the current service to ascend from * @param services the list */ private void getPromotionHierarchy(LogicalService service, LinkedList<LogicalService> services) { LogicalComponent<CompositeImplementation> parent = service.getParent().getParent(); URI serviceUri = service.getUri(); for (LogicalService promotion : parent.getServices()) { URI targetUri = promotion.getPromotedUri(); if (targetUri.getFragment() == null) { // no service specified if (targetUri.equals(UriHelper.getDefragmentedName(serviceUri))) { services.addFirst(promotion); if (parent.getParent() != null) { getPromotionHierarchy(promotion, services); } } } else { if (targetUri.equals(serviceUri)) { services.addFirst(promotion); if (parent.getParent() != null) { getPromotionHierarchy(promotion, services); } } } } }
private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new Fabric3Exception("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
component.setState(PROVISIONED); for (LogicalService service : component.getServices()) { service.getBindings().stream().filter(binding -> NEW == binding.getState()).forEach(binding -> binding.setState(PROVISIONED)); service.getCallbackBindings().stream().filter(binding -> NEW == binding.getState()).forEach(binding -> binding.setState(PROVISIONED));
private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new Fabric3Exception("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
component.setState(PROVISIONED); for (LogicalService service : component.getServices()) { service.getBindings().stream().filter(binding -> NEW == binding.getState()).forEach(binding -> binding.setState(PROVISIONED)); service.getCallbackBindings().stream().filter(binding -> NEW == binding.getState()).forEach(binding -> binding.setState(PROVISIONED));
private <S extends LogicalComponent<?>> URI generateCallbackUri(S source, ServiceContract contract, String referenceName) throws GenerationException { LogicalService candidate = null; for (LogicalService entry : source.getServices()) { MatchResult result = matcher.isAssignableFrom(contract, entry.getServiceContract(), false); if (result.isAssignable()) { candidate = entry; break; } } if (candidate == null) { String name = contract.getInterfaceName(); URI uri = source.getUri(); throw new CallbackServiceNotFoundException("Callback service not found: " + name + " on component: " + uri + " originating from reference :" + referenceName, name); } return URI.create(source.getUri().toString() + "#" + candidate.getDefinition().getName()); }
Collection<LogicalService> componentServices = promotedComponent.getServices(); if (componentServices.size() == 0) { raiseNoServiceError(logicalService, promotedComponentUri, context);
public ConnectionCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (component instanceof LogicalCompositeComponent) { return null; } // determine if a binding is being added or removed. If so, an AttachWireCommand or DetachWireCommand must be generated. boolean bindingChange = false; for (LogicalService service : component.getServices()) { for (LogicalBinding<?> binding : service.getBindings()) { if (binding.getState() == LogicalState.NEW || binding.getState() == LogicalState.MARKED) { bindingChange = true; break; } } } if (LogicalState.PROVISIONED == component.getState() && incremental && !bindingChange) { return null; } ConnectionCommand command = new ConnectionCommand(component.getUri()); generatePhysicalWires(component, command, incremental); if (command.getAttachCommands().isEmpty() && command.getDetachCommands().isEmpty()) { return null; } return command; }
private void find(String interfaceName, String operationName, LogicalComponent<?> component, List<LogicalOperation> operations) { for (LogicalService service : component.getServices()) { AbstractService definition = service.getDefinition(); ServiceContract contract = definition.getServiceContract();
for (LogicalService service : child.getServices()) { ServiceContract targetContract = service.getServiceContract(); if (targetContract == null) {
for (LogicalService service : child.getServices()) { ServiceContract targetContract = service.getServiceContract(); if (targetContract == null) {
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); } } }
for (LogicalService service : targetComponent.getServices()) { if (targetService != null) { raiseAmbiguousService(reference, target, context);
for (LogicalService service : component.getServices()) { for (LogicalBinding<?> binding : service.getBindings()) { if (isGenerate(binding.getState(), type)) {