WikimediaExternalDefaults.java
package org.wikimedia.eventutilities.core.event;
import static org.wikimedia.eventutilities.core.event.EventUtilitiesConfig.META_WIKIMEDIA_ORG;
import java.net.URI;
import java.util.List;
import java.util.Map;
import org.wikimedia.eventutilities.core.http.BasicHttpClient;
/**
* Default values and instances to aide working with Event Streams in
* Wikimedia outside of production networks, e.g. schema.wikimedia.org
* instead of schema.discovery.wmnet.
*
* It will not be able to use non external services like eventgate-main.
*
* You should only use this class for troubleshooting and debugging.
* If you are writing code for a production job you should properly
* configure your code externally with non hard-coded values.
*
* @deprecated use {@link EventUtilitiesConfig} instead
*/
@Deprecated
public final class WikimediaExternalDefaults {
/** Hostname to use when interacting with the MediaWiki action API. */
public static final String MEDIAWIKI_API_HOST = META_WIKIMEDIA_ORG;
/** List of event schema base URIs used in WMF production. */
public static final List<String> EVENT_SCHEMA_BASE_URIS = EventUtilitiesConfig.EXTERNAL_DEFAULT.getEventSchemaBaseUris();
/** URI from which to get legacy EventLogging on wiki schemas. */
public static final String EVENTLOGGING_SCHEMA_BASE_URI = EventUtilitiesConfig.EXTERNAL_DEFAULT.getEventloggingSchemaBaseUri();
/** MediaWiki EventStreamConfig API used in WMF production to use to fetch stream configs. */
public static final String EVENT_STREAM_CONFIG_URI = EventUtilitiesConfig.EXTERNAL_DEFAULT.getEventStreamConfigUri();
/**
* This default is suitable for using in WMF production networks, but
* may become outdated. For production jobs, you should provide this
* yourself, or provide a URI path to a config file that specifies this.
* See also https://wikitech.wikimedia.org/wiki/Service_ports.
*/
public static final Map<String, URI> EVENT_SERVICE_TO_URI_MAP = EventUtilitiesConfig.EXTERNAL_DEFAULT.getEventServiceToUriMap();
/** Wikimedia EventSchemaLoader default instance. */
public static final EventSchemaLoader EVENT_SCHEMA_LOADER;
/** Wikimedia legacy EventLoggingSchemaLoader instance. */
public static final EventLoggingSchemaLoader EVENTLOGGING_SCHEMA_LOADER;
/** Http client with routes set to work on the internal wikimedia network. */
public static final BasicHttpClient WIKIMEDIA_HTTP_CLIENT;
/** Wikimedia EventStreamConfig default instance. */
public static final EventStreamConfig EVENT_STREAM_CONFIG;
/** Wikimedia EventStreamFactory default instance. */
public static final EventStreamFactory EVENT_STREAM_FACTORY;
/** Wikimedia EventSchemaValidator default instance. */
public static final EventSchemaValidator EVENT_SCHEMA_VALIDATOR;
/** Wikimedia JsonEventGenerator default instance. */
public static final JsonEventGenerator EVENT_GENERATOR;
static {
EventUtilitiesConfig config = EventUtilitiesConfig.EXTERNAL_DEFAULT;
WIKIMEDIA_HTTP_CLIENT = config.createHttpClient();
EVENTLOGGING_SCHEMA_LOADER = config.createEventloggingSchemaLoader(WIKIMEDIA_HTTP_CLIENT);
MediawikiEventStreamConfigLoader eventStreamConfigLoader = config.createMediawikiEventStreamConfigLoader(WIKIMEDIA_HTTP_CLIENT);
EVENT_STREAM_CONFIG = config.createEventStreamConfig(eventStreamConfigLoader);
EVENT_SCHEMA_LOADER = config.createEventSchemaLoader(WIKIMEDIA_HTTP_CLIENT);
EVENT_STREAM_FACTORY = config.createEventStreamFactory(EVENT_SCHEMA_LOADER, EVENT_STREAM_CONFIG);
EVENT_SCHEMA_VALIDATOR = config.createEventSchemaValidator(EVENT_SCHEMA_LOADER);
EVENT_GENERATOR = config.createJsonEventGenerator(EVENT_SCHEMA_LOADER, EVENT_STREAM_CONFIG);
}
private WikimediaExternalDefaults() {
// Utility class should never be instantiated
throw new UnsupportedOperationException();
}
}