public IntegrationDeploymentState getTargetState() { return deployment.getTargetState(); } }
public IntegrationDeploymentState getTargetState() { return deployment.map(x -> x.getTargetState()).orElse(Unpublished); }
private String getIntegrationMarkerKey(IntegrationDeployment integrationDeployment) { return integrationDeployment.getTargetState() + ":" + integrationDeployment.getId().orElseThrow(() -> new IllegalArgumentException("No id set in integration " + integrationDeployment)); }
private String getIntegrationMarkerKey(IntegrationDeployment integrationDeployment) { return integrationDeployment.getTargetState() + ":" + integrationDeployment.getId().orElseThrow(() -> new IllegalArgumentException("No id set in integration " + integrationDeployment)); }
private boolean stale(StateChangeHandler handler, IntegrationDeployment integrationDeployment) { if (integrationDeployment == null || handler == null) { return true; } IntegrationDeploymentState desiredState = integrationDeployment.getTargetState(); return desiredState.equals(integrationDeployment.getCurrentState()); } }
private boolean stale(StateChangeHandler handler, IntegrationDeployment integrationDeployment) { if (integrationDeployment == null || handler == null) { return true; } IntegrationDeploymentState desiredState = integrationDeployment.getTargetState(); return desiredState.equals(integrationDeployment.getCurrentState()); } }
private boolean isIntegrationActiveAndUsingExtension(IntegrationDeployment integrationDeployment, Extension extension) { if (integrationDeployment == null || extension == null) { return false; } if (IntegrationDeploymentState.Published != integrationDeployment.getTargetState()) { return false; } return integrationDeployment.getSpec().getSteps().stream().anyMatch(step -> { boolean usedAsStep = extension.getExtensionId().equals( Optional.ofNullable(step) .flatMap(Step::getExtension) .map(Extension::getExtensionId) .orElse(null) ); boolean usedAsConnector = extension.getExtensionId().equals( Optional.ofNullable(step) .flatMap(Step::getConnection) .flatMap(Connection::getConnector) .flatMap(c -> c.getDependencies().stream().filter(Dependency::isExtension).findFirst()) .map(Dependency::getId) .orElse(null) ); return usedAsStep || usedAsConnector; }); }
private void checkIntegrationStatus(IntegrationDeployment integrationDeployment) { if (integrationDeployment == null) { return; } IntegrationDeploymentState desiredState = integrationDeployment.getTargetState(); IntegrationDeploymentState currentState = integrationDeployment.getCurrentState(); if (!currentState.equals(desiredState)) { integrationDeployment.getId().ifPresent(integrationDeploymentId -> { StateChangeHandler statusChangeHandler = handlers.get(desiredState); if (statusChangeHandler != null) { LOG.info("Integration {} : Desired status \"{}\" != current status \"{}\" --> calling status change handler", integrationDeploymentId, desiredState.toString(), currentState); callStateChangeHandler(statusChangeHandler, integrationDeploymentId); } }); } else { scheduledChecks.remove(getIntegrationMarkerKey(integrationDeployment)); } }
private void checkIntegrationStatus(IntegrationDeployment integrationDeployment) { if (integrationDeployment == null) { return; } IntegrationDeploymentState desiredState = integrationDeployment.getTargetState(); IntegrationDeploymentState currentState = integrationDeployment.getCurrentState(); if (!currentState.equals(desiredState)) { integrationDeployment.getId().ifPresent(integrationDeploymentId -> { StateChangeHandler statusChangeHandler = handlers.get(desiredState); if (statusChangeHandler != null) { LOG.info("Integration {} : Desired status \"{}\" != current status \"{}\" --> calling status change handler", integrationDeploymentId, desiredState.toString(), currentState); callStateChangeHandler(statusChangeHandler, integrationDeploymentId); } }); } else { scheduledChecks.remove(getIntegrationMarkerKey(integrationDeployment)); } }