int c;
java.io.Reader input;
StringBuffer xmlRqst;
String xmlRply = null;
XMLDispatcherClient xdCli;
for (int i=0; i<args.length; i++)
{
if (args[i].equals("--verb"))
{
i++;
verb = args[i];
}
else if (args[i].equals("--appName"))
{
i++;
appName = args[i];
}
else if (args[i].equals("--className"))
{
i++;
className = args[i];
}
else if (args[i].equals("--methodName"))
{
i++;
methodName = args[i];
}
else if (args[i].equals("--instanceId"))
{
i++;
instanceId = args[i];
}
else
{
throw new XMLDispatcherCommException("Unexpected argument: '"+args[i]+"'");
}
}
if (verb == null || appName == null ||
className == null || methodName == null)
{
throw new XMLDispatcherCommException("missing argument");
}
input = new BufferedReader(new InputStreamReader(System.in));
xmlRqst = new StringBuffer();
while (-1 != (c = input.read()))
{
xmlRqst.append((char)c);
}
xdCli = new XMLDispatcherEJBClient(appName);
if (verb.equals("DispatchClassMethodXML"))
{
xmlRply = xdCli.dispatchClassMethodXML(className,methodName,xmlRqst.toString());
}
else if (verb.equals("DispatchNewInstanceMethodXML"))
{
xmlRply = xdCli.dispatchNewInstanceMethodXML(className,methodName,xmlRqst.toString());
}
else if (verb.equals("DispatchInstanceMethodXML"))
{
if (instanceId == null)
{
throw new XMLDispatcherCommException("Missing instanceId");
}
xmlRply = xdCli.dispatchInstanceMethodXML(className,methodName,instanceId,xmlRqst.toString());
}
else
{
throw new XMLDispatcherCommException("Invalid verb: "+verb);
}