-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Tmp * Extract the Attempt API from the V1 API * Add comments * Move Connection API out of configuration API * format * format * Rename to Controller * Rename to Controller * Add values to the factory * Change the constructor to use hadler instead of objects needed by the handler * Update with new tags. * tmp * Fix PMD errors * Extract DB migrator * Add something that I forgot * extract destination definition api * restore destination factory initialization * extract destination definition specification api * format * format * format * extract health check api * extract jobs api * fix test * format * Add missing declaration
- Loading branch information
1 parent
33194df
commit 417481e
Showing
6 changed files
with
175 additions
and
7 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
57 changes: 57 additions & 0 deletions
57
airbyte-server/src/main/java/io/airbyte/server/apis/JobsApiController.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,57 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis; | ||
|
||
import io.airbyte.api.generated.JobsApi; | ||
import io.airbyte.api.model.generated.AttemptNormalizationStatusReadList; | ||
import io.airbyte.api.model.generated.JobDebugInfoRead; | ||
import io.airbyte.api.model.generated.JobIdRequestBody; | ||
import io.airbyte.api.model.generated.JobInfoLightRead; | ||
import io.airbyte.api.model.generated.JobInfoRead; | ||
import io.airbyte.api.model.generated.JobListRequestBody; | ||
import io.airbyte.api.model.generated.JobReadList; | ||
import io.airbyte.server.handlers.JobHistoryHandler; | ||
import io.airbyte.server.handlers.SchedulerHandler; | ||
import javax.ws.rs.Path; | ||
import lombok.AllArgsConstructor; | ||
|
||
@Path("/v1/jobs") | ||
@AllArgsConstructor | ||
public class JobsApiController implements JobsApi { | ||
|
||
private final JobHistoryHandler jobHistoryHandler; | ||
private final SchedulerHandler schedulerHandler; | ||
|
||
@Override | ||
public JobInfoRead cancelJob(final JobIdRequestBody jobIdRequestBody) { | ||
return ConfigurationApi.execute(() -> schedulerHandler.cancelJob(jobIdRequestBody)); | ||
} | ||
|
||
@Override | ||
public AttemptNormalizationStatusReadList getAttemptNormalizationStatusesForJob(final JobIdRequestBody jobIdRequestBody) { | ||
return ConfigurationApi.execute(() -> jobHistoryHandler.getAttemptNormalizationStatuses(jobIdRequestBody)); | ||
} | ||
|
||
@Override | ||
public JobDebugInfoRead getJobDebugInfo(final JobIdRequestBody jobIdRequestBody) { | ||
return ConfigurationApi.execute(() -> jobHistoryHandler.getJobDebugInfo(jobIdRequestBody)); | ||
} | ||
|
||
@Override | ||
public JobInfoRead getJobInfo(final JobIdRequestBody jobIdRequestBody) { | ||
return ConfigurationApi.execute(() -> jobHistoryHandler.getJobInfo(jobIdRequestBody)); | ||
} | ||
|
||
@Override | ||
public JobInfoLightRead getJobInfoLight(final JobIdRequestBody jobIdRequestBody) { | ||
return ConfigurationApi.execute(() -> jobHistoryHandler.getJobInfoLight(jobIdRequestBody)); | ||
} | ||
|
||
@Override | ||
public JobReadList listJobsFor(final JobListRequestBody jobListRequestBody) { | ||
return ConfigurationApi.execute(() -> jobHistoryHandler.listJobsFor(jobListRequestBody)); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
airbyte-server/src/main/java/io/airbyte/server/apis/binders/JobsApiBinder.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.JobsApiController; | ||
import io.airbyte.server.apis.factories.JobsApiFactory; | ||
import org.glassfish.hk2.utilities.binding.AbstractBinder; | ||
import org.glassfish.jersey.process.internal.RequestScoped; | ||
|
||
public class JobsApiBinder extends AbstractBinder { | ||
|
||
@Override | ||
protected void configure() { | ||
bindFactory(JobsApiFactory.class) | ||
.to(JobsApiController.class) | ||
.in(RequestScoped.class); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
airbyte-server/src/main/java/io/airbyte/server/apis/factories/JobsApiFactory.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 (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.factories; | ||
|
||
import io.airbyte.server.apis.JobsApiController; | ||
import io.airbyte.server.handlers.JobHistoryHandler; | ||
import io.airbyte.server.handlers.SchedulerHandler; | ||
import org.glassfish.hk2.api.Factory; | ||
|
||
public class JobsApiFactory implements Factory<JobsApiController> { | ||
|
||
private static JobHistoryHandler jobHistoryHandler; | ||
private static SchedulerHandler schedulerHandler; | ||
|
||
public static void setValues(final JobHistoryHandler jobHistoryHandler, final SchedulerHandler schedulerHandler) { | ||
JobsApiFactory.jobHistoryHandler = jobHistoryHandler; | ||
JobsApiFactory.schedulerHandler = schedulerHandler; | ||
} | ||
|
||
@Override | ||
public JobsApiController provide() { | ||
return new JobsApiController(jobHistoryHandler, schedulerHandler); | ||
} | ||
|
||
@Override | ||
public void dispose(final JobsApiController instance) { | ||
/* no op */ | ||
} | ||
|
||
} |