Class DefaultEventManager
- java.lang.Object
-
- de.aristaflow.adept2.base.service.AbstractADEPT2Service
-
- de.aristaflow.adept2.base.service.AbstractNonPrivilegedService
-
- de.aristaflow.adept2.core.eventmanager.common.AbstractEventManager
-
- de.aristaflow.adept2.core.eventmanager.common.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 aConnection
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
AbstractADEPT2Service.ActiveSessions
-
-
Field Summary
Fields Modifier and Type Field Description static String
PLUGIN_TYPE_DB_MEMORY_RESULT_SET_EVENT
The plug-in type ID for memory result set events.static String
PLUGIN_TYPE_DB_RESULT_SET_EVENT
The plug-in type ID for result set events.static String
PLUGIN_TYPE_FILE_EVENT
The plug-in type ID for file events.static String
PLUGIN_TYPE_MAIL_EVENT
The plug-in type ID for mail events.-
Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventManager
activitySelecting, addEventSourceRetryCount, addEventSourceRetryDelay, addService, CONF_ADD_EVENT_SOURCE_RETRY_COUNT, CONF_ADD_EVENT_SOURCE_RETRY_DELAY, CONF_CREATE_WORKLIST_RETRY_DELAY, CONF_CREATE_WORKLIST_SILENT_COUNT, CONF_HANDLER_MIN_POOL_SIZE, CONF_HANDLER_PRIORITY, CONF_HANDLER_QUEUE_LIMIT, CONF_LIB_DIRECTORY, CONF_MIN_LOG_LEVEL_POOL_STATISTICS, CONF_MIN_POOL_SIZE, CONF_POLLER_PRIORITY, CONF_QUEUE_LIMIT_POOL_STATISTICS, CONF_SERVICE_TYPES_FOR_EVENTS, CONF_USE_ONE_WORK_EXECUTOR, createWorklistRetryDelay, createWorklistSilentCount, dataLock, exmFactory, filterFactory, futures, handler, handlerMinPoolSize, handlerPriority, handlerQueueLimit, handlerService, handlerSource, instanceControl, libDirectory, MINIMAL_DELAY, minLogLevelPoolStatistics, minPoolSize, omm, pingWLMInterval, pm, pollerPriority, pollService, PREREGISTERED_EVENT_HANDLER, queueLimitPoolStatistics, reconnectLogLevel, reconnectWLMInterval, resumeOnly, runtimeService, sharedSources, sourceCount, sources, supportedEventTypes, updateInterval, useOneWorkExecutor, worklistHandler
-
Fields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices
-
Fields inherited from interface de.aristaflow.adept2.core.eventmanager.ActivityEventManager
ACT_CONF_EVENT_TYPE, ACT_CONF_RETRY_COUNT, ACT_CONF_RETRY_DELAY, ACT_CONF_SOURCE_ID, ACT_CONF_SOURCE_TYPE, PLUGIN_TYPE_ACTIVITY_EVENT_HANDLER
-
Fields inherited from interface de.aristaflow.adept2.core.eventmanager.EventManager
PLUGIN_TYPE_EVENT_HANDLER
-
-
Constructor Summary
Constructors Modifier Constructor Description DefaultEventManager(org.apache.commons.configuration2.Configuration conf, Registry registry)
Creates a new service polling for DB, mail and file events and handling them appropriately.protected
DefaultEventManager(org.apache.commons.configuration2.Configuration conf, Registry registry, String[] startupRequiredServices, String[] runtimeRequiredServices)
Creates a new service polling for events of registered event types (e. g.protected
DefaultEventManager(org.apache.commons.configuration2.Configuration conf, Registry registry, String[] startupRequiredServices, String[] runtimeRequiredServices, Map<String,Class<? extends Event>> supportedEvents)
Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExtendedConnection
getConnection(String dataSource, boolean readOnly)
Retrieves a connection to the designated data source.Connection
getConnection(String driver, String connectionURL, String userName, String password)
Retrieves a connection to a JDBC-database using the designated information.Connection
getConnection(String driver, String connectionURL, String userName, String password, boolean readOnly)
Retrieves a connection to a JDBC-database using the designated information.-
Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventManager
addEventHandler, addEventHandler, addEventHandler, addEventSource, addPreregistered, addPreregistered, createInstanceDataContainer, createSession, deselectActivity, getEventHandler, getEventSources, getHandlerExecutorService, getInstanceControl, getLatestTemplateReference, getPlugin, getProgressMonitor, getRuntimeEnvironment, getScheduledExecutorService, getService, getSimpleSessionContext, getSupportedEventTypes, getSupportedEventTypes, getTemplateReference, init, mergeEventRequiredServices, removeAllSources, removeEventHandler, removeEventSource, selectActivity, shutdown, start, startActivity, startInstance
-
Methods inherited from class de.aristaflow.adept2.base.service.AbstractNonPrivilegedService
authenticateService, awaitActiveSessions, getSecurityManager, getSessionFactory, simpleInit
-
Methods inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
_sessionActive, _sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, getUserCredentials, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, unprivilegeThread
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, ping, preShutdown
-
Methods inherited from interface de.aristaflow.adept2.core.eventmanager.InstanceStartEventManager
createAndStartInstance
-
-
-
-
Field Detail
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
PLUGIN_TYPE_MAIL_EVENT
public static final String PLUGIN_TYPE_MAIL_EVENT
The plug-in type ID for mail events.- See Also:
- Constant Field Values
-
PLUGIN_TYPE_FILE_EVENT
public static final String PLUGIN_TYPE_FILE_EVENT
The plug-in type ID for file events.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultEventManager
protected DefaultEventManager(org.apache.commons.configuration2.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 benull
nor containnull
values.runtimeRequiredServices
- The services required at runtime of the event manager. This must neither benull
nor containnull
values.- Throws:
ConfigurationException
- If the password for this authenticated service cannot be parsed from the configuration, aConfigurationException
will be thrown.
-
DefaultEventManager
@Deprecated(since="15.0.0", forRemoval=true) protected DefaultEventManager(org.apache.commons.configuration2.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 benull
nor containnull
values.runtimeRequiredServices
- The services required at runtime of the event manager. This must neither benull
nor containnull
values.supportedEvents
- The events supported by subclasses. This may benull
. 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, aConfigurationException
will be thrown.
-
DefaultEventManager
public DefaultEventManager(org.apache.commons.configuration2.Configuration conf, Registry registry) throws ConfigurationException
Creates a new service polling for DB, mail and file events and handling them appropriately.
Subclasses should useDefaultEventManager(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, aConfigurationException
will be thrown.
-
-
Method Detail
-
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, aServiceNotKnownException
will be thrown.SQLException
- If creating the connection to the data source fails, anSQLException
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 benull
.password
- The password to log on a the database with. Depending on the JDBC-driver, this may benull
.- 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, aConfigurationException
will be thrown.SQLException
- If creating the connection to the JDBC-database fails, anSQLException
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 benull
.password
- The password to log on a the database with. Depending on the JDBC-driver, this may benull
.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, aConfigurationException
will be thrown.SQLException
- If creating the connection to the JDBC-database fails, anSQLException
will be thrown.
-
-