Homepage | About EASA | Contact
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:
The next step is to write and compile new code.
Custom code in EASA must either:
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:
Another required file is:
To compile, use:
javac -classpath "easa-com.jar;<EASAROOT>/tomcat/lib/easa-common.jar" MyAction.java
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 example_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:
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) { ex.printStackTrace(); } 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 { } } }
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.
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:
For all Custom Objects described in these pages, you should leave both of the following are checked:
Your jar file has now been uploaded onto the EASA Server.
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:
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.
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:
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.