Apama 10.3 | Apama Documentation | Building and Using Apama Dashboards | Building Dashboard Clients | Defining Dashboard Commands | Creating custom commands | Developing a custom-command library
Developing a custom-command library
A sample implementation of ICommandLibrary is included below in Sample ICommandLibrary implementation.
You can find a sample implementation of ICommandLibrary in the following file:
Your implementation of ICommandLibrary must implement the following methods:
*getCommandDescriptors: Creates a command descriptor for each function that the library supports; returns a list of com.apama.dashboard.command.ICommandDescriptors. This method is called once at data server or display server startup.
*invokeCommand: Performs the command with the specified name, using the specified arguments.
When you compile your implementation, ensure that ap-dashboard-client.jar is on your class path. This jar file is in the lib directory of your Apama installation.
Your implementation of invokeCommand can set or retrieve substitution values, if necessary, by using the following methods of com.apama.dashboard.DashboardManager and com.apama.dashboard.IDashboardContext:
*DashoardManager.getCommandDashboardContext: This static method returns an instance of IDashboardContext.
*IDashboardContext.getSubstitutionValue: Gets the value of a substitution with a given name.
*IDashboardContext.setSubstitution: Sets the value of a substitution with a given name.
*IDashboardContext.setSubstitutions: Sets the values of substitutions, where the substitutions and values are specified with String vectors.
Each set method has a boolean argument, triggerUpdate, which controls whether objects attached to the substitution are updated. If it is false, they are not. If the substitutions are only used as command parameters or in drilldowns, you can improve performance by specifying false.
Following is an example:
import com.apama.dashboard.DashboardManager;
import com.apama.dashboard.IDashboardContext;
IDashboardContext ctxt =
String val1 = ctxt.getSubstitutionValue("$subst1");
ctxt.setSubstitution("$subst2", "val2", false);

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.