Defining a service class for Java components – PB Docs 126

Defining a service class for Java components

proc.png To create and register a service class for Java

  1. Make sure your Java service class is in
    the system classpath.

  2. In your Java service class, define one or more
    methods. Method prototypes must match one of these (all event datatypes
    are in the powersoft.datawindow.event package):

    • DBError
      (DatabaseEvent event, DataStore ds)

    • RetrieveEnd (RetrieveEvent event, DataStore ds)

    • RetrieveStart (RetrieveEvent event, DataStore ds)

    • SQLPreview (DatabaseEvent event, DataStore ds)

    • UpdateEnd (UpdateEvent event, DataStore ds)

    • UpdateStart (UpdateEvent event, DataStore ds)

    The arguments are the same as those documented for the similarly
    named DataWindow, Java Edition events in the DataWindow
    , with the exception of the additional DataStore
    argument, which gives the Java class access to the Web DataWindow

  3. In the class methods, set the return codes to
    specify whether the server component should cancel the event.

    The return codes are also the same as those documented in
    the DataWindow Reference. Any of the service
    classes that implements the event can specify that the event be

  4. Register the service classes for the component.

    There are two ways to make the Java class available as a service

    • For any component in EAServer, call the SetServerServiceClasses method
      in the Web page template’s server-side script:

    • For a custom component in EAServer,
      add this property in EAServer Manager:

      Set its value to the list of user object names, with names
      separated by semicolons. For example:


Suppose that you want to check that data did not exceed a
budgeted total before it was updated in the database. You might
set up a service class that implements the UpdateStart event.

The method declaration would be:

The body of this method has a DataStore that retrieves data
from a budget table and compares it to the component’s

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x