Developing an API

The API for a component is provided by composing a Java class that can be instantiated and called by Isight as needed.

The main requirement that must be adhered to is that your API class must ultimately implement the Isight-provided interface com.engineous.sdk.component.ComponentAPI. However, the Isight SDK also provides an abstract class, com.engineous.sdk.component.DefaultComponentAPI, that implements this interface and allows you to implement only the methods you need.

The methods available to implement are:

initialize

This method will be called by the infrastructure when an application makes a call to getAPI() for a DtComponent. Your overriding implementation of this method should call super.initialize(), which obtains all the general property information from the component, and then get any component-specific property values to keep them locally to be configured.

apply

The application programmer is instructed to call apply() when finished configuring the component. Your overriding implementation of this method should call super.apply(), which stores all the general property information from the component, and then store any component-specific configuration from local variables into the appropriate properties in the component.

get/set/add/call

The primary methods you must provide to allow programmatic configuration of your component will follow the pattern getItemX, setItemX, or addItemX, where ItemX is some meaningful configuration option for your component; for example, getExpression, setExpression, or addCalculation.

To ensure that the application programmer does not need direct access to your API class (i.e., does not need to import it), the calls to your methods will be made by the infrastructure through Java reflection. For example, if you provide a method called setInputFileName(String filename), the application programmer will make the call set("inputfilename", "myinputfile.txt") and the infrastructure will find the corresponding method in your API class.

There are multiple signatures for sending in different numbers and combinations of arguments that you will find on the ComponentAPI interface. You can also provide methods that do not follow the get/set/add prefix pattern; for those methods, the application programmer will invoke call("methodname", <args>).

Because of the way the component API works using generic get/set/add/call methods and reflection, it is important that you document the keywords that an application developer can use with your component API along with the arguments that must be provided with those calls.