This document is a brief introduction to the process of adding a new component to ECT, which should not be too difficult if you are a competent Java developer. It assumes that you are already familiar with using ECT, and that you have experimented with a number of pre-written components.
The simplest way to start developing a new component is to obtain the source code for ECT, as this includes a number of template components that can be extended. Read the Building ECT document for instructions on how do do this. Note that source code for a particular ECT release can also be obtained by downloading the full ECT archive (rather than the webstart archive).Knowledge of using Apache Ant is assumed in the rest of this document. This document also assumes that you are familiar with the JavaBeans concept. If not, you should read up on this. Take a look at Sun's Java Bean information pages and particularly the JavaBeans tutorial.
Once you have worked through this document, you should also read the Component reference for more detailed information about component development, and the Documentation reference for more detailed information about writing documentation for components.
Finally, the best way to learn how to develop ECT components is to look at existing examples, many of which are supplied with ECT. If you have any questions about ECT development, please join our mailing list, as we will be happy to help you resolve them.
At its simplest, an ECT component is just a JavaBean, packaged as a JAR. To take a look at some of the beans included with ECT already, take a look in the webstart/download/java/components directory in your ECT installation - each file you find here (eg template-component.jar will contain at least one bean, and possibly more (eg template-component.jar currently contains two). If you have any pre-written java beans, you should just be able to place them into this directory, and they should become available to ECT the next time you start it. So, if you can develop a JavaBean, then you can develop an ECT component, and all you need to know is how to add such a bean into a particular installation.
In more detail, you'll notice that components in ECT normally define a number of properties. For example, the template component distributed with ECT defines a number of properties called input and output. These are implemented in the source file for the template component as pairs of methods called setInput and getInput, and setOutput and getOutput (see file /src/equip/ect/components/templates/Template.java) . When a user uses the graphical interface to modify property input, then the ECT system causes the setInput method on the corresponding component to be called, As well, if ECT ever needs to check the value of this property, is calls getInput to obtain the current propertly value.
Although it is possible to construct a bean outside of ECT, and then to import that bean into ECT, this approach is not recommended. For each bean, as well developing a valid class file conforming to the JavaBean spec (eg Template.java) you would have to construct a BeanInfo class (eg TemplateBeanInfo.java) and a manifest file (eg manifest.mft) and package all these files into the correct structure inside a JAR. This process is slightly tricky, and mistakes can be made which can slow bean development.
As an alternative, the ECT build system provides a number of tools to help with the process of constructing a bean. To a first approximation, all you have to do is write your bean source file (eg Template.java), add a new target to the ECT build file (build.xml), and if you have set things up properly, ECT will generate a valid bean info, package up your bean, and copy it to the correct installation automatically. This approach saves a lot of time and errors!The following instructions assume that you have checked out module ect into directory <ect_home>.