Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 4. Operations on M-Beans[ Fast Forward ][ Next ]

Invoking M-Bean Actions

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:

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 );


[ Previous ][ Home ][ Next ]
Getting and Setting Properties[ Up ]Adaptors