FileDocCategorySizeDatePackage
ComponentTask.javaAPI DocGlassfish v2 API3566Fri May 04 22:32:42 BST 2007org.apache.tools.ant.taskdefs.optional.iplanet

ComponentTask

public class ComponentTask extends ComponentAdmin

Fields Summary
private String
action
private static final String
ACTION_ENABLE
private static final String
ACTION_DISABLE
private static final Map
ACTION_MAP
Constructors Summary
Methods Summary
protected voidcheckComponentConfig(Component comp)

		super.checkComponentConfig(comp);

		if (action == null) {
			String msg = "The action command must be specified.";
			throw new BuildException(msg, getLocation());
		}

		if (!ACTION_MAP.containsKey(action)) {

			String msg = "The action command (\"" + action + "\") is invalid.";
			throw new BuildException(msg, getLocation());
		}

		// name must be valid string
		String theName = comp.getName();
		if ((theName == null) || (theName.length() == 0)) {
			String msg = "The component name (\"" + theName + "\") is not valid";
			throw new BuildException(msg, getLocation());
		}
	
protected java.lang.StringgetCommandString(Server server, Component comp)

		StringBuffer cmdString = new StringBuffer();
		cmdString.append(ACTION_MAP.get(action));
		cmdString.append(server.getCommandParameters(true));
		if (comp.getType() != null) {
			cmdString.append(" --type ").append(comp.getType());
		}
		cmdString.append(" ").append(comp.getName());

		return cmdString.toString();
	
public voidsetAction(java.lang.String action)

	 
		ACTION_MAP.put(ACTION_ENABLE, "enable");
		ACTION_MAP.put(ACTION_DISABLE, "disable");
	
		this.action = action;