Java CAPS Management and Monitoring APIs

Setting Up Databases

Derby is the database that ships with Java CAPS. However, you can set up and use another database. But remember, you are limited to using a database that Java CAPS supports.

As an option to the following procedure, you could replace steps 4-6 by using the Alert Configuration Management API to write a groovy script or small Java utility. For an example of this see the JavaCAPS6/ESB_API_KIT/samples directory, if JavaCAPS6 is the directory where you extracted EM_API_KIT.zip.


Caution – Caution –

Remember that the last command you script or program and then execute should be enabling persistence in the specified database. Examples of methods from the Alert Configuration Service API are setPersistenceDataSourceJndiName, getPersistenceDataSourceJndiName, setPersistenceDataBaseType, getPersistenceDataBaseType, and optionally setAlertTableName.

In case the database has a limit to the table name, for example Oracle is limited to 30 characters, the auto-generated table may exceed that limit. Use the Alert Configuration API (SetAlertTableName) to set the table name. Keep in mind that each domain must have unique table name to prevent events from one domain appearing in another domain.


ProcedureTo Set Up a Database Using Enterprise Manager

  1. Start the domain you want to use.

  2. Use the Sun Java System Application Server Admin Console or AS Admin command-line utility to set up a connection pool and resource.


    Note –

    Record the name you assign to the resource name.


    For detailed instructions on how to perform this task see Admin Console online help.

  3. Start the selected database.

  4. Start Enterprise Manager and add the domain you started in step 1.

  5. Launch the Alert Configuration screen (for information see Monitoring Java EE Components).

    1. Select the database type that matches the database you selected.

    2. Enter the JNDI name.


      Note –

      This is the resource name you created in step 2.


  6. Enable persistence and journaling, and then click Save to commit the changes.


    Note –

    When you enable persistence you do not have to enable journaling; that is, journaling is optional when persistence is enabled.


ProcedureTo Set Up a Database Using a Scripting Utility

  1. Start the domain you want to use.

  2. Use the Sun Java System Application Server Admin Console or AS Admin command-line utility to set up a connection pool and resource.


    Note –

    Record the name you assign to the resource name.


    For detailed instructions on how to perform this task see Admin Console online help.

  3. Start the selected database.

  4. Write a scripting utility to call the appropriate APIs.

    setPersistenceDataSourceJndiName
    setPersistenceDataBaseType(AlertPersistenceDBType dbtype)
    (Optional) setAlertTableName(String tableName)
    enableAlertsPersistence(Boolean enableJournaling)

    Or, optionally, to execute all of the above APIs, use:

    enableAlertsPersistence(Boolean enableJournaling,String jndiName,
                                        AlertPersistenceDBType dbtype,Long timeToLive,
                                        Long maxCount,AlertLevelType level,
                                        AlertRemovalPolicyType[] policyList,
                                        Boolean enablePolicyExecution,Long interval,
                                        Integer inMemoryCacheSize) throws
    *                                   ManagementRemoteException;

    Note –

    The order here is not set and can be altered except for enabling persistence, which must be last.