Implementing a Custom Parser Extension

Implement the custom parser extension in a message definition.

  1. Configure a Java project and Java builder settings.
  2. Write custom logic to parse a field type and implement the com.sybase.jtf.parser.api.IParseExtension interface.

    The result is a custom class that is an extension point of a field. The parsed field data is passed in represented as a byte array. The return value is the newly modified field data, which is inserted into the runtime field data container.

  3. Export the custom code as a JAR file and put the file into the CustomClasses directory under the MessageDesigns directory.
  4. If the custom code JAR file requires supporting JAR files, put the supporting JAR files in CustomClasses directory as well.
  5. Modify the Class-Path variable for the custom code JAR file and supporting JAR files.

    For example:

    $ cat manifestChange.txt 
     Class-Path: MyUtils.jar
    $ jar ufm customField.jar manifestChange.txt 
    
    Note: For more information about adding classes to the JAR file's classpath, see Adding Classes to the JAR File's Classpath on the Sun Java Tutorials documentation Web site.

    The Message Designer can now instantiate the class when the custom field JAR is loaded in the following steps when you insert the custom field code into a message definition and at runtime.

  6. To start Sybase WorkSpace, select Start > Programs > Sybase > Sybase WorkSpace > Sybase WorkSpace <version>.
  7. To start the Service Container server, select Start > Programs > Sybase > Sybase WorkSpace > SC <version> > Start SC.
  8. In the WorkSpace Navigator of the Service Development perspective, expand the project folder that contains the message definition with which you want to work, then expand the MessageDesigns and MessageDefinitions folders.
  9. Double-click the message definition file, which has a .wfim file name extension.

    The message definition file opens in the Message Definition editor.

  10. Select the Message Details tab.
  11. In the Message Definition pane, expand the message definition containers and select the field in which to use the custom field code.
  12. In the Field Properties pane, select the Custom Parse Extension, then click the ellipsis button to the right of that option.

    The Custom Parse Extension dialog box opens.

  13. Select the custom field JAR and the class desired for the field, then click OK.

    Repeat this step to add the custom field code to other fields in the message definition.

  14. Select File > Save from the main menu bar.

    The custom code is added to a message definition.

Next 

Test the message definition.

Related tasks
Developing a Message Definition
Developing a Custom Class to Transform a Message Definition Field
Implementing a Custom Field Parser
Implementing a Custom Field Serializer
Adding a Field to a Message Definition
Related reference
Custom Parser Extensions

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.