-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
AirbyteProtocolVersionedMigratorFactory.java
37 lines (28 loc) · 1.27 KB
/
AirbyteProtocolVersionedMigratorFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.commons.protocol;
import io.airbyte.commons.version.Version;
import jakarta.inject.Singleton;
/**
* Factory to build AirbyteMessageVersionedMigrator
*/
@Singleton
public class AirbyteProtocolVersionedMigratorFactory {
private final AirbyteMessageMigrator airbyteMessageMigrator;
private final ConfiguredAirbyteCatalogMigrator configuredAirbyteCatalogMigrator;
public AirbyteProtocolVersionedMigratorFactory(final AirbyteMessageMigrator airbyteMessageMigrator,
final ConfiguredAirbyteCatalogMigrator configuredAirbyteCatalogMigrator) {
this.airbyteMessageMigrator = airbyteMessageMigrator;
this.configuredAirbyteCatalogMigrator = configuredAirbyteCatalogMigrator;
}
public <T> AirbyteMessageVersionedMigrator<T> getAirbyteMessageMigrator(final Version version) {
return new AirbyteMessageVersionedMigrator<>(airbyteMessageMigrator, version);
}
public final VersionedProtocolSerializer getProtocolSerializer(final Version version) {
return new VersionedProtocolSerializer(configuredAirbyteCatalogMigrator, version);
}
public Version getMostRecentVersion() {
return airbyteMessageMigrator.getMostRecentVersion();
}
}