[oracle][minor] Clean up useless methods and classes
parent
6fe4fc93e1
commit
df4b87f79e
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 Ververica Inc.
|
||||
*
|
||||
* 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 com.ververica.cdc.connectors.oracle.source.meta.offset;
|
||||
|
||||
import org.apache.flink.annotation.Internal;
|
||||
|
||||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/** Serializer implementation for a {@link RedoLogOffset}. */
|
||||
@Internal
|
||||
public class RedoLogOffsetSerializer {
|
||||
|
||||
public static final RedoLogOffsetSerializer INSTANCE = new RedoLogOffsetSerializer();
|
||||
|
||||
public byte[] serialize(RedoLogOffset redoLogOffset) throws IOException {
|
||||
// use JSON serialization
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
return objectMapper.writeValueAsBytes(redoLogOffset.getOffset());
|
||||
}
|
||||
|
||||
public RedoLogOffset deserialize(byte[] bytes) throws IOException {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map<String, String> offset = objectMapper.readValue(bytes, Map.class);
|
||||
return new RedoLogOffset(offset);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 Ververica Inc.
|
||||
*
|
||||
* 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 com.ververica.cdc.connectors.oracle.table;
|
||||
|
||||
/**
|
||||
* Startup modes for the Oracle CDC Consumer.
|
||||
*
|
||||
* @see StartupOptions
|
||||
*/
|
||||
public enum StartupMode {
|
||||
INITIAL,
|
||||
LATEST_OFFSET,
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 Ververica Inc.
|
||||
*
|
||||
* 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 com.ververica.cdc.connectors.oracle.table;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** Debezium startup options. */
|
||||
public final class StartupOptions {
|
||||
public final StartupMode startupMode;
|
||||
|
||||
/**
|
||||
* Performs an initial snapshot on the monitored database tables upon first startup, and
|
||||
* continue to read the latest logminer.
|
||||
*/
|
||||
public static StartupOptions initial() {
|
||||
return new StartupOptions(StartupMode.INITIAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Never to perform snapshot on the monitored database tables upon first startup, just read from
|
||||
* the end of the logminer which means only have the changes since the connector was started.
|
||||
*/
|
||||
public static StartupOptions latest() {
|
||||
return new StartupOptions(StartupMode.LATEST_OFFSET);
|
||||
}
|
||||
|
||||
private StartupOptions(StartupMode startupMode) {
|
||||
this.startupMode = startupMode;
|
||||
|
||||
switch (startupMode) {
|
||||
case INITIAL:
|
||||
|
||||
case LATEST_OFFSET:
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new UnsupportedOperationException(startupMode + " mode is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
StartupOptions that = (StartupOptions) o;
|
||||
return startupMode == that.startupMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(startupMode);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue