-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add miranum deployment to the example
- Loading branch information
Showing
10 changed files
with
186 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...in/java/io/miranum/platform/example/adapter/out/deployment/DeploymentReceiverAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.miranum.platform.example.adapter.out.deployment; | ||
|
||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.application.ports.out.MiranumDeploymentReceiver; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import io.miranum.platform.example.adapter.out.deployment.handler.DeploymentHandler; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class DeploymentReceiverAdapter implements MiranumDeploymentReceiver { | ||
|
||
private final List<DeploymentHandler> deploymentHandlers; | ||
|
||
@Override | ||
public void deploy(final Deployment deployment) { | ||
this.deploymentHandlers.stream() | ||
.filter(handler -> handler.isResponsibleFor(deployment.getType())) | ||
.findFirst() | ||
.ifPresentOrElse(handler -> handler.deployArtifact(deployment), () -> { | ||
throw new DeploymentFailedException("No handler found for deployment type " + deployment.getType()); | ||
}); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
...ava/io/miranum/platform/example/adapter/out/deployment/handler/BpmnDeploymentHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.miranum.platform.example.adapter.out.deployment.handler; | ||
|
||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class BpmnDeploymentHandler implements DeploymentHandler { | ||
@Override | ||
public boolean isResponsibleFor(final String artifactType) { | ||
return artifactType.equalsIgnoreCase("bpmn"); | ||
} | ||
|
||
@Override | ||
public void deployArtifact(final Deployment artifact) throws DeploymentFailedException { | ||
// TODO implement me | ||
log.info("Deploy file {} of type {} to namespace {} with tags {}", | ||
artifact.getFilename(), artifact.getType(), artifact.getNamespace(), artifact.getTags()); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...ranum/platform/example/adapter/out/deployment/handler/ConfigurationDeploymentHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.miranum.platform.example.adapter.out.deployment.handler; | ||
|
||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class ConfigurationDeploymentHandler implements DeploymentHandler { | ||
|
||
private final ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
@Override | ||
public boolean isResponsibleFor(final String artifactType) { | ||
return artifactType.equalsIgnoreCase("config"); | ||
} | ||
|
||
@Override | ||
public void deployArtifact(final Deployment artifact) throws DeploymentFailedException { | ||
// TODO implement me | ||
log.info("Deploy file {} of type {} to namespace {} with tags {}", | ||
artifact.getFilename(), artifact.getType(), artifact.getNamespace(), artifact.getTags()); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...in/java/io/miranum/platform/example/adapter/out/deployment/handler/DeploymentHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.miranum.platform.example.adapter.out.deployment.handler; | ||
|
||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
|
||
/** | ||
* Handle deployment for specific types | ||
*/ | ||
public interface DeploymentHandler { | ||
|
||
boolean isResponsibleFor(String artifactType); | ||
|
||
void deployArtifact(final Deployment artifact) throws DeploymentFailedException; | ||
|
||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...java/io/miranum/platform/example/adapter/out/deployment/handler/DmnDeploymentHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.miranum.platform.example.adapter.out.deployment.handler; | ||
|
||
|
||
import io.miranum.platform.deploymentreceiver.application.DeploymentFailedException; | ||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class DmnDeploymentHandler implements DeploymentHandler { | ||
|
||
@Override | ||
public boolean isResponsibleFor(final String artifactType) { | ||
return artifactType.equalsIgnoreCase("dmn"); | ||
} | ||
|
||
@Override | ||
public void deployArtifact(Deployment artifact) throws DeploymentFailedException { | ||
// TODO implement me | ||
log.info("Deploy file {} of type {} to namespace {} with tags {}", | ||
artifact.getFilename(), artifact.getType(), artifact.getNamespace(), artifact.getTags()); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...ava/io/miranum/platform/example/adapter/out/deployment/handler/FormDeploymentHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.miranum.platform.example.adapter.out.deployment.handler; | ||
|
||
|
||
import io.miranum.platform.deploymentreceiver.domain.Deployment; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class FormDeploymentHandler implements DeploymentHandler { | ||
|
||
@Override | ||
public boolean isResponsibleFor(final String artifactType) { | ||
return artifactType.equalsIgnoreCase("form"); | ||
} | ||
|
||
@Override | ||
public void deployArtifact(final Deployment artifact) { | ||
// TODO implement me | ||
log.info("Deploy file {} of type {} to namespace {} with tags {}", | ||
artifact.getFilename(), artifact.getType(), artifact.getNamespace(), artifact.getTags()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters