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

org.bitbucket.bradleysmithllc.etlunit.cli.ProfileCmd Maven / Gradle / Ivy

There is a newer version: 4.1.3
Show newest version
package org.bitbucket.bradleysmithllc.etlunit.cli;

import org.clamshellcli.api.Command;
import org.clamshellcli.api.Configurator;
import org.clamshellcli.api.Context;
import org.clamshellcli.api.IOConsole;

import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class ProfileCmd implements Command {
	private static final String NAMESPACE = "syscmd";
	public static final String ACTION_NAME = "profile";

	public Object execute(Context ctx) {
		IOConsole console = ctx.getIoConsole();

		String [] inputLine = (String []) ctx.getValue(Context.KEY_COMMAND_LINE_ARGS);

		if (inputLine == null || inputLine.length == 0)
		{
			console.writeOutput("Missing profile name" + Configurator.VALUE_LINE_SEP);
		}
		else
		{
			System.setProperty("etlunit.override.configuration", inputLine[0]);

			console.writeOutput("Etlunit configuration changed to: '" + inputLine[0] + "'" + Configurator.VALUE_LINE_SEP);
		}

		return null;
	}

	public Descriptor getDescriptor(){
		return new Descriptor() {
			public String getNamespace() {return NAMESPACE;}

			public String getName() {
				return ACTION_NAME;
			}

			public String getDescription() {
				return "Changes to a specific profile.  Similar to using the etlunit configuration flag in maven (Not a maven profile)";
			}

			public String getUsage() {
				return "Type 'profile '";
			}

			public Map getArguments() {
				Map map = new HashMap();

				map.put("name", "Profile name.");

				return map;
			}
		};
	}

	@Override
	public void plug(Context context) {
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy