private void processReference(LogicalReference reference, QName policySet, boolean incremental) { for (LogicalWire wire : reference.getWires()) { wire.setState(LogicalState.NEW); } for (LogicalBinding<?> binding : reference.getBindings()) { if (incremental && binding.getPolicySets().contains(policySet)) { continue; } binding.setState(LogicalState.NEW); } }
private void processDetachReference(LogicalReference reference, QName policySet, boolean incremental) { for (LogicalWire wire : reference.getWires()) { wire.setState(LogicalState.NEW); } for (LogicalBinding<?> binding : reference.getBindings()) { if (incremental && !binding.getPolicySets().contains(policySet)) { continue; } binding.setState(LogicalState.NEW); } }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalReference reference : component.getReferences()) { if (!reference.getWires().isEmpty()) { generateWires(reference, command); } else { generateBindings(reference, 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(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalReference reference : component.getReferences()) { if (!reference.getWires().isEmpty()) { generateWires(reference, command); } else { generateBindings(reference, component, command); } } if (command.getAttachCommands().isEmpty() && command.getDetachCommands().isEmpty()) { return Optional.empty(); } return Optional.of(command); }
public ConnectionCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (component instanceof LogicalCompositeComponent) { return null; } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalReference reference : component.getReferences()) { if (!reference.getWires().isEmpty()) { generateWires(reference, command, incremental); } else { generateBindings(reference, component, incremental, command); } } if (command.getAttachCommands().isEmpty() && command.getDetachCommands().isEmpty()) { return null; } return command; }
for (LogicalWire wire : reference.getWires()) {
/** * Selects and configures bindings for wires sourced from the given component. * * @param component the component * @throws BindingSelectionException if an error occurs selecting a binding */ private void selectBindings(LogicalComponent<?> component) throws BindingSelectionException { for (LogicalReference reference : component.getReferences()) { for (LogicalWire wire : reference.getWires()) { LogicalService targetService = wire.getTarget(); if (targetService != null) { LogicalComponent<?> targetComponent = targetService.getParent(); if ((LOCAL_ZONE.equals(component.getZone()) && LOCAL_ZONE.equals(targetComponent.getZone()))) { // components are local, no need for a binding continue; } else if (!LOCAL_ZONE.equals(component.getZone()) && component.getZone().equals(targetComponent.getZone())) { // components are local, no need for a binding continue; } selectBinding(wire); } } } }
List<LogicalWire> existingWires = reference.getWires(); for (LogicalWire wire : existingWires) { if (wire.isReplaces()) {
private boolean isWireReinjection(LogicalReference logicalReference) { Multiplicity multiplicity = logicalReference.getDefinition().getMultiplicity(); if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { for (LogicalWire wire : logicalReference.getWires()) { LogicalComponent<?> targetComponent = wire.getTarget().getParent(); // check the source and target sides since a target may have been added or removed if (wire.getState() == LogicalState.NEW || wire.getState() == LogicalState.MARKED || targetComponent.getState() == LogicalState.NEW || targetComponent.getState() == LogicalState.MARKED) { return true; } } } return false; }
private boolean isWireReinjection(LogicalReference logicalReference, boolean incremental) { Multiplicity multiplicity = logicalReference.getDefinition().getMultiplicity(); if (incremental && multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { for (LogicalWire wire : logicalReference.getWires()) { LogicalComponent<?> targetComponent = wire.getTarget().getLeafComponent(); // check the source and target sides since a target may have been added or removed if (wire.getState() == LogicalState.NEW || wire.getState() == LogicalState.MARKED || targetComponent.getState() == LogicalState.NEW || targetComponent.getState() == LogicalState.MARKED) { return true; } } } return false; }
private boolean isWireReinjection(LogicalReference logicalReference) { Multiplicity multiplicity = logicalReference.getDefinition().getMultiplicity(); if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { for (LogicalWire wire : logicalReference.getWires()) { LogicalComponent<?> targetComponent = wire.getTarget().getParent(); // check the source and target sides since a target may have been added or removed if (wire.getState() == LogicalState.NEW || wire.getState() == LogicalState.MARKED || targetComponent.getState() == LogicalState.NEW || targetComponent.getState() == LogicalState.MARKED) { return true; } } } return false; }
boolean targeted = !logicalReference.getWires().isEmpty(); if (!targeted && reference.isRequired() && !logicalReference.isBound()) { String referenceUri = logicalReference.getUri().toString();
boolean targeted = !logicalReference.getWires().isEmpty(); if (!targeted && reference.isRequired() && !logicalReference.isBound()) { String referenceUri = logicalReference.getUri().toString();
private <S, I extends S> LogicalComponent<?> createLogicalComponent(String name, Class<S> type, I instance, boolean introspect) throws InvalidServiceContractException, AssemblyException { LogicalCompositeComponent domain = lcm.getDomainComposite(); Component<Implementation<?>> definition = createDefinition(name, type, instance, introspect); InstantiationContext context = new InstantiationContext(); LogicalComponent<?> logical = instantiator.instantiate(definition, domain, context); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } // mark singleton components as provisioned since instances are not created logical.setState(LogicalState.PROVISIONED); // all references are initially resolved since they are manually injected for (LogicalReference reference : logical.getReferences()) { reference.setResolved(true); for (LogicalWire wire : reference.getWires()) { wire.setState(LogicalState.PROVISIONED); } } return logical; }
private <S, I extends S> LogicalComponent<?> createLogicalComponent(String name, Class<S> type, I instance, boolean introspect) throws InvalidServiceContractException, AssemblyException { LogicalCompositeComponent domain = lcm.getDomainComposite(); Component<Implementation<?>> definition = createDefinition(name, type, instance, introspect); InstantiationContext context = new InstantiationContext(); LogicalComponent<?> logical = instantiator.instantiate(definition, domain, context); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } // mark singleton components as provisioned since instances are not created logical.setState(LogicalState.PROVISIONED); // all references are initially resolved since they are manually injected for (LogicalReference reference : logical.getReferences()) { reference.setResolved(true); for (LogicalWire wire : reference.getWires()) { wire.setState(LogicalState.PROVISIONED); } } return logical; }
boolean targeted = !logicalReference.getLeafReference().getWires().isEmpty(); if (!targeted && logicalReference.getDefinition().isRequired() && !logicalReference.isConcreteBound()) { String referenceUri = logicalReference.getUri().toString();
private <S, I extends S> LogicalComponent<?> createLogicalComponent(String name, Class<S> type, I instance, boolean introspect) throws InvalidServiceContractException, AssemblyException { LogicalCompositeComponent domain = lcm.getRootComponent(); ComponentDefinition<Implementation<?>> definition = createDefinition(name, type, instance, introspect); InstantiationContext context = new InstantiationContext(); LogicalComponent<?> logical = instantiator.instantiate(definition, domain, context); logical.setAutowire(domain.getAutowire()); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } // mark singleton components as provisioned since instances are not created logical.setState(LogicalState.PROVISIONED); // all references are initially resolved since they are manually injected for (LogicalReference reference : logical.getReferences()) { reference.setResolved(true); for (LogicalWire wire : reference.getWires()) { wire.setState(LogicalState.PROVISIONED); } } return logical; }
for (LogicalWire wire : reference.getWires()) { LogicalService service = wire.getTarget(); LogicalComponent<?> targetComponent = service.getLeafComponent();
for (LogicalWire wire : reference.getWires()) { LogicalService service = wire.getTarget(); LogicalComponent<?> targetComponent = service.getParent();
for (LogicalWire wire : reference.getWires()) { LogicalService service = wire.getTarget(); LogicalComponent<?> targetComponent = service.getParent();