Interface BBjAdminAsynchTriggerJob

All Superinterfaces:
BBjAdminCommitPropertyWriter, BBjAdminCommitWriter, BBjAdminPropertyReader, BBjAdminPropertyWriter, BBjAdminReplicationJob, Remote, Serializable

public interface BBjAdminAsynchTriggerJob extends BBjAdminReplicationJob

A single asynchronous trigger job configured on the system. An asynchronous trigger job consists of a list of directories and/or files to monitor for changes, a BBj program to be run when a monitored file is written to, and another program to execute when a file has a record removed from it.

These triggers differ from standard file triggers in that the file operation does not wait for the trigger operation to complete, before continuing. This means there is almost no overhead on the file system. Further, these triggers can be configured to run on a remote BBj Services installation to allow the administrator to distribute the interpreter workload to another machine.

Take special note that BBjAdminAsynchTriggerJob extends the BBjAdminReplicationJob interface which means the methods and properties on BBjAdminReplicationJob are also present for BBjAdminAsynchTriggerJob. This is due to the fact that the asynchronous triggers are built on top of the replication framework and operate in a similar fashion.

The following code sample show how to interact with a BBjAdminAsynchTriggerJob to get its enabled status as well as find out if there is currently an error condition on the job:

Java Sample

import com.basis.api.admin.BBjAdminBase;
import com.basis.api.admin.BBjAdminFactory;
import com.basis.api.admin.BBjAdminList;
import com.basis.api.admin.BBjAdminAsynchTriggerJob;

...
// Get the API instance
BBjAdminBase api = BBjAdminFactory.getBBjAdmin(InetAddress.getByName("myserver"), 2002, true, "admin", "mypassword");

// Get the list of asynchronous trigger jobs
BBjAdminList jobList = api.getAsynchTriggerJobs();

// Check each job to see if an error is present on any of them.
for (int j = 0; j < jobList.size(); j++) {
    BBjAdminAsynchTriggerJob job = jobList.get(j);
    String jobName = job.getString(BBjAdminAsynchTriggerJob.NAME);
    if (!job.getBoolean(BBjAdminAsynchTriggerJob.ENABLED)) {
        System.out.println("Job " + jobName + " is not currently enabled.");
    }
    if (job.getCurrentError() != null) {
        System.out.println("Job " + jobName + " currently has a problem: " + job.getCurrentError().getMessage());
    }
}

// Release the API instance
api.release();

BBj Sample

REM Get the API instance
api! = BBjAdminFactory.getBBjAdmin("admin", "admin123")

REM Get the list of asynchronous trigger jobs
jobList! = api!.getAsynchTriggerJobs()

REM Check each job to see if an error is present on any of them.
for j = 0 to jobList!.size() - 1
    job! = jobList!.get(j)
    jobName$ = job!.getString(BBjAdminAsynchTriggerJob.NAME)
    if job!.getBoolean(BBjAdminAsynchTriggerJob.ENABLED) = 0 then
        PRINT "Job " + jobName$ + " is not currently enabled."
    endif
    if job!.getCurrentError() <> NULL() then
        PRINT "Job " + jobName$ + " currently has a problem: " + job!.getCurrentError().getMessage()
    endif
next j

REM Release the API instance.
api!.release()
  • Field Details

    • HOST

      static final String HOST
      Host name for the filesystem server where the trigger job will execute the BBj code to handle the trigger.
      See Also:
    • PORT

      static final String PORT
      Port number for the filesystem server where the trigger job will execute the BBj code to handle the trigger. Typically this will be 2000.
      See Also:
    • SSL

      static final String SSL
      True if the filesystem server where the trigger job will execute the BBj code to handle the trigger is using SSL. Must match that server's configuration.
      See Also:
    • WORKING_DIR

      static final String WORKING_DIR
      Working directory where the trigger will execute the BBj handler code on the remote machine.
      See Also:
    • CONFIG

      static final String CONFIG
      config.bbx to use when the trigger will execute the BBj handler code on the remote machine.
      See Also:
    • USER

      static final String USER
      User to use to connect to the filesystem server where the trigger job will execute the BBj code to handle the trigger.
      See Also:
    • PASSWORD

      static final String PASSWORD
      Password to use to connect to the filesystem server where the trigger job will execute the BBj code to handle the trigger.
      See Also:
    • USE_DEFAULT_ALIAS

      static final String USE_DEFAULT_ALIAS
      See Also:
    • WRITE_PROGRAM

      static final String WRITE_PROGRAM
      Write program to use to handle write operations when a monitored file is written to.
      See Also:
    • REMOVE_PROGRAM

      static final String REMOVE_PROGRAM
      Remove program to use to handle remove operations when a monitored file has a record removed.
      See Also:
  • Method Details

    • getFiles

      BBjAdminList<String> getFiles()
      Returns a list of files and directories that will be monitored. When one of these files is modified, it will trigger the configured write/remove BBj program to execute, passing in the information about the specific operation that occurred such as the record written, the key used for a remove, etc.
      Returns:
      List of directories and files being monitored
    • addFile

      void addFile(String p_file, boolean p_advisory, String p_modes) throws BBjAdminException
      Adds the specified file to the list of files being monitored.
      Parameters:
      p_file - Full path to the file to be added to the job.
      p_advisory - True if the system should use advisory locking to open the file.
      p_modes - Any mode string necessary to properly access the file (i.e. encrypted file info, etc.).
      Throws:
      BBjAdminException
    • removeFile

      void removeFile(String p_file) throws BBjAdminException
      Removes the specified file from the list of files being monitored.
      Parameters:
      p_file - Full path to the file to remove from the job.
      Throws:
      BBjAdminException
    • clearFiles

      void clearFiles() throws BBjAdminException
      Clears the entire list of files being monitored.
      Throws:
      BBjAdminException
    • clearExclusions

      void clearExclusions() throws BBjAdminException
      Clears all exclusions configured for the job.
      Throws:
      BBjAdminException
    • addExclude

      void addExclude(String p_source) throws BBjAdminException
      Adds a file to the list of files to exclude from being monitored. This gives you the ability to add an entire directory, but then go and exclude particular files from the job.
      Parameters:
      p_source - Full path to file to exclude.
      Throws:
      BBjAdminException
    • getExclusions

      List<String> getExclusions() throws BBjAdminException
      Returns a list of the excluded files and directories.
      Returns:
      List of files and directories being excluded from the job.
      Throws:
      BBjAdminException
    • addRegexInclude

      void addRegexInclude(String p_sourceDir, String p_pattern, String p_destinationDir, boolean p_recursive, boolean p_matchPath, boolean p_advisory, String p_modes) throws BBjAdminException
      Adds a new file/directory to the list of files/directories being monitored by this trigger job. When any changes occur to the file or files in the directory, it will cause the handler write/remove programs to be executed on the target machine. Use regular expressions for matching pattern.
      Parameters:
      p_sourceDir -
      p_pattern -
      p_destinationDir -
      p_recursive -
      p_matchPath -
      p_advisory -
      p_modes -
      Throws:
      BBjAdminException
    • addRegexExclude

      void addRegexExclude(String p_sourceDir, String p_pattern, String p_destinationDir, boolean p_recursive, boolean p_matchPath, String p_modes) throws BBjAdminException
      Adds a new file/directory to the list of files/directories being excluded by this trigger job. This is used to exclude specific files/directories from a monitored directory if you do not want all files in a monitored directory to be handled.
      Parameters:
      p_sourceDir -
      p_pattern -
      p_destinationDir -
      p_recursive -
      p_matchPath -
      p_modes -
      Throws:
      BBjAdminException
    • addGlobInclude

      void addGlobInclude(String p_sourceDir, String p_pattern, String p_destinationDir, boolean p_recursive, boolean p_matchPath, boolean p_advisory, String p_modes) throws BBjAdminException
      Adds a new file/directory to the list of files/directories being monitored by this trigger job. When any changes occur to the file or files in the directory, it will cause the handler write/remove programs to be executed on the target machine. Use * for wildcard for matching patterns.
      Parameters:
      p_sourceDir -
      p_pattern -
      p_destinationDir -
      p_recursive -
      p_matchPath -
      p_modes -
      Throws:
      BBjAdminException
    • addGlobExclude

      void addGlobExclude(String p_sourceDir, String p_pattern, String p_destinationDir, boolean p_recursive, boolean p_matchPath, String p_modes) throws BBjAdminException
      Adds a new file/directory to the list of files/directories being excluded by this trigger job. This is used to exclude specific files/directories from a monitored directory if you do not want all files in a monitored directory to be handled.
      Parameters:
      p_sourceDir -
      p_pattern -
      p_destinationDir -
      p_recursive -
      p_matchPath -
      p_modes -
      Throws:
      BBjAdminException
    • getIncludeFilters

      Returns a list of all the include filters used by this asynchronous trigger job.
      Returns:
      List of all the include filters.
      Throws:
      BBjAdminException
    • getExcludeFilters

      Returns a list of all the exclude filters used by this asynchronous trigger job.
      Returns:
      List of all the exclude filters.
      Throws:
      BBjAdminException
    • clearInclusions

      void clearInclusions() throws BBjAdminException
      Clears the list of all included filters.
      Throws:
      BBjAdminException