
org.openas2.cmd.MultiCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openas2-server Show documentation
Show all versions of openas2-server Show documentation
Open source implementation of the AS2 standard for signed encrypted and compressed document transfer
package org.openas2.cmd;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.openas2.OpenAS2Exception;
import org.openas2.Session;
public class MultiCommand extends BaseCommand {
private List cmds;
public void init(Session session, Map parameters) throws OpenAS2Exception {
super.init(session, parameters);
getParameter(PARAM_NAME, true);
getParameter(PARAM_DESCRIPTION, true);
if (getUsage() == null) {
setUsage(getName() + " ");
}
}
public Command getCommand(String name) {
name = name.toLowerCase();
List commands = getCommands();
Command cmd;
for (int i = 0; i < commands.size(); i++) {
cmd = commands.get(i);
if (cmd.getName().equals(name)) {
return cmd;
}
}
return null;
}
public List getCommands() {
if (cmds == null) {
cmds = new ArrayList();
}
return cmds;
}
public String getDescription(String name) {
Command cmd = getCommand(name);
if (cmd != null) {
return cmd.getDescription();
}
return null;
}
public String getUsage(String name) {
Command cmd = getCommand(name);
if (cmd != null) {
return cmd.getUsage();
}
return null;
}
public CommandResult execute(Object[] params) {
if (params.length > 0) {
String subName = params[0].toString();
Command subCmd = getCommand(subName);
if (subCmd != null) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy