User Tools

Site Tools

Custom Code Implementation

Before writing any Java code, review the custom objects available in EASA:

The object to be implemented will determine the details of the custom code implementation.

The EASA API Java documentation is found at:

  • EASA→Administrator→Configure→'View interface documentation'

The next step is to write and compile new code.

Compile Custom Code

Custom code in EASA must either:

  • implement an existing Java interface
  • extend an existing abstract class

For example, a new class MyAction might implement each of the methods of the CustomAction interface, below:

  public class MyAction implements CustomAction { 

Download the EASA Java interfaces file, easa-com.jar from:

  • EASA→Administrator→Configure→Custom Code→'Download Java Interfaces'

Another required file is:

  • <EASAROOT>/tomcat/lib/easa-common.jar

To compile, use:

  javac -classpath "easa-com.jar;<EASAROOT>/tomcat/lib/easa-common.jar" 

Where javac is the command to run the standard Java compiler supplied by Sun Microsystems and <EASAROOT> is the install folder for EASA. The Java compiler used should be for Java version 1.5 or higher.

If successful, a file, MyAction.class, will be created.

For a long list of complete examples see Custom Code Examples.

Test Custom Code

Once you have written and compiled your custom code, you should test your new class files before distributing them to all possible users of the new Custom Objects.

There are two forms of testing that should take place:

  1. Manual testing of your custom code prior to loading it onto your EASA Server, and
  2. testing within EASA prior to sending it out to all other users.

Manual Testing

To test your custom code outside of EASA will require you to write and compile a new test class that contains the main() method, so that it can run as a stand alone program. Once you have this test class written and compiled, you can run it from a command prompt. An example of test code for testing a CUSTOM SCALAR is provided below:
  import java.util.*;  
  import com.mycompany.mypackage.MyCustomScalar; 
  import com.easa.dor.DOREvaluator; 
  import com.easa.dor.CustomScalar; 
  public final class TestScalarDor { 
    public final static void main(final String [] args) { 
    try { 
      CustomScalar scalar = new MyCustomScalar(); 
      DOREvaluator eval = new TestEvaluator(); 
      final Object value = scalar.getValue(“myDor”); 
      if (!value.toString().equals(100)) { 
        throw new Exception(“Wrong Value”); 
      } catch (Exception ex) { 
  private static class TestEvaluator implements DOREvaluator { 
    // return 10 for all DORs in this test. 
    public String getValue (String dor){ 
      return 10; 
    public List getValues(String dor){
      return null; 
    public String expandString(String delimiter, String dor){
      return null; 
    public Map getParameters()){ 
      return null;
    public String getObjectName()){
      return null;
    public void checkName(Object dorName) throws Exception { 

Testing in EASA

Custom Action objects can be tested in EASA without releasing them to the rest of the users on your EASA System by manually updating only your EASA Client installation. To update your client, all you need to do is place a copy of your jar file in the custom folder within your EASA Client installation. On a Windows computer the default EASA Client location would be:

C:\EASA Client\custom 

Next, you need to update the relevant properties file as described below. After updating the properties file, you can start using your custom objects within an EASAP by creating a CUSTOM ACTION under an Event Processing object in EASAP Builder. To make this new object run your custom code, you specify the full class name of your code as the value of the Class parameter of the object.

Then fill in any additional new parameter values that your custom code generates and then test changes in the EASAP as appropriate. To test the Custom Action, you will most likely need to open a test EASAP on the Testing page and then trigger the events that cause the Custom Action to be performed.

Uploading Custom Code Files

Now that you have thoroughly tested your custom code, you should be ready to allow other authors and users to make use of the new custom objects that you have created. The first step in making custom objects accessible by other others is to upload your code onto the EASA Server.

To upload your custom code, the first step is to put all your class files into a Java Archive (jar) file using the jar command as follows:

     jar -cvf MyCustomCode.jar MyCustomCode.class

Next, after putting your class files into a jar file, you upload the jar file by performing the following steps:

  • Select EASA→Administrator→Configure→Custom Code* tab.
  • Click on either the Upload or Remove jar files links.
  • Under Upload Jar File
    • Click on the Browse button
    • Find
    • Select
    • Open the jar file.
  • Click on the Upload button.

For all Custom Objects described in these pages, you should leave both of the following are checked:

  • For use on Client
  • For use on Server

Your jar file has now been uploaded onto the EASA Server.

Updating Properties Files

The second step in making custom objects accessible by others is to modify the appropriate Property file in EASA. There is a separate Property file for each type of Custom Object that has been described in this section, and the files are listed in the table below.

Once you have identified the Property file that needs to be modified for your custom code, you edit the file by performing the following steps:

  1. Select Custom Code under the Configure tab in Administrator mode in EASA.
  2. Click on the Update property files link.
  3. Find the appropriate Property file in the table and click on its Edit button () to open the file in a text editor.
  4. Add a line in the file containing the full class name of your custom code.
  5. Save the file and exit the text editor.

By adding your class to the appropriate file, it will now show up in a pull down list in the Class Parameter of the appropriate Custom Object in EASAP Builder. Therefore, other authors will be able to select it and make use of it.

Updating the EASA Server

The final step is to update the EASA Server to fully recognize your custom code. To update the EASA Server, please perform the following steps:

  1. Select EASA→Administrator→Configure→Custom Code tab.
  2. Click on the Update Server link.
  3. Click on the Update button.

After updating the EASA Server, your custom code will be fully recognized by your EASA System and is now ready to be used by other users in your organization.