All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nstream.adapter.common.ext.JdbcIngressSettings Maven / Gradle / Ivy

There is a newer version: 4.15.23
Show newest version
// Copyright 2015-2024 Nstream, inc.
//
// Licensed under the Redis Source Available License 2.0 (RSALv2) Agreement;
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://redis.com/legal/rsalv2-agreement/
//
// 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 nstream.adapter.common.ext;

import nstream.adapter.common.AdapterSettings;
import swim.codec.Format;
import swim.codec.Output;
import swim.structure.Form;
import swim.structure.Kind;
import swim.structure.Tag;
import swim.structure.Value;

@Tag("jdbcIngressSettings")
public class JdbcIngressSettings implements AdapterSettings {

  private final long firstFetchDelayMillis;
  private final long fetchIntervalMillis;
  private final int pollTimeoutMillis;
  private final String connectionPoolProvisionName;
  private final String query;
  private final Value molderSchema;
  private final Value relaySchema;

  public JdbcIngressSettings(long firstFetchDelayMillis, long fetchIntervalMillis, int pollTimeoutMillis,
                             String connectionPoolProvisionName, String query,
                             Value molderSchema, Value relaySchema) {
    this.firstFetchDelayMillis = firstFetchDelayMillis;
    this.fetchIntervalMillis = fetchIntervalMillis;
    this.pollTimeoutMillis = pollTimeoutMillis;
    this.connectionPoolProvisionName = connectionPoolProvisionName;
    this.query = query;
    this.molderSchema = molderSchema;
    this.relaySchema = relaySchema;
  }

  public JdbcIngressSettings() {
    this(2000L, 120000L, 60000, null, null, null, null);
  }

  public long firstFetchDelayMillis() {
    return this.firstFetchDelayMillis;
  }

  public long fetchIntervalMillis() {
    return this.fetchIntervalMillis;
  }

  public int pollTimeoutMillis() {
    return this.pollTimeoutMillis;
  }

  public String connectionPoolProvisionName() {
    return this.connectionPoolProvisionName;
  }

  public String query() {
    return this.query;
  }

  public Value molderSchema() {
    return this.molderSchema;
  }

  public Value relaySchema() {
    return this.relaySchema;
  }

  @Override
  public  Output debug(Output output) {
    output = output.write("JdbcIngressSettings").write('.').write("of").write('(').write(')')
        .write('.').write("firstFetchDelay").write('(').debug(this.firstFetchDelayMillis).write(')')
        .write('.').write("fetchInterval").write('(').debug(this.fetchIntervalMillis).write(')')
        .write('.').write("pollTimeout").write('(').debug(this.pollTimeoutMillis).write(')')
        .write('.').write("connectionPoolProvisionName").write('(').debug(this.connectionPoolProvisionName).write(')')
        .write('.').write("query").write('(').debug(this.query).write(')')
        .write('.').write("molderDef").write('(').debug(this.molderSchema).write(')')
        .write('.').write("relaySchema").write('(').debug(this.relaySchema).write(')');
    return output;
  }

  @Override
  public String toString() {
    return Format.debug(this);
  }

  @Kind
  private static Form form;

  public static Form form() {
    if (JdbcIngressSettings.form == null) {
      JdbcIngressSettings.form = Form.forClass(JdbcIngressSettings.class);
    }
    return JdbcIngressSettings.form;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy