Class EhcacheAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>
- java.lang.Object
-
- org.openehealth.ipf.commons.ihe.ws.correlation.EhcacheAsynchronyCorrelator<AuditDatasetType>
-
- All Implemented Interfaces:
AsynchronyCorrelator<AuditDatasetType>
public class EhcacheAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset> extends Object implements AsynchronyCorrelator<AuditDatasetType>
Ehcache-based implementation of asynchronous message correlator.- Author:
- Dmytro Rud
-
-
Field Summary
-
Fields inherited from interface org.openehealth.ipf.commons.ihe.ws.correlation.AsynchronyCorrelator
FORCE_CORRELATION
-
-
Constructor Summary
Constructors Constructor Description EhcacheAsynchronyCorrelator(javax.cache.Cache<String,Serializable> ehcache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete(String messageId)Deletes information pieces about the message with the given ID.AuditDatasetTypegetAuditDataset(String messageId)Returns the audit dataset for the request message with the given ID, ornullif the message is unknown.StringgetCorrelationKey(String messageId)Returns the user-defined correlation key for the message with the given ID, ornullif the message is unknown or the user did not provided any correlation key.StringgetMessageId(String alternativeKey)Determines WS-Addressing message ID ("primary key") which corresponds to the given alternative key.StringgetServiceEndpointUri(String messageId)Returns the URI of the endpoint to which the message with the given ID has been sent, ornullif the message is unknown.voidstoreAlternativeKeys(String messageId, String... alternativeKeys)Stores a set of alternative keys for the message with the given WS-Addressing ID.voidstoreAuditDataset(String messageId, WsAuditDataset auditDataset)Stores audit dataset.voidstoreCorrelationKey(String messageId, String correlationKey)Stores a user-defined correlation key.voidstoreServiceEndpointUri(String messageId, String serviceEndpointUri)Stores a service endpoint URI.
-
-
-
Constructor Detail
-
EhcacheAsynchronyCorrelator
public EhcacheAsynchronyCorrelator(javax.cache.Cache<String,Serializable> ehcache)
-
-
Method Detail
-
storeServiceEndpointUri
public void storeServiceEndpointUri(String messageId, String serviceEndpointUri)
Description copied from interface:AsynchronyCorrelatorStores a service endpoint URI.- Specified by:
storeServiceEndpointUriin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Parameters:
messageId- WS-Addressing message ID of the request.serviceEndpointUri- URL of the endpoint the request is being sent to.
-
storeCorrelationKey
public void storeCorrelationKey(String messageId, String correlationKey)
Description copied from interface:AsynchronyCorrelatorStores a user-defined correlation key.- Specified by:
storeCorrelationKeyin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Parameters:
messageId- WS-Addressing message ID of the request.correlationKey- correlation key provided by the user.
-
storeAuditDataset
public void storeAuditDataset(String messageId, WsAuditDataset auditDataset)
Description copied from interface:AsynchronyCorrelatorStores audit dataset.- Specified by:
storeAuditDatasetin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Parameters:
messageId- WS-Addressing message ID of the request.auditDataset- audit dataset.
-
getServiceEndpointUri
public String getServiceEndpointUri(String messageId)
Description copied from interface:AsynchronyCorrelatorReturns the URI of the endpoint to which the message with the given ID has been sent, ornullif the message is unknown.- Specified by:
getServiceEndpointUriin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>
-
getCorrelationKey
public String getCorrelationKey(String messageId)
Description copied from interface:AsynchronyCorrelatorReturns the user-defined correlation key for the message with the given ID, ornullif the message is unknown or the user did not provided any correlation key.- Specified by:
getCorrelationKeyin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>
-
getAuditDataset
public AuditDatasetType getAuditDataset(String messageId)
Description copied from interface:AsynchronyCorrelatorReturns the audit dataset for the request message with the given ID, ornullif the message is unknown.- Specified by:
getAuditDatasetin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>
-
storeAlternativeKeys
public void storeAlternativeKeys(String messageId, String... alternativeKeys)
Description copied from interface:AsynchronyCorrelatorStores a set of alternative keys for the message with the given WS-Addressing ID. When the <RelatesTo> header of the incoming response does not contain a valid/a known message ID for correlation, the system will use transaction-specific mechanisms to extract additional keys from the message body and to perform the correlation of their basis.The correlator must maintain bi-directional correspondence between the "primary" key (WS-Addressing message ID of the request) and the alternative keys. The uniqueness of the alternative keys should be provided, but cannot be guaranteed.
- Specified by:
storeAlternativeKeysin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Parameters:
messageId- WS-Addressing message ID of the request.alternativeKeys- alternative keys, should be notnull.
-
getMessageId
public String getMessageId(String alternativeKey)
Description copied from interface:AsynchronyCorrelatorDetermines WS-Addressing message ID ("primary key") which corresponds to the given alternative key.- Specified by:
getMessageIdin interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Parameters:
alternativeKey- alternative key.- Returns:
- WS-Addressing message ID or
nullwhen not found.
-
delete
public boolean delete(String messageId)
Description copied from interface:AsynchronyCorrelatorDeletes information pieces about the message with the given ID.This method is supposed to be called internally after the correlation of an asynchronous response has been completed; the user does not have to call it explicitly (but who knows...).
- Specified by:
deletein interfaceAsynchronyCorrelator<AuditDatasetType extends WsAuditDataset>- Returns:
truewhen there actually was something to delete, i.e. when the given ID was known;falseotherwise.
-
-