-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Extract Operation API * Extract scheduler API * Format * extract source api * Extract source definition api * Add path * Extract State API * Add missing binder * fix type
- Loading branch information
1 parent
b7b6507
commit a16ecd6
Showing
6 changed files
with
112 additions
and
5 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
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
31 changes: 31 additions & 0 deletions
31
airbyte-server/src/main/java/io/airbyte/server/apis/StateApiController.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,31 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis; | ||
|
||
import io.airbyte.api.generated.StateApi; | ||
import io.airbyte.api.model.generated.ConnectionIdRequestBody; | ||
import io.airbyte.api.model.generated.ConnectionState; | ||
import io.airbyte.api.model.generated.ConnectionStateCreateOrUpdate; | ||
import io.airbyte.server.handlers.StateHandler; | ||
import javax.ws.rs.Path; | ||
import lombok.AllArgsConstructor; | ||
|
||
@Path("/v1/state") | ||
@AllArgsConstructor | ||
public class StateApiController implements StateApi { | ||
|
||
private final StateHandler stateHandler; | ||
|
||
@Override | ||
public ConnectionState createOrUpdateState(final ConnectionStateCreateOrUpdate connectionStateCreateOrUpdate) { | ||
return ConfigurationApi.execute(() -> stateHandler.createOrUpdateState(connectionStateCreateOrUpdate)); | ||
} | ||
|
||
@Override | ||
public ConnectionState getState(final ConnectionIdRequestBody connectionIdRequestBody) { | ||
return ConfigurationApi.execute(() -> stateHandler.getState(connectionIdRequestBody)); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
airbyte-server/src/main/java/io/airbyte/server/apis/binders/StateApiBinder.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,21 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.binders; | ||
|
||
import io.airbyte.server.apis.StateApiController; | ||
import io.airbyte.server.apis.factories.StateApiFactory; | ||
import org.glassfish.hk2.utilities.binding.AbstractBinder; | ||
import org.glassfish.jersey.process.internal.RequestScoped; | ||
|
||
public class StateApiBinder extends AbstractBinder { | ||
|
||
@Override | ||
protected void configure() { | ||
bindFactory(StateApiFactory.class) | ||
.to(StateApiController.class) | ||
.in(RequestScoped.class); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
airbyte-server/src/main/java/io/airbyte/server/apis/factories/StateApiFactory.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,29 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.factories; | ||
|
||
import io.airbyte.server.apis.StateApiController; | ||
import io.airbyte.server.handlers.StateHandler; | ||
import org.glassfish.hk2.api.Factory; | ||
|
||
public class StateApiFactory implements Factory<StateApiController> { | ||
|
||
private static StateHandler stateHandler; | ||
|
||
public static void setValues(final StateHandler stateHandler) { | ||
StateApiFactory.stateHandler = stateHandler; | ||
} | ||
|
||
@Override | ||
public StateApiController provide() { | ||
return new StateApiController(StateApiFactory.stateHandler); | ||
} | ||
|
||
@Override | ||
public void dispose(final StateApiController instance) { | ||
/* no op */ | ||
} | ||
|
||
} |