|
Cumulus4j API (1.1.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cumulus4j.store.crypto.keymanager.messagebroker.AbstractMessageBroker
org.cumulus4j.store.crypto.keymanager.messagebroker.pmf.MessageBrokerPMF
public class MessageBrokerPMF
PersistenceManagerFactory
-backed implementation of MessageBroker
.
All messages
are transferred via a shared database. Which database to be used can be
configured by system properties
.
Field Summary | |
---|---|
static String |
SYSTEM_PROPERTY_CLEANUP_TIMER_ENABLED
System property to control whether the timer for cleaning up old PendingRequest s should be enabled. |
static String |
SYSTEM_PROPERTY_CLEANUP_TIMER_PERIOD
System property to control when the timer for cleaning up old PendingRequest s is called. |
static String |
SYSTEM_PROPERTY_PERSISTENCE_PROPERTIES_PREFIX
Prefix for system properties used to configure the PersistenceManagerFactory . |
Fields inherited from interface org.cumulus4j.store.crypto.keymanager.messagebroker.MessageBroker |
---|
SYSTEM_PROPERTY_POLL_REQUEST_TIMEOUT, SYSTEM_PROPERTY_QUERY_TIMEOUT |
Constructor Summary | |
---|---|
MessageBrokerPMF()
Create an instance of MessageBrokerPMF . |
Method Summary | |
---|---|
protected Request |
_pollRequest(String cryptoSessionIDPrefix)
Delegate of the AbstractMessageBroker.pollRequest(String) method. |
protected void |
_pushResponse(Response response)
Delegate of the AbstractMessageBroker.pushResponse(Response) method. |
protected Response |
_query(Class<? extends Response> responseClass,
Request request)
Delegate of the AbstractMessageBroker.query(Class, Request) method. |
protected PersistenceManager |
createTransactionalPersistenceManager()
|
protected boolean |
getCleanupTimerEnabled()
Get the enabled status of the timer used to cleanup. |
protected long |
getCleanupTimerPeriod()
|
Methods inherited from class org.cumulus4j.store.crypto.keymanager.messagebroker.AbstractMessageBroker |
---|
getPollRequestTimeout, getQueryTimeout, pollRequest, pushResponse, query |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SYSTEM_PROPERTY_PERSISTENCE_PROPERTIES_PREFIX
PersistenceManagerFactory
.
Every system property that begins with "cumulus4j.MessageBrokerPMF.persistenceProperties."
is passed (after truncating this prefix, of course) to the JDOHelper.getPersistenceManagerFactory(Map)
.
For example, to set the property "javax.jdo.option.ConnectionURL", you have to define the system property "cumulus4j.MessageBrokerPMF.persistenceProperties.javax.jdo.option.ConnectionURL".
A set of defaults is loaded from a resource file, hence you do not need to configure everything, but without setting some basic coordinates (e.g. the JDBC URL), it is unlikely that your database server can be contacted. Of course, you could add an appropriate host record to your "/etc/hosts" and create a database with the name from our defaults on this host, but very likely you want to override these default coordinates:
These defaults might be changed with a future version.
public static final String SYSTEM_PROPERTY_CLEANUP_TIMER_PERIOD
System property to control when the timer for cleaning up old PendingRequest
s is called. The
value configured here is a period, i.e. the timer will be triggered every X ms (roughly).
If this system property is not present (or not a valid number), the default is 3600000 (1 hour), which means
the timer will wake up once every hour and call removeExpiredPendingRequests(boolean)
with force = true
.
All PendingRequest
s with a lastStatusChangeTimestamp
being older than the queryTimeout
(plus a safety margin of currently
this period) are deleted.
SYSTEM_PROPERTY_CLEANUP_TIMER_ENABLED
,
Constant Field Valuespublic static final String SYSTEM_PROPERTY_CLEANUP_TIMER_ENABLED
System property to control whether the timer for cleaning up old PendingRequest
s should be enabled. The
value configured here is a boolean value, i.e. it can be "true" or "false".
If it is disabled, the "normal" threads will do the clean-up-work periodically, when they run through
_query(Class, Request)
or _pollRequest(String)
.
SYSTEM_PROPERTY_CLEANUP_TIMER_PERIOD
,
Constant Field ValuesConstructor Detail |
---|
public MessageBrokerPMF()
MessageBrokerPMF
. You should not call this constructor directly, but
instead use MessageBrokerRegistry.getActiveMessageBroker()
to obtain the currently active MessageBroker
.
Method Detail |
---|
protected long getCleanupTimerPeriod()
protected boolean getCleanupTimerEnabled()
Get the enabled status of the timer used to cleanup.
This value can be configured using the system property "cumulus4j.MessageBrokerPMF.cleanupTimer.enabled".
SYSTEM_PROPERTY_CLEANUP_TIMER_PERIOD
,
SYSTEM_PROPERTY_CLEANUP_TIMER_ENABLED
protected PersistenceManager createTransactionalPersistenceManager()
protected Response _query(Class<? extends Response> responseClass, Request request) throws TimeoutException, ErrorResponseException
AbstractMessageBroker
AbstractMessageBroker.query(Class, Request)
method. Subclasses should implement this method instead of query(...)
.
_query
in class AbstractMessageBroker
responseClass
- the type of the expected response; can be null, if you expect to receive null (i.e. you pass a "void" request).request
- the request to be sent to the key-manager.
null
, if the key-manager replied with a NullResponse
.
TimeoutException
- if the request was not replied within the query-timeout
.
ErrorResponseException
- if the key-manager (either running embedded on the remote client or
in a separate key-server) sent an ErrorResponse
.protected Request _pollRequest(String cryptoSessionIDPrefix)
AbstractMessageBroker
AbstractMessageBroker.pollRequest(String)
method. Subclasses should implement this method instead of pollRequest(...)
.
_pollRequest
in class AbstractMessageBroker
cryptoSessionIDPrefix
- usually, every key-manager uses the same prefix for
all crypto-sessions. Thus, this prefix is used to efficiently route requests to
the right key-manager.
cryptoSessionIDPrefix
or null
, if no such request pops up in the to-do-queue within the timeout.protected void _pushResponse(Response response)
AbstractMessageBroker
AbstractMessageBroker.pushResponse(Response)
method. Subclasses should implement this method instead of pushResponse(...)
.
_pushResponse
in class AbstractMessageBroker
response
- the response answering a previous Request
enqueued by AbstractMessageBroker.query(Class, Request)
.
|
Cumulus4j API (1.1.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |