|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.CommandLineParser
util.rmi.GenericInvoke
public class GenericInvoke
A class that allows very generic access to objects bound in the registry. The user can query and execute methods on any object bound. It requires profound knowledge of the object bound to invoke the correct methods with the correct arguments. It understands the following command line switches:
PropertyResources.createFrom(java.util.Map) method. Thus, at least
a class-key must be specified.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.CommandLineParser |
|---|
CommandLineParser.Test |
| Field Summary | |
|---|---|
private static String |
FOOT
A footer message. |
private static String |
ONESWITCH
The switch for the method name. |
private static String |
THREESWITCH
The switch for adding an object constructed via class name. |
private static String |
TWOSWITCH
The switches for adding objects as arguments to the method. |
private static Map<String,String> |
USE
Detailed use of switches. |
| Constructor Summary | |
|---|---|
GenericInvoke()
Constructs the parser to the generic invocation class. |
|
| Method Summary | |
|---|---|
private static Field[] |
getFields(Remote rmi)
Returns all implemented fields of the remote object. |
private static Class |
getImplementation(Remote rmi)
Returns the implementing class of a remote object. |
private static Method[] |
getMethods(Remote rmi)
Returns all implemented methods of the class. |
private static Object |
invoke(Remote rmi,
Method call,
Object[] arg)
Invokes the specified method. |
static void |
main(String[] arg)
Scans the command line arguments for the method to invoke. |
Object |
process(String[] arg)
Parses the command line and invokes the specified method. |
private static Method |
scanForMethod(Remote rmi,
String name,
Object[] arg)
Scans all methods implemented by the remote argument for the one that matches the method name stated. |
static void |
scanRemote(Remote rmi)
Prints out generic information about the methods and fields available for the remote stated. |
| Methods inherited from class util.CommandLineParser |
|---|
getArguments, getCommandLine, getCommands, getRegisteredSwitches, hasAnySwitch, hasSwitch, hasSwitch, haveAllSwitches, parse, printCommandLine, registerLine, registerSwitches, setCommands, staticUsage, usage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String ONESWITCH
private static final String TWOSWITCH
private static final String THREESWITCH
private static final Map<String,String> USE
private static final String FOOT
| Constructor Detail |
|---|
public GenericInvoke()
| Method Detail |
|---|
public Object process(String[] arg)
throws ParseException,
NotBoundException,
RemoteException,
MalformedURLException,
ClassNotFoundException,
NoSuchMethodException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
ParseException
NotBoundException
RemoteException
MalformedURLException
ClassNotFoundException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetExceptionprivate static Class getImplementation(Remote rmi)
private static Method[] getMethods(Remote rmi)
private static Field[] getFields(Remote rmi)
private static Method scanForMethod(Remote rmi,
String name,
Object[] arg)
throws NoSuchMethodException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
rmi - The remote object hosting the method.name - The name of the method.arg - The arguments to the method. For no arguments supply an empty
array.
IllegalArgumentException - If more than one methods match.
NullPointerException - If no method was found
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException
private static Object invoke(Remote rmi,
Method call,
Object[] arg)
throws NoSuchMethodException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetExceptionpublic static void scanRemote(Remote rmi)
public static void main(String[] arg)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||