Developing a Handler

The handler for a component is provided by composing a Java class that can be instantiated and called by Isight at various times to perform the aforementioned functionality.

The main requirement that must be adhered to is that your Handler must ultimately implement Isight-provided interfaces com.engineous.sdk.component.ComponentHandler and com.engineous.sdk.model.SystemExtension. However, the Isight SDK also provides an abstract class, com.engineous.sdk.component.DefaultComponentHandler, that extends both of these interfaces, which allows you to implement only the methods you need.

A component handler must not call native (non-Java) code, nor cause the loading of any native code library into the JVM (e.g., it must not call System.loadLibrary()). For more information on using native code in components, see Non-Java Code Considerations.

The optional methods available to implement are:

  • initHandler. Called to initialize the Handler and to give a handle to the component object.

  • addedToModel. Called when the component is added to a Model.

  • modelLoaded. Called when the Model is loaded, allowing you to perform any initialization that may require the entire model to be fully loaded.

  • removedFromModel. Called if the component is removed from a Model.

  • destroy. Called to destroy the Handler.

  • modelChanged. Called if any changes occur in the Model, such as adding, deleting, renaming parameters, etc.

  • validate. Called to check if the component has a valid configuration.

  • getUsedParameters. Called to get a list of all parameters used by the component so that a list of unused parameters can be created.

  • diff. Called when two models are being compared so that any differences between the configurations of two instances of the same component can be reported.

Note: DefaultComponentHandler provides a default implementation of this method that compares parameters, control/data flow, approximations, and a number of general properties. If you extend this class and implement this method, it is very important that you call super.diff (<args>) to retain this general comparison before performing other component-specific comparisons. Alternatively, you can implement the protected diffConfiguration method supplied by the DefaultComponentHandler, which is called from the general diff method. See DefaultComponentHandler in the javadoc for more information.

A Handler template that includes stubs for function calls that you might need to make is provided in ComponentHandler.java.