Browse files

Make replication extension more robust (receiver)

- Fall-back to SYSTEM user/group when user/group does not exist for receiver
- Create missing collections
- Prevent re-replication of replication events
  • Loading branch information...
1 parent cf21b3a commit 4f4c443ec911f6e94ce57c8643244fb4373ce83a @dizzzz dizzzz committed Jul 28, 2013
View
2 extensions/replication/src/org/exist/replication/jms/publish/JMSMessageSender.java
@@ -210,7 +210,7 @@ public void sendMessage(eXistMessage em) throws TransportException {
} catch (JMSException ex) {
LOG.error(ex.getMessage(), ex);
- throw new TransportException(String.format("Problem during communcation: %s", ex.getMessage()), ex);
+ throw new TransportException(String.format("Problem during communication: %s", ex.getMessage()), ex);
} catch (NamingException ex) {
LOG.error(ex.getMessage(), ex);
View
95 extensions/replication/src/org/exist/replication/jms/publish/ReplicationTrigger.java
@@ -48,17 +48,26 @@
public class ReplicationTrigger extends FilteringTrigger implements DocumentTrigger, CollectionTrigger {
private final static Logger LOG = Logger.getLogger(ReplicationTrigger.class);
+
+ private static final String BLOCKED_MESSAGE = "Blocked replication trigger for %s: was received by replication extension.";
+ public static final String JMS_EXTENSION_PKG = "org.exist.replication.jms";
+
private Map<String, List<?>> parameters;
//
// Document Triggers
//
- private void afterUpdateCreateDocument(DBBroker broker, Txn transaction,
- DocumentImpl document, eXistMessage.ResourceOperation operation) /* throws TriggerException */ {
+ private void afterUpdateCreateDocument(DBBroker broker, Txn transaction, DocumentImpl document,
+ eXistMessage.ResourceOperation operation) /* throws TriggerException */ {
if (LOG.isDebugEnabled()) {
LOG.debug(document.getURI().toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -81,7 +90,8 @@ private void afterUpdateCreateDocument(DBBroker broker, Txn transaction,
msg.setPayload(MessageHelper.gzipSerialize(broker, document));
} catch (Throwable ex) {
- LOG.error(String.format("Problem while serializing document (contentLength=%s) to compressed message:%s", document.getContentLength(), ex.getMessage()), ex);
+ LOG.error(String.format("Problem while serializing document (contentLength=%s) to compressed message:%s",
+ document.getContentLength(), ex.getMessage()), ex);
//throw new TriggerException("Unable to retrieve message payload: " + ex.getMessage());
}
@@ -90,34 +100,46 @@ private void afterUpdateCreateDocument(DBBroker broker, Txn transaction,
}
@Override
- public void afterCreateDocument(DBBroker broker, Txn transaction,
- DocumentImpl document) throws TriggerException {
+ public void afterCreateDocument(DBBroker broker, Txn transaction, DocumentImpl document) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(document.getURI().toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
this.afterUpdateCreateDocument(broker, transaction, document, eXistMessage.ResourceOperation.CREATE);
}
@Override
- public void afterUpdateDocument(DBBroker broker, Txn transaction,
- DocumentImpl document) throws TriggerException {
+ public void afterUpdateDocument(DBBroker broker, Txn transaction, DocumentImpl document) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(document.getURI().toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
this.afterUpdateCreateDocument(broker, transaction, document, eXistMessage.ResourceOperation.UPDATE);
}
@Override
- public void afterCopyDocument(DBBroker broker, Txn transaction,
- DocumentImpl document, XmldbURI oldUri) throws TriggerException {
+ public void afterCopyDocument(DBBroker broker, Txn transaction, DocumentImpl document, XmldbURI oldUri) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s %s", document.getURI().toString(), oldUri.toString()));
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -131,12 +153,16 @@ public void afterCopyDocument(DBBroker broker, Txn transaction,
}
@Override
- public void afterMoveDocument(DBBroker broker, Txn transaction,
- DocumentImpl document, XmldbURI oldUri) throws TriggerException {
+ public void afterMoveDocument(DBBroker broker, Txn transaction, DocumentImpl document, XmldbURI oldUri) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s %s", document.getURI().toString(), oldUri.toString()));
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -150,12 +176,16 @@ public void afterMoveDocument(DBBroker broker, Txn transaction,
}
@Override
- public void afterDeleteDocument(DBBroker broker, Txn transaction,
- XmldbURI uri) throws TriggerException {
+ public void afterDeleteDocument(DBBroker broker, Txn transaction, XmldbURI uri) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(uri.toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, uri.toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -171,12 +201,15 @@ public void afterDeleteDocument(DBBroker broker, Txn transaction,
// Collection Triggers
//
@Override
- public void afterCreateCollection(DBBroker broker, Txn transaction,
- Collection collection) throws TriggerException {
+ public void afterCreateCollection(DBBroker broker, Txn transaction, Collection collection) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(collection.getURI().toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, collection.getURI().toString()));
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -192,11 +225,15 @@ public void afterCreateCollection(DBBroker broker, Txn transaction,
}
@Override
- public void afterCopyCollection(DBBroker broker, Txn transaction, Collection collection,
- XmldbURI oldUri) throws TriggerException {
+ public void afterCopyCollection(DBBroker broker, Txn transaction, Collection collection, XmldbURI oldUri) throws TriggerException {
+
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s %s", collection.getURI().toString(), oldUri.toString()));
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, collection.getURI().toString()));
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -210,11 +247,16 @@ public void afterCopyCollection(DBBroker broker, Txn transaction, Collection col
}
@Override
- public void afterMoveCollection(DBBroker broker, Txn transaction, Collection collection,
- XmldbURI oldUri) throws TriggerException {
+ public void afterMoveCollection(DBBroker broker, Txn transaction, Collection collection, XmldbURI oldUri) throws TriggerException {
+
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("%s %s", collection.getURI().toString(), oldUri.toString()));
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, collection.getURI().toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -228,11 +270,15 @@ public void afterMoveCollection(DBBroker broker, Txn transaction, Collection col
}
@Override
- public void afterDeleteCollection(DBBroker broker, Txn transaction,
- XmldbURI uri) throws TriggerException {
+ public void afterDeleteCollection(DBBroker broker, Txn transaction, XmldbURI uri) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(uri.toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, uri.toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
@@ -249,11 +295,16 @@ public void afterDeleteCollection(DBBroker broker, Txn transaction,
//
@Override
- public void afterUpdateDocumentMetadata(DBBroker broker, Txn txn, DocumentImpl document) throws TriggerException {
+ public void afterUpdateDocumentMetadata(DBBroker broker, Txn transaction, DocumentImpl document) throws TriggerException {
if (LOG.isDebugEnabled()) {
LOG.debug(document.getURI().toString());
}
+
+ if(transaction.getOriginId()!=null && transaction.getOriginId().startsWith(JMS_EXTENSION_PKG)){
+ LOG.info(String.format(BLOCKED_MESSAGE, document.getURI().toString()));
+ return;
+ }
// Create Message
eXistMessage msg = new eXistMessage();
View
171 extensions/replication/src/org/exist/replication/jms/subscribe/JMSMessageListener.java
@@ -215,7 +215,6 @@ private void handleDocument(eXistMessage em) {
*/
private void handleCollection(eXistMessage em) {
-
switch (em.getResourceOperation()) {
case CREATE:
case UPDATE:
@@ -248,7 +247,6 @@ private void createDocument(eXistMessage em) {
Map<String, Object> props = em.getMetadata();
-
XmldbURI sourcePath = XmldbURI.create(em.getResourcePath());
XmldbURI colURI = sourcePath.removeLastSegment();
XmldbURI docURI = sourcePath.lastSegment();
@@ -263,8 +261,9 @@ private void createDocument(eXistMessage em) {
mime = MimeType.BINARY_TYPE;
}
-
+ //
// Get OWNER
+ ///
String userName = null;
Object prop = props.get(MessageHelper.EXIST_RESOURCE_OWNER);
if (prop != null && prop instanceof String) {
@@ -275,10 +274,14 @@ private void createDocument(eXistMessage em) {
if (account == null) {
String errorText = String.format("Username %s does not exist.", userName);
LOG.error(errorText);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+ account = securityManager.getSystemSubject();
+ userName = account.getName();
}
+ //
// Get GROUP
+ //
String groupName = null;
prop = props.get(MessageHelper.EXIST_RESOURCE_GROUP);
if (prop != null && prop instanceof String) {
@@ -289,10 +292,14 @@ private void createDocument(eXistMessage em) {
if (group == null) {
String errorText = String.format("Group %s does not exist.", groupName);
LOG.error(errorText);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+ group = securityManager.getSystemSubject().getDefaultGroup();
+ groupName = group.getName();
}
+ //
// Get MIME_TYPE
+ //
MimeTable mimeTable = MimeTable.getInstance();
String mimeType = null;
prop = props.get(MessageHelper.EXIST_RESOURCE_MIMETYPE);
@@ -314,8 +321,6 @@ private void createDocument(eXistMessage em) {
mimeType = mT.getName();
}
-
-
// Get/Set permissions
Integer mode = null;
prop = props.get(MessageHelper.EXIST_RESOURCE_MODE);
@@ -324,27 +329,33 @@ private void createDocument(eXistMessage em) {
}
-
-
- // Start transaction
- TransactionManager txnManager = brokerPool.getTransactionManager();
- Txn txn = txnManager.beginTransaction();
-
try {
- // TODO get user
broker = brokerPool.get(securityManager.getSystemSubject());
- // Check if collection exists. not likely to happen since availability is checked
- // by ResourceFactory
collection = broker.openCollection(colURI, Lock.WRITE_LOCK);
-// collection.setTriggersEnabled(false);
+
if (collection == null) {
String errorMessage = String.format("Collection %s does not exist", colURI);
LOG.error(errorMessage);
- txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+
+ // Create collection anyway
+ createCollection(colURI, userName, groupName, Permission.DEFAULT_COLLECTION_PERM);
+ }
+ } catch (Throwable t){
+ if(LOG.isDebugEnabled()){
+ LOG.error(t.getMessage(), t);
+ } else {
+ LOG.error(t.getMessage());
}
+ throw new MessageReceiveException(String.format("Unable to create collection in database: %s", t.getMessage()));
+ }
+ // Start transaction
+ TransactionManager txnManager = brokerPool.getTransactionManager();
+ Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
+
+ try {
DocumentImpl doc = null;
if (mime.isXMLType()) {
@@ -420,9 +431,15 @@ private void createDocument(eXistMessage em) {
}
}
+
+ private void createCollectionWhenRequired(){
+
+ }
/**
* Metadata is updated in database
+ *
+ * TODO not usable yet
*/
private void updateMetadataDocument(eXistMessage em) {
// Permissions
@@ -440,6 +457,7 @@ private void updateMetadataDocument(eXistMessage em) {
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
try {
// TODO get user
@@ -451,7 +469,10 @@ private void updateMetadataDocument(eXistMessage em) {
String errorText = String.format("Collection does not exist %s", colURI);
LOG.error(errorText);
txnManager.abort(txn);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+
+ // be silent
+ return;
}
// Open document if possible, else abort
@@ -460,7 +481,10 @@ private void updateMetadataDocument(eXistMessage em) {
String errorText = String.format("No resource found for path: %s", sourcePath);
LOG.error(errorText);
txnManager.abort(txn);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+
+ // be silent
+ return;
}
DocumentMetadata metadata = resource.getMetadata();
@@ -504,6 +528,7 @@ private void deleteDocument(eXistMessage em) {
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
try {
// TODO get user
@@ -515,7 +540,10 @@ private void deleteDocument(eXistMessage em) {
String errorText = String.format("Collection does not exist %s", colURI);
LOG.error(errorText);
txnManager.abort(txn);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+
+ // silently ignore
+ return;
}
// Open document if possible, else abort
@@ -524,7 +552,10 @@ private void deleteDocument(eXistMessage em) {
String errorText = String.format("No resource found for path: %s", sourcePath);
LOG.error(errorText);
txnManager.abort(txn);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+
+ // silently ignore
+ return;
}
// This delete is based on mime-type /ljo
if (resource.getResourceType() == DocumentImpl.BINARY_FILE) {
@@ -550,7 +581,6 @@ private void deleteDocument(eXistMessage em) {
} finally {
- // TODO: check if can be done earlier
if (collection != null) {
collection.release(Lock.WRITE_LOCK);
}
@@ -576,6 +606,7 @@ private void deleteCollection(eXistMessage em) {
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
try {
// TODO get user
@@ -587,6 +618,7 @@ private void deleteCollection(eXistMessage em) {
collection = broker.openCollection(sourcePath, Lock.WRITE_LOCK);
if (collection == null) {
txnManager.abort(txn);
+ // be silent
return;
}
@@ -644,7 +676,10 @@ private void createCollection(eXistMessage em) {
if (account == null) {
String errorText = String.format("Username %s does not exist.", userName);
LOG.error(errorText);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+
+ account = securityManager.getSystemSubject();
+ userName = account.getName();
}
// Get GROUP
@@ -654,36 +689,47 @@ private void createCollection(eXistMessage em) {
groupName = (String) prop;
}
+ Group group = securityManager.getGroup(groupName);
+ if (group == null) {
+ String errorText = String.format("Group %s does not exist.", groupName);
+ LOG.error(errorText);
+ //throw new MessageReceiveException(errorText);
+ group = securityManager.getSystemSubject().getDefaultGroup();
+ groupName = group.getName();
+ }
+
// Get/Set permissions
Integer mode = null;
prop = props.get(MessageHelper.EXIST_RESOURCE_MODE);
if (prop != null && prop instanceof Integer) {
mode = (Integer) prop;
}
-
-
+
+ createCollection(sourcePath, userName, groupName, mode);
+ }
+
+ private boolean createCollection(XmldbURI sourcePath, String userName, String groupName, Integer mode) throws MessageReceiveException {
DBBroker broker = null;
Collection collection = null;
-
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
-
+ txn.setOriginId(this.getClass().getName());
+
try {
// TODO get user
broker = brokerPool.get(securityManager.getSystemSubject());
-
// TODO ... consider to swallow situation transparently
collection = broker.openCollection(sourcePath, Lock.WRITE_LOCK);
if (collection != null) {
String errorText = String.format("Collection %s already exists", sourcePath);
LOG.error(errorText);
txnManager.abort(txn);
- throw new MessageReceiveException(errorText);
+ //throw new MessageReceiveException(errorText);
+ // silently ignore
+ return false;
}
-
// Create collection
Collection newCollection = broker.getOrCreateCollection(txn, sourcePath);
-
// Set owner,group and permissions
Permission permission = newCollection.getPermissions();
if (userName != null) {
@@ -695,35 +741,33 @@ private void createCollection(eXistMessage em) {
if (mode != null) {
permission.setMode(mode);
}
-
-
broker.saveCollection(txn, newCollection);
broker.flush();
-
// Commit change
txnManager.commit(txn);
-
- } catch (Throwable t) {
-
- if(LOG.isDebugEnabled()){
- LOG.error(t.getMessage(), t);
- } else {
- LOG.error(t.getMessage());
- }
- txnManager.abort(txn);
- throw new MessageReceiveException(t.getMessage(), t);
-
- } finally {
-
+ } catch (Throwable t) {
+
+ if(LOG.isDebugEnabled()){
+ LOG.error(t.getMessage(), t);
+ } else {
+ LOG.error(t.getMessage());
+ }
+
+ txnManager.abort(txn);
+ throw new MessageReceiveException(t.getMessage(), t);
+
+ } finally {
// TODO: check if can be done earlier
if (collection != null) {
collection.release(Lock.WRITE_LOCK);
}
txnManager.close(txn);
brokerPool.release(broker);
}
+ return true;
}
+
private void relocateDocument(eXistMessage em, boolean keepDocument) {
@@ -745,6 +789,7 @@ private void relocateDocument(eXistMessage em, boolean keepDocument) {
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
try {
// TODO get user
@@ -756,7 +801,10 @@ private void relocateDocument(eXistMessage em, boolean keepDocument) {
String errorMessage = String.format("Collection not found: %s", sourceColURI);
LOG.error(errorMessage);
txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+ //throw new MessageReceiveException(errorMessage);
+
+ // be silent
+ return;
}
// Open document if possible, else abort
@@ -765,7 +813,10 @@ private void relocateDocument(eXistMessage em, boolean keepDocument) {
String errorMessage = String.format("No resource found for path: %s", sourcePath);
LOG.error(errorMessage);
txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+ //throw new MessageReceiveException(errorMessage);
+
+ // be silent
+ return;
}
// Open collection if possible, else abort
@@ -774,7 +825,10 @@ private void relocateDocument(eXistMessage em, boolean keepDocument) {
String errorMessage = String.format("Destination collection %s does not exist.", destColURI);
LOG.error(errorMessage);
txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+ //throw new MessageReceiveException(errorMessage);
+
+ // be silent
+ return;
}
@@ -832,6 +886,7 @@ private void relocateCollection(eXistMessage em, boolean keepCollection) {
TransactionManager txnManager = brokerPool.getTransactionManager();
Txn txn = txnManager.beginTransaction();
+ txn.setOriginId(this.getClass().getName());
try {
// TODO get user
@@ -843,7 +898,10 @@ private void relocateCollection(eXistMessage em, boolean keepCollection) {
String errorMessage = String.format("Collection %s does not exist.", sourcePath);
LOG.error(errorMessage);
txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+ //throw new MessageReceiveException(errorMessage);
+
+ // be silent
+ return;
}
@@ -853,7 +911,10 @@ private void relocateCollection(eXistMessage em, boolean keepCollection) {
String errorMessage = String.format("Destination collection %s does not exist.", destColURI);
LOG.error(errorMessage);
txnManager.abort(txn);
- throw new MessageReceiveException(errorMessage);
+ //throw new MessageReceiveException(errorMessage);
+
+ // be silent
+ return;
}
// Perform actual move/copy
@@ -891,4 +952,6 @@ private void relocateCollection(eXistMessage em, boolean keepCollection) {
}
}
+
+
}
View
23 extensions/replication/src/org/exist/replication/shared/eXistMessage.java
@@ -25,6 +25,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* Container class for clustering messages.
@@ -55,6 +56,8 @@
private ResourceOperation resourceOperation;
private ResourceType resourceType;
+ private DocumentType documentType;
+
private String path;
private String destination;
private byte[] payload;
@@ -74,6 +77,13 @@
public enum ResourceType {
DOCUMENT, COLLECTION
}
+
+ /**
+ * Types of exist-db resources
+ */
+ public enum DocumentType {
+ XML, BINARY
+ }
public void setResourceOperation(ResourceOperation type) {
resourceOperation = type;
@@ -137,6 +147,14 @@ public void setMetadata(Map<String, Object> props) {
return metaData;
}
+ public DocumentType getDocumentType() {
+ return documentType;
+ }
+
+ public void setDocumentType(DocumentType documentType) {
+ this.documentType = documentType;
+ }
+
/**
* Get one-liner report of message, including the JMS properties.
*/
@@ -172,4 +190,9 @@ public String getReport() {
return sb.toString();
}
+
+ @Override
+ public String toString(){
+ return ToStringBuilder.reflectionToString(this);
+ }
}
View
20 src/org/exist/storage/txn/Txn.java
@@ -42,6 +42,8 @@
private List<LockInfo> locksHeld = new ArrayList<LockInfo>();
private List<TxnListener> listeners = new ArrayList<TxnListener>();
+
+ private String originId;
public Txn(long transactionId) {
this.id = transactionId;
@@ -104,4 +106,22 @@ public LockInfo(Lock lock, int lockMode) {
this.lockMode = lockMode;
}
}
+
+ /**
+ * Get origin of transaction
+ * @return Id
+ */
+ public String getOriginId() {
+ return originId;
+ }
+
+ /**
+ * Set origin of transaction. Purpose is to be able to
+ * see the origin of the transaction.
+ *
+ * @param id Identifier of origin, FQN or URI.
+ */
+ public void setOriginId(String id) {
+ originId = id;
+ }
}

0 comments on commit 4f4c443

Please sign in to comment.