@SuppressWarnings("unchecked") public Optional<StopComponentCommand> generate(LogicalComponent<?> component) throws Fabric3Exception { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { return Optional.of(new StopComponentCommand(component.getUri())); } return Optional.empty(); } }
public Optional<DisposeComponentCommand> generate(LogicalComponent<?> component) { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { PhysicalComponent physicalComponent = generateDefinition(component); return Optional.of(new DisposeComponentCommand(physicalComponent)); } return Optional.empty(); } }
public Optional<BuildComponentCommand> generate(LogicalComponent<?> component) { if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW)) { PhysicalComponent physicalComponent = generateDefinition(component); return Optional.of(new BuildComponentCommand(physicalComponent)); } return Optional.empty(); } }
public Optional<DisposeComponentCommand> generate(LogicalComponent<?> component) { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { PhysicalComponent physicalComponent = generateDefinition(component); return Optional.of(new DisposeComponentCommand(physicalComponent)); } return Optional.empty(); } }
public Optional<BuildComponentCommand> generate(LogicalComponent<?> component) { if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW)) { PhysicalComponent physicalComponent = generateDefinition(component); return Optional.of(new BuildComponentCommand(physicalComponent)); } return Optional.empty(); } }
@SuppressWarnings("unchecked") public Optional<StartComponentCommand> generate(LogicalComponent<?> component) { // start a component if it is atomic and not provisioned if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW)) { return Optional.of(new StartComponentCommand(component.getUri())); } return Optional.empty(); } }
@SuppressWarnings("unchecked") public Optional<StartComponentCommand> generate(LogicalComponent<?> component) { // start a component if it is atomic and not provisioned if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW)) { return Optional.of(new StartComponentCommand(component.getUri())); } return Optional.empty(); } }
@SuppressWarnings("unchecked") public Optional<StopComponentCommand> generate(LogicalComponent<?> component) throws Fabric3Exception { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { return Optional.of(new StopComponentCommand(component.getUri())); } return Optional.empty(); } }
public List<Command> generate(List<LogicalComponent<?>> components) throws Fabric3Exception { List<Command> commands = new ArrayList<>(); components.stream().filter(component -> component.getState() == LogicalState.MARKED).forEach(component -> { URI uri = component.getDefinition().getContributionUri(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StopContextCommand command = new StopContextCommand(uri, log); if (!commands.contains(command)) { commands.add(command); } }); return commands; }
public List<Command> generate(List<LogicalComponent<?>> components) throws Fabric3Exception { List<Command> commands = new ArrayList<>(); components.stream().filter(component -> component.getState() == LogicalState.NEW).forEach(component -> { URI uri = component.getDefinition().getContributionUri(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StartContextCommand command = new StartContextCommand(uri, log); if (!commands.contains(command)) { commands.add(command); } }); return commands; }
public List<Command> generate(List<LogicalComponent<?>> components) throws Fabric3Exception { List<Command> commands = new ArrayList<>(); components.stream().filter(component -> component.getState() == LogicalState.NEW).forEach(component -> { URI uri = component.getDefinition().getContributionUri(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StartContextCommand command = new StartContextCommand(uri, log); if (!commands.contains(command)) { commands.add(command); } }); return commands; }
public List<Command> generate(List<LogicalComponent<?>> components) throws Fabric3Exception { List<Command> commands = new ArrayList<>(); components.stream().filter(component -> component.getState() == LogicalState.MARKED).forEach(component -> { URI uri = component.getDefinition().getContributionUri(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StopContextCommand command = new StopContextCommand(uri, log); if (!commands.contains(command)) { commands.add(command); } }); return commands; }
public BuildComponentCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW || !incremental)) { PhysicalComponentDefinition definition = generateDefinition(component); return new BuildComponentCommand(definition); } return null; } }
@SuppressWarnings("unchecked") public StopComponentCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { return new StopComponentCommand(component.getUri()); } return null; } }
public DisposeComponentCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (!(component instanceof LogicalCompositeComponent) && component.getState() == LogicalState.MARKED) { PhysicalComponentDefinition definition = generateDefinition(component); return new DisposeComponentCommand(definition); } return null; } }
@SuppressWarnings("unchecked") public StartComponentCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { // start a component if it is atomic and not provisioned if (!(component instanceof LogicalCompositeComponent) && (component.getState() == LogicalState.NEW || !incremental)) { return new StartComponentCommand(component.getUri()); } return null; } }
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; }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent || component.getResourceReferences().isEmpty() || (component.getState() != LogicalState.NEW)) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalResourceReference<?> resourceReference : component.getResourceReferences()) { AttachWireCommand attachWireCommand = new AttachWireCommand(); PhysicalWire physicalWire = wireGenerator.generateResource(resourceReference); attachWireCommand.setPhysicalWireDefinition(physicalWire); command.add(attachWireCommand); } return Optional.of(command); }
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; }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent || component.getResourceReferences().isEmpty() || (component.getState() != LogicalState.NEW)) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalResourceReference<?> resourceReference : component.getResourceReferences()) { AttachWireCommand attachWireCommand = new AttachWireCommand(); PhysicalWire physicalWire = wireGenerator.generateResource(resourceReference); attachWireCommand.setPhysicalWireDefinition(physicalWire); command.add(attachWireCommand); } return Optional.of(command); }