Skip to content

Commit ebef6e4

Browse files
committed
Revert "Bmoric/extract webbackend api (#18988)"
This reverts commit b05a5b2.
1 parent 4cfe05e commit ebef6e4

File tree

7 files changed

+39
-191
lines changed

7 files changed

+39
-191
lines changed

airbyte-server/src/main/java/io/airbyte/server/ConfigurationApiFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class ConfigurationApiFactory implements Factory<ConfigurationApi> {
3131
private static SecretsRepositoryReader secretsRepositoryReader;
3232
private static SecretsRepositoryWriter secretsRepositoryWriter;
3333
private static SynchronousSchedulerClient synchronousSchedulerClient;
34+
private static StatePersistence statePersistence;
3435
private static Map<String, String> mdc;
3536
private static TrackingClient trackingClient;
3637
private static WorkerEnvironment workerEnvironment;
@@ -68,6 +69,7 @@ public static void setValues(
6869
ConfigurationApiFactory.logConfigs = logConfigs;
6970
ConfigurationApiFactory.airbyteVersion = airbyteVersion;
7071
ConfigurationApiFactory.eventRunner = eventRunner;
72+
ConfigurationApiFactory.statePersistence = statePersistence;
7173
}
7274

7375
@Override
@@ -80,6 +82,7 @@ public ConfigurationApi provide() {
8082
ConfigurationApiFactory.secretsRepositoryReader,
8183
ConfigurationApiFactory.secretsRepositoryWriter,
8284
ConfigurationApiFactory.synchronousSchedulerClient,
85+
ConfigurationApiFactory.statePersistence,
8386
ConfigurationApiFactory.trackingClient,
8487
ConfigurationApiFactory.workerEnvironment,
8588
ConfigurationApiFactory.logConfigs,

airbyte-server/src/main/java/io/airbyte/server/ServerApp.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
import io.airbyte.server.handlers.SourceDefinitionsHandler;
6464
import io.airbyte.server.handlers.SourceHandler;
6565
import io.airbyte.server.handlers.StateHandler;
66-
import io.airbyte.server.handlers.WebBackendConnectionsHandler;
67-
import io.airbyte.server.handlers.WebBackendGeographiesHandler;
6866
import io.airbyte.server.handlers.WorkspacesHandler;
6967
import io.airbyte.server.scheduler.DefaultSynchronousSchedulerClient;
7068
import io.airbyte.server.scheduler.EventRunner;
@@ -328,19 +326,6 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
328326

329327
final StateHandler stateHandler = new StateHandler(statePersistence);
330328

331-
final WebBackendConnectionsHandler webBackendConnectionsHandler = new WebBackendConnectionsHandler(
332-
connectionsHandler,
333-
stateHandler,
334-
sourceHandler,
335-
destinationHandler,
336-
jobHistoryHandler,
337-
schedulerHandler,
338-
operationsHandler,
339-
eventRunner,
340-
configRepository);
341-
342-
final WebBackendGeographiesHandler webBackendGeographiesHandler = new WebBackendGeographiesHandler();
343-
344329
LOGGER.info("Starting server...");
345330

346331
return apiFactory.create(
@@ -375,9 +360,7 @@ public static ServerRunnable getServer(final ServerFactory apiFactory,
375360
sourceHandler,
376361
sourceDefinitionsHandler,
377362
stateHandler,
378-
workspacesHandler,
379-
webBackendConnectionsHandler,
380-
webBackendGeographiesHandler);
363+
workspacesHandler);
381364
}
382365

383366
public static void main(final String[] args) {

airbyte-server/src/main/java/io/airbyte/server/ServerFactory.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import io.airbyte.server.apis.SourceDefinitionApiController;
3434
import io.airbyte.server.apis.SourceOauthApiController;
3535
import io.airbyte.server.apis.StateApiController;
36-
import io.airbyte.server.apis.WebBackendApiController;
3736
import io.airbyte.server.apis.binders.AttemptApiBinder;
3837
import io.airbyte.server.apis.binders.ConnectionApiBinder;
3938
import io.airbyte.server.apis.binders.DbMigrationBinder;
@@ -52,7 +51,6 @@
5251
import io.airbyte.server.apis.binders.SourceDefinitionApiBinder;
5352
import io.airbyte.server.apis.binders.SourceOauthApiBinder;
5453
import io.airbyte.server.apis.binders.StateApiBinder;
55-
import io.airbyte.server.apis.binders.WebBackendApiBinder;
5654
import io.airbyte.server.apis.factories.AttemptApiFactory;
5755
import io.airbyte.server.apis.factories.ConnectionApiFactory;
5856
import io.airbyte.server.apis.factories.DbMigrationApiFactory;
@@ -71,7 +69,6 @@
7169
import io.airbyte.server.apis.factories.SourceDefinitionApiFactory;
7270
import io.airbyte.server.apis.factories.SourceOauthApiFactory;
7371
import io.airbyte.server.apis.factories.StateApiFactory;
74-
import io.airbyte.server.apis.factories.WebBackendApiFactory;
7572
import io.airbyte.server.handlers.AttemptHandler;
7673
import io.airbyte.server.handlers.ConnectionsHandler;
7774
import io.airbyte.server.handlers.DbMigrationHandler;
@@ -87,8 +84,6 @@
8784
import io.airbyte.server.handlers.SourceDefinitionsHandler;
8885
import io.airbyte.server.handlers.SourceHandler;
8986
import io.airbyte.server.handlers.StateHandler;
90-
import io.airbyte.server.handlers.WebBackendConnectionsHandler;
91-
import io.airbyte.server.handlers.WebBackendGeographiesHandler;
9287
import io.airbyte.server.handlers.WorkspacesHandler;
9388
import io.airbyte.server.scheduler.EventRunner;
9489
import io.airbyte.server.scheduler.SynchronousSchedulerClient;
@@ -132,9 +127,7 @@ ServerRunnable create(final SynchronousSchedulerClient synchronousSchedulerClien
132127
final SourceHandler sourceHandler,
133128
final SourceDefinitionsHandler sourceDefinitionsHandler,
134129
final StateHandler stateHandler,
135-
final WorkspacesHandler workspacesHandler,
136-
final WebBackendConnectionsHandler webBackendConnectionsHandler,
137-
final WebBackendGeographiesHandler webBackendGeographiesHandler);
130+
final WorkspacesHandler workspacesHandler);
138131

139132
class Api implements ServerFactory {
140133

@@ -170,9 +163,7 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
170163
final SourceHandler sourceHandler,
171164
final SourceDefinitionsHandler sourceDefinitionsHandler,
172165
final StateHandler stateHandler,
173-
final WorkspacesHandler workspacesHandler,
174-
final WebBackendConnectionsHandler webBackendConnectionsHandler,
175-
final WebBackendGeographiesHandler webBackendGeographiesHandler) {
166+
final WorkspacesHandler workspacesHandler) {
176167
final Map<String, String> mdc = MDC.getCopyOfContextMap();
177168

178169
// set static values for factory
@@ -236,8 +227,6 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
236227

237228
StateApiFactory.setValues(stateHandler);
238229

239-
WebBackendApiFactory.setValues(webBackendConnectionsHandler, webBackendGeographiesHandler);
240-
241230
// server configurations
242231
final Set<Class<?>> componentClasses = Set.of(
243232
ConfigurationApi.class,
@@ -258,8 +247,7 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
258247
SourceApiController.class,
259248
SourceDefinitionApiController.class,
260249
SourceOauthApiController.class,
261-
StateApiController.class,
262-
WebBackendApiController.class);
250+
StateApiController.class);
263251

264252
final Set<Object> components = Set.of(
265253
new CorsFilter(),
@@ -281,8 +269,7 @@ public ServerRunnable create(final SynchronousSchedulerClient synchronousSchedul
281269
new SourceApiBinder(),
282270
new SourceDefinitionApiBinder(),
283271
new SourceOauthApiBinder(),
284-
new StateApiBinder(),
285-
new WebBackendApiBinder());
272+
new StateApiBinder());
286273

287274
// construct server
288275
return new ServerApp(airbyteVersion, componentClasses, components);

airbyte-server/src/main/java/io/airbyte/server/apis/ConfigurationApi.java

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
import io.airbyte.config.persistence.ConfigRepository;
110110
import io.airbyte.config.persistence.SecretsRepositoryReader;
111111
import io.airbyte.config.persistence.SecretsRepositoryWriter;
112+
import io.airbyte.config.persistence.StatePersistence;
112113
import io.airbyte.persistence.job.JobPersistence;
113114
import io.airbyte.persistence.job.WorkspaceHelper;
114115
import io.airbyte.server.errors.BadObjectSchemaKnownException;
@@ -117,9 +118,13 @@
117118
import io.airbyte.server.handlers.DestinationDefinitionsHandler;
118119
import io.airbyte.server.handlers.DestinationHandler;
119120
import io.airbyte.server.handlers.JobHistoryHandler;
121+
import io.airbyte.server.handlers.OperationsHandler;
120122
import io.airbyte.server.handlers.SchedulerHandler;
121123
import io.airbyte.server.handlers.SourceDefinitionsHandler;
122124
import io.airbyte.server.handlers.SourceHandler;
125+
import io.airbyte.server.handlers.StateHandler;
126+
import io.airbyte.server.handlers.WebBackendConnectionsHandler;
127+
import io.airbyte.server.handlers.WebBackendGeographiesHandler;
123128
import io.airbyte.server.handlers.WorkspacesHandler;
124129
import io.airbyte.server.scheduler.EventRunner;
125130
import io.airbyte.server.scheduler.SynchronousSchedulerClient;
@@ -141,14 +146,19 @@ public class ConfigurationApi implements io.airbyte.api.generated.V1Api {
141146
private final DestinationDefinitionsHandler destinationDefinitionsHandler;
142147
private final DestinationHandler destinationHandler;
143148
private final ConnectionsHandler connectionsHandler;
149+
private final OperationsHandler operationsHandler;
144150
private final SchedulerHandler schedulerHandler;
151+
private final StateHandler stateHandler;
145152
private final JobHistoryHandler jobHistoryHandler;
153+
private final WebBackendConnectionsHandler webBackendConnectionsHandler;
154+
private final WebBackendGeographiesHandler webBackendGeographiesHandler;
146155

147156
public ConfigurationApi(final ConfigRepository configRepository,
148157
final JobPersistence jobPersistence,
149158
final SecretsRepositoryReader secretsRepositoryReader,
150159
final SecretsRepositoryWriter secretsRepositoryWriter,
151160
final SynchronousSchedulerClient synchronousSchedulerClient,
161+
final StatePersistence statePersistence,
152162
final TrackingClient trackingClient,
153163
final WorkerEnvironment workerEnvironment,
154164
final LogConfigs logConfigs,
@@ -176,13 +186,15 @@ public ConfigurationApi(final ConfigRepository configRepository,
176186
eventRunner,
177187
connectionsHandler);
178188

189+
stateHandler = new StateHandler(statePersistence);
179190
sourceHandler = new SourceHandler(
180191
configRepository,
181192
secretsRepositoryReader,
182193
secretsRepositoryWriter,
183194
schemaValidator,
184195
connectionsHandler);
185196
sourceDefinitionsHandler = new SourceDefinitionsHandler(configRepository, synchronousSchedulerClient, sourceHandler);
197+
operationsHandler = new OperationsHandler(configRepository);
186198
destinationHandler = new DestinationHandler(
187199
configRepository,
188200
secretsRepositoryReader,
@@ -198,6 +210,17 @@ public ConfigurationApi(final ConfigRepository configRepository,
198210
sourceHandler);
199211
jobHistoryHandler = new JobHistoryHandler(jobPersistence, workerEnvironment, logConfigs, connectionsHandler, sourceHandler,
200212
sourceDefinitionsHandler, destinationHandler, destinationDefinitionsHandler, airbyteVersion);
213+
webBackendConnectionsHandler = new WebBackendConnectionsHandler(
214+
connectionsHandler,
215+
stateHandler,
216+
sourceHandler,
217+
destinationHandler,
218+
jobHistoryHandler,
219+
schedulerHandler,
220+
operationsHandler,
221+
eventRunner,
222+
configRepository);
223+
webBackendGeographiesHandler = new WebBackendGeographiesHandler();
201224
}
202225

203226
// WORKSPACE
@@ -394,7 +417,7 @@ public void revokeSourceDefinitionFromWorkspace(final SourceDefinitionIdWithWork
394417

395418
@Override
396419
public InternalOperationResult saveStats(final SaveStatsRequestBody saveStatsRequestBody) {
397-
throw new NotImplementedException();
420+
throw new UnsupportedOperationException();
398421
}
399422

400423
// SOURCE SPECIFICATION
@@ -1093,67 +1116,39 @@ public HealthCheckRead getHealthCheck() {
10931116

10941117
// WEB BACKEND
10951118

1096-
/**
1097-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1098-
* {@link HealthApiController} is more granular, it will override this implementation
1099-
*/
11001119
@Override
11011120
public WebBackendConnectionReadList webBackendListConnectionsForWorkspace(final WorkspaceIdRequestBody workspaceIdRequestBody) {
1102-
throw new NotImplementedException();
1121+
return execute(() -> webBackendConnectionsHandler.webBackendListConnectionsForWorkspace(workspaceIdRequestBody));
11031122
}
11041123

1105-
/**
1106-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1107-
* {@link HealthApiController} is more granular, it will override this implementation
1108-
*/
11091124
@Override
11101125
public WebBackendGeographiesListResult webBackendListGeographies() {
1111-
throw new NotImplementedException();
1126+
return execute(webBackendGeographiesHandler::listGeographiesOSS);
11121127
}
11131128

1114-
/**
1115-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1116-
* {@link HealthApiController} is more granular, it will override this implementation
1117-
*/
11181129
@Override
11191130
public WebBackendConnectionRead webBackendGetConnection(final WebBackendConnectionRequestBody webBackendConnectionRequestBody) {
1120-
throw new NotImplementedException();
1131+
return execute(() -> webBackendConnectionsHandler.webBackendGetConnection(webBackendConnectionRequestBody));
11211132
}
11221133

1123-
/**
1124-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1125-
* {@link HealthApiController} is more granular, it will override this implementation
1126-
*/
11271134
@Override
11281135
public WebBackendConnectionRead webBackendCreateConnection(final WebBackendConnectionCreate webBackendConnectionCreate) {
1129-
throw new NotImplementedException();
1136+
return execute(() -> webBackendConnectionsHandler.webBackendCreateConnection(webBackendConnectionCreate));
11301137
}
11311138

1132-
/**
1133-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1134-
* {@link HealthApiController} is more granular, it will override this implementation
1135-
*/
11361139
@Override
11371140
public WebBackendConnectionRead webBackendUpdateConnection(final WebBackendConnectionUpdate webBackendConnectionUpdate) {
1138-
throw new NotImplementedException();
1141+
return execute(() -> webBackendConnectionsHandler.webBackendUpdateConnection(webBackendConnectionUpdate));
11391142
}
11401143

1141-
/**
1142-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1143-
* {@link HealthApiController} is more granular, it will override this implementation
1144-
*/
11451144
@Override
11461145
public ConnectionStateType getStateType(final ConnectionIdRequestBody connectionIdRequestBody) {
1147-
throw new NotImplementedException();
1146+
return ConfigurationApi.execute(() -> webBackendConnectionsHandler.getStateType(connectionIdRequestBody));
11481147
}
11491148

1150-
/**
1151-
* This implementation has been moved to {@link HealthApiController}. Since the path of
1152-
* {@link HealthApiController} is more granular, it will override this implementation
1153-
*/
11541149
@Override
11551150
public WebBackendWorkspaceStateResult webBackendGetWorkspaceState(final WebBackendWorkspaceState webBackendWorkspaceState) {
1156-
throw new NotImplementedException();
1151+
return execute(() -> webBackendConnectionsHandler.getWorkspaceState(webBackendWorkspaceState));
11571152
}
11581153

11591154
// TODO: Move to common when all the api are moved

airbyte-server/src/main/java/io/airbyte/server/apis/WebBackendApiController.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

airbyte-server/src/main/java/io/airbyte/server/apis/binders/WebBackendApiBinder.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)