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

com.emc.mongoose.load.step.pipeline.PipelineLoadStepExtension Maven / Gradle / Ivy

There is a newer version: 4.2.13
Show newest version
package com.emc.mongoose.load.step.pipeline;

import com.emc.mongoose.env.Extension;
import com.emc.mongoose.env.ExtensionBase;
import com.emc.mongoose.load.step.LoadStepFactory;
import static com.emc.mongoose.Constants.APP_NAME;

import com.emc.mongoose.metrics.MetricsManager;
import com.github.akurilov.confuse.Config;
import com.github.akurilov.confuse.SchemaProvider;

import com.github.akurilov.confuse.io.json.JsonSchemaProviderBase;

import java.io.InputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public final class PipelineLoadStepExtension
extends ExtensionBase
implements LoadStepFactory {

	public static final String TYPE = "PipelineLoad";

	private static final SchemaProvider SCHEMA_PROVIDER = new JsonSchemaProviderBase() {

		@Override
		protected final InputStream schemaInputStream() {
			return getClass().getResourceAsStream("/config-schema-item-output-delay.json");
		}

		@Override
		public final String id() {
			return APP_NAME;
		}
	};

	private static final String DEFAULTS_FILE_NAME = "defaults-item-output-delay.json";

	private static final List RES_INSTALL_FILES = Collections.unmodifiableList(
		Arrays.asList("config/" + DEFAULTS_FILE_NAME)
	);

	@Override
	public final String id() {
		return TYPE;
	}

	@Override
	public final SchemaProvider schemaProvider() {
		return SCHEMA_PROVIDER;
	}

	@Override
	protected final String defaultsFileName() {
		return DEFAULTS_FILE_NAME;
	}

	@Override
	protected final List resourceFilesToInstall() {
		return RES_INSTALL_FILES;
	}

	@Override @SuppressWarnings("unchecked")
	public final T createLocal(
		final Config baseConfig, final List extensions, final List contextConfigs,
		final MetricsManager metricsManager
	) {
		return (T) new PipelineLoadStepLocal(baseConfig, extensions, contextConfigs, metricsManager);
	}

	@Override @SuppressWarnings("unchecked")
	public final U createClient(
		final Config baseConfig, final List extensions, final MetricsManager metricsManager
	) {
		return (U) new PipelineLoadStepClient(baseConfig, extensions, null, metricsManager);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy