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

org.opentripplanner.ext.siri.updater.SiriETGooglePubsubUpdaterParameters Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.ext.siri.updater;

import java.time.Duration;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opentripplanner.updater.trip.UrlUpdaterParameters;
import org.opentripplanner.util.lang.ToStringBuilder;

public record SiriETGooglePubsubUpdaterParameters(
  @Nonnull String configRef,
  @Nullable String feedId,
  String type,
  String projectName,
  String topicName,
  @Nullable String dataInitializationUrl,
  Duration reconnectPeriod,
  Duration initialGetDataTimeout,
  boolean purgeExpiredData,
  boolean fuzzyTripMatching
)
  implements UrlUpdaterParameters {
  public static Duration RECONNECT_PERIOD = Duration.ofSeconds(30);
  public static Duration INITIAL_GET_DATA_TIMEOUT = Duration.ofSeconds(30);

  public SiriETGooglePubsubUpdaterParameters {
    Objects.requireNonNull(type);
    Objects.requireNonNull(projectName);
    Objects.requireNonNull(topicName);
    Objects.requireNonNull(reconnectPeriod);
    Objects.requireNonNull(initialGetDataTimeout);
    Objects.requireNonNull(reconnectPeriod);
  }

  @Override
  public String toString() {
    return ToStringBuilder
      .of(SiriETGooglePubsubUpdaterParameters.class)
      .addObj("configRef", configRef, null)
      .addObj("feedId", feedId, null)
      .addObj("type", type)
      .addObj("projectName", projectName)
      .addObj("topicName", topicName)
      .addDuration("reconnectPeriod", reconnectPeriod, RECONNECT_PERIOD)
      .addDuration("initialGetDataTimeout", initialGetDataTimeout, INITIAL_GET_DATA_TIMEOUT)
      .addBoolIfTrue("purgeExpiredData", purgeExpiredData)
      .addBoolIfTrue("fuzzyTripMatching", fuzzyTripMatching)
      .addObj("dataInitializationUrl", dataInitializationUrl, null)
      .toString();
  }

  @Override
  public String getUrl() {
    return dataInitializationUrl;
  }

  @Override
  public String getConfigRef() {
    return configRef;
  }

  @Override
  public String getFeedId() {
    return feedId;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy