Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 4. Operations on M-Beans | ![]() | ![]() |
By calling the framework's invokePerform method, you can invoke any action of any registered m-bean. The design patterns for m-beans specify an action to be a method whose name has the form performAction( ... ).
The invokePerform method has the following parameters:
ObjectName object: this must be a unique object name to identify the object and instance to be invoked.
String actionName: this is the name of the action, without its perform prefix.
Object[] params: these are the actual parameters to the performAction method.
String[] sig: this is the signature of the performAction method, each string being the class name of the parameter in the corresponding position.
The framework uses the object name to find the target m-bean, and then it uses the metadata service to locate and call the method with the given action name and signature.
The invokePerform returns an Object type which contains the result of the performAction call for the particular m-bean. Example 4-12 shows how to invoke an action on a fictional m-bean through the framework.
Example 4-12. Invoking an M-Bean Action
ObjectName target = new ObjectName ("bankHost:account.id=123456,owner=smith"); String[] paramTypes = { "java.lang.String", "java.lang.Float" }; Object[] paramVals = { "1999.03.22", new Float( 100.0 ) }; Float remaining = (Float) cmf.invokePerform( target, "withdrawl", paramTypes, paramVals ); |
![]() | ![]() | ![]() |
Getting and Setting Properties | ![]() | Adaptors |