Class DefaultEventManager

All Implemented Interfaces:
ADEPT2Service, LogService, ServiceThreadHandling, ActivityEventManager, EventManager, InstanceStartEventManager

public class DefaultEventManager extends AbstractEventManager
The default event manager supports arbitrary events (e. g. events based on SQL databases, (incoming) mails and changes in the file system) and provides access to a Connection.
  • Field Details

    • PLUGIN_TYPE_DB_RESULT_SET_EVENT

      public static final String PLUGIN_TYPE_DB_RESULT_SET_EVENT
      The plug-in type ID for result set events.
      See Also:
    • PLUGIN_TYPE_DB_MEMORY_RESULT_SET_EVENT

      public static final String PLUGIN_TYPE_DB_MEMORY_RESULT_SET_EVENT
      The plug-in type ID for memory result set events.
      See Also:
    • PLUGIN_TYPE_MAIL_EVENT

      public static final String PLUGIN_TYPE_MAIL_EVENT
      The plug-in type ID for mail events.
      See Also:
    • PLUGIN_TYPE_FILE_EVENT

      public static final String PLUGIN_TYPE_FILE_EVENT
      The plug-in type ID for file events.
      See Also:
  • Constructor Details

    • DefaultEventManager

      protected DefaultEventManager(Configuration conf, Registry registry, String[] startupRequiredServices, String[] runtimeRequiredServices) throws ConfigurationException
      Creates a new service polling for events of registered event types (e. g. DB, mail and file events) and handling them appropriately. This constructor is for subclasses allowing to extend the startup and runtime required services.
      Parameters:
      conf - The configuration of this event manager.
      registry - The registry for retrieving the services required by this service.
      startupRequiredServices - The services required by subclasses for starting and shutting down the event manager. This must neither be null nor contain null values.
      runtimeRequiredServices - The services required at runtime of the event manager. This must neither be null nor contain null values.
      Throws:
      ConfigurationException - If the password for this authenticated service cannot be parsed from the configuration, a ConfigurationException will be thrown.
    • DefaultEventManager

      @Deprecated(since="15.0.0", forRemoval=true) protected DefaultEventManager(Configuration conf, Registry registry, String[] startupRequiredServices, String[] runtimeRequiredServices, Map<String,Class<? extends Event>> supportedEvents) throws ConfigurationException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new service polling for DB, mail and file events and handling them appropriately. This constructor is for subclasses allowing to extend the startup and runtime required services as well as the supported event types.
      Parameters:
      conf - The configuration of this event manager.
      registry - The registry for retrieving the services required by this service.
      startupRequiredServices - The services required by subclasses for starting and shutting down the event manager. This must neither be null nor contain null values.
      runtimeRequiredServices - The services required at runtime of the event manager. This must neither be null nor contain null values.
      supportedEvents - The events supported by subclasses. This may be null. The keys of this map will be used to preregister event sources and handlers.
      Throws:
      ConfigurationException - If the password for this authenticated service cannot be parsed from the configuration, a ConfigurationException will be thrown.
    • DefaultEventManager

      public DefaultEventManager(Configuration conf, Registry registry) throws ConfigurationException
      Creates a new service polling for DB, mail and file events and handling them appropriately.
      Subclasses should use DefaultEventManager(Configuration, Registry, String[], String[], Map) instead from their registry-conform public constructor.
      Parameters:
      conf - The configuration of this event manager.
      registry - The registry for retrieving the services required by this service.
      Throws:
      ConfigurationException - If the password for this authenticated service cannot be parsed from the configuration, a ConfigurationException will be thrown.
  • Method Details

    • getConnection

      public ExtendedConnection getConnection(String dataSource, boolean readOnly) throws ServiceNotKnownException, SQLException
      Retrieves a connection to the designated data source.
      Parameters:
      dataSource - The simple instance name of the data source to which to retrieve a connection.
      readOnly - whether the returned connection will be used as read-only
      Returns:
      A connection to the designated data source.
      Throws:
      ServiceNotKnownException - If the designated data source cannot be retrieved from the registry, a ServiceNotKnownException will be thrown.
      SQLException - If creating the connection to the data source fails, an SQLException will be thrown.
    • getConnection

      public Connection getConnection(String driver, String connectionURL, String userName, String password) throws ConfigurationException, SQLException
      Retrieves a connection to a JDBC-database using the designated information.
      Parameters:
      driver - The fully-qualified name of the class of the JDBC-driver.
      connectionURL - The URL to connect to the database.
      userName - The name of the user to log on at the database with. Depending on the JDBC-driver, this may be null.
      password - The password to log on a the database with. Depending on the JDBC-driver, this may be null.
      Returns:
      A connection to a JDBC-database using the designated information.
      Throws:
      ConfigurationException - If the designated JDBC-driver cannot is not found or cannot be instantiated, a ConfigurationException will be thrown.
      SQLException - If creating the connection to the JDBC-database fails, an SQLException will be thrown.
    • getConnection

      public Connection getConnection(String driver, String connectionURL, String userName, String password, boolean readOnly) throws ConfigurationException, SQLException
      Retrieves a connection to a JDBC-database using the designated information.
      Parameters:
      driver - The fully-qualified name of the class of the JDBC-driver.
      connectionURL - The URL to connect to the database.
      userName - The name of the user to log on at the database with. Depending on the JDBC-driver, this may be null.
      password - The password to log on a the database with. Depending on the JDBC-driver, this may be null.
      readOnly - whether the returned connection will be used as read-only
      Returns:
      A connection to a JDBC-database using the designated information.
      Throws:
      ConfigurationException - If the designated JDBC-driver cannot is not found or cannot be instantiated, a ConfigurationException will be thrown.
      SQLException - If creating the connection to the JDBC-database fails, an SQLException will be thrown.