Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init integration api with commands, model and plugin interface
- Loading branch information
1 parent
6cab2ab
commit 2e94a0d
Showing
32 changed files
with
1,135 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.gravitee</groupId> | ||
<artifactId>gravitee-parent</artifactId> | ||
<version>22.0.14</version> | ||
</parent> | ||
|
||
<groupId>io.gravitee.integration</groupId> | ||
<artifactId>gravitee-integration-api</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<name>Gravitee.io Integration - API</name> | ||
|
||
<properties> | ||
<gravitee-bom.version>7.0.4</gravitee-bom.version> | ||
<gravitee-common.version>3.3.3</gravitee-common.version> | ||
<gravitee-exchange.version>1.0.0-alpha.4</gravitee-exchange.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!-- Import bom to properly inherit all dependencies --> | ||
<dependency> | ||
<groupId>io.gravitee</groupId> | ||
<artifactId>gravitee-bom</artifactId> | ||
<version>${gravitee-bom.version}</version> | ||
<scope>import</scope> | ||
<type>pom</type> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.gravitee.exchange</groupId> | ||
<artifactId>gravitee-exchange-api</artifactId> | ||
<version>${gravitee-exchange.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.gravitee.common</groupId> | ||
<artifactId>gravitee-common</artifactId> | ||
<version>${gravitee-common.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.reactivex.rxjava3</groupId> | ||
<artifactId>rxjava</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Spring dependencies --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.vertx</groupId> | ||
<artifactId>vertx-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
32 changes: 32 additions & 0 deletions
32
src/main/java/io/gravitee/integration/api/command/IntegrationCommand.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,32 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.integration.api.command; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.gravitee.exchange.api.command.Command; | ||
import io.gravitee.exchange.api.command.Payload; | ||
|
||
/** | ||
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public abstract class IntegrationCommand<P extends Payload> extends Command<P> { | ||
|
||
protected IntegrationCommand(final IntegrationCommandType type) { | ||
super(type.name()); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/io/gravitee/integration/api/command/IntegrationCommandType.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,28 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.integration.api.command; | ||
|
||
/** | ||
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public enum IntegrationCommandType { | ||
FETCH, | ||
HELLO, | ||
LIST, | ||
STOP, | ||
SUBSCRIBE, | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/io/gravitee/integration/api/command/IntegrationReply.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,43 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.integration.api.command; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import io.gravitee.exchange.api.command.CommandStatus; | ||
import io.gravitee.exchange.api.command.Payload; | ||
import io.gravitee.exchange.api.command.Reply; | ||
import io.gravitee.integration.api.command.fetch.FetchReply; | ||
import io.gravitee.integration.api.command.list.ListReply; | ||
|
||
/** | ||
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public abstract class IntegrationReply<P extends Payload> extends Reply<P> { | ||
|
||
protected IntegrationReply(final IntegrationCommandType type) { | ||
super(type.name()); | ||
} | ||
|
||
protected IntegrationReply(IntegrationCommandType type, String commandId, CommandStatus commandStatus) { | ||
super(type.name(), commandId, commandStatus); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/io/gravitee/integration/api/command/fetch/FetchCommand.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,37 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.gravitee.integration.api.command.fetch; | ||
|
||
import io.gravitee.integration.api.command.IntegrationCommand; | ||
import io.gravitee.integration.api.command.IntegrationCommandType; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
/** | ||
* @author Remi Baptiste (remi.baptiste at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class FetchCommand extends IntegrationCommand<FetchCommandPayload> { | ||
|
||
public FetchCommand() { | ||
super(IntegrationCommandType.FETCH); | ||
} | ||
|
||
public FetchCommand(final FetchCommandPayload fetchCommandPayload) { | ||
this(); | ||
this.payload = fetchCommandPayload; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/io/gravitee/integration/api/command/fetch/FetchCommandPayload.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 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.gravitee.integration.api.command.fetch; | ||
|
||
import io.gravitee.exchange.api.command.Payload; | ||
import io.gravitee.integration.api.model.Asset; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Remi Baptiste (remi.baptiste at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public record FetchCommandPayload(List<Asset> assets) implements Payload {} |
46 changes: 46 additions & 0 deletions
46
src/main/java/io/gravitee/integration/api/command/fetch/FetchReply.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,46 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.gravitee.integration.api.command.fetch; | ||
|
||
import io.gravitee.exchange.api.command.CommandStatus; | ||
import io.gravitee.integration.api.command.IntegrationCommandType; | ||
import io.gravitee.integration.api.command.IntegrationReply; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* @author Remi Baptiste (remi.baptiste at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@Getter | ||
@Setter | ||
public class FetchReply extends IntegrationReply<FetchReplyPayload> { | ||
|
||
public FetchReply() { | ||
super(IntegrationCommandType.FETCH); | ||
} | ||
|
||
public FetchReply(String commandId, String errorDetails) { | ||
super(IntegrationCommandType.FETCH, commandId, CommandStatus.ERROR); | ||
this.errorDetails = errorDetails; | ||
} | ||
|
||
public FetchReply(String commandId, FetchReplyPayload fetchReplyPayload) { | ||
super(IntegrationCommandType.FETCH, commandId, CommandStatus.SUCCEEDED); | ||
this.payload = fetchReplyPayload; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/io/gravitee/integration/api/command/fetch/FetchReplyPayload.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 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.gravitee.integration.api.command.fetch; | ||
|
||
import io.gravitee.exchange.api.command.Payload; | ||
import io.gravitee.integration.api.model.Asset; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Guillaume LAMIRAND (guillaume.lamirand at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public record FetchReplyPayload(List<Asset> assets) implements Payload {} |
37 changes: 37 additions & 0 deletions
37
src/main/java/io/gravitee/integration/api/command/hello/HelloCommand.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,37 @@ | ||
/* | ||
* Copyright © 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.gravitee.integration.api.command.hello; | ||
|
||
import io.gravitee.integration.api.command.IntegrationCommand; | ||
import io.gravitee.integration.api.command.IntegrationCommandType; | ||
|
||
/** | ||
* @author Remi Baptiste (remi.baptiste at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class HelloCommand extends IntegrationCommand<HelloCommandPayload> { | ||
|
||
public HelloCommand() { | ||
super(IntegrationCommandType.HELLO); | ||
} | ||
|
||
public HelloCommand(final String originalCommandId, final HelloCommandPayload helloCommandPayload) { | ||
this(); | ||
this.id = originalCommandId; | ||
this.payload = helloCommandPayload; | ||
} | ||
} |
Oops, something went wrong.