Class TargetDataStoreImpl
- java.lang.Object
-
- com.timesten.dataserver.jakartajmsxla.TargetDataStoreImpl
-
- All Implemented Interfaces:
TargetDataStore
public final class TargetDataStoreImpl extends java.lang.Object implements TargetDataStore
This class implements TargetDataStore and should be used to instantitate a TargetDataStore.
-
-
Constructor Summary
Constructors Constructor Description TargetDataStoreImpl(java.lang.String connectionString)TargetDataStore creates connections and XLA handles to the datastore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intapply(byte[] updateDescriptor)Applies XLA update descriptor to the target datastore.intapply(byte[] updateDescriptor, boolean useCommitFlag)Applies XLA update descriptor to the target datastore.intapply(byte[] updateDescriptor, boolean useCommitFlag, boolean checkUpdateConflict)Applies XLA update descriptor to the target datastore.voidclose()Closes the connections to the datastore and releases all the resources in a timely manner.intcommit()Use this method to perform a manual commit.booleangetAutoCommitFlag()Returns the value of autocommit flag.java.lang.StringgetConnectionString()Returns the connection string for this data store.booleangetUpdateConflictCheckFlag()Returns the value of the flag to check update conflicts.booleanisClosed()Use this method to check if this object is closed.booleanisDataStoreValid()Checks if the datastore is valid.introllback()Use this method to rollback the last transaction in case of errors.voidsetAutoCommitFlag(boolean flag)Sets the flag for autocommit during apply.voidsetUpdateConflictCheckFlag(boolean flag)Sets the flag for checking update conflicts during apply.
-
-
-
Constructor Detail
-
TargetDataStoreImpl
public TargetDataStoreImpl(java.lang.String connectionString) throws jakarta.jms.JMSExceptionTargetDataStore creates connections and XLA handles to the datastore.- Parameters:
connectionString- connection string to the datastore. If auto-commit is enabled, applies will be committed.- Throws:
jakarta.jms.JMSException- In case of an error while initializing XLA
-
-
Method Detail
-
commit
public int commit() throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreUse this method to perform a manual commit.- Specified by:
commitin interfaceTargetDataStore- Returns:
- 0 if successful. Otherwise, a transient error code is returned. Applications can retry.
- Throws:
jakarta.jms.JMSException- if commit fails.- See Also:
TargetDataStore.setAutoCommitFlag(boolean)
-
rollback
public int rollback() throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreUse this method to rollback the last transaction in case of errors.- Specified by:
rollbackin interfaceTargetDataStore- Returns:
- 0 if successful. Otherwise, a transient error code is returned. Applications can retry.
- Throws:
jakarta.jms.JMSException- if rollback fails.
-
isDataStoreValid
public boolean isDataStoreValid() throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreChecks if the datastore is valid.- Specified by:
isDataStoreValidin interfaceTargetDataStore- Returns:
- true is the datastore is valid. This object should be closed and a new object instantiated. Continued use of this object will result in failures.
- Throws:
jakarta.jms.JMSException- if it cannot ascertain the status of the datastore.- See Also:
TargetDataStore.close()
-
close
public void close() throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreCloses the connections to the datastore and releases all the resources in a timely manner. Use of close() is highly recommended over relying on the garbage collector to release unneeded resources. Once closed, this object cannot be reused.- Specified by:
closein interfaceTargetDataStore- Throws:
jakarta.jms.JMSException- if some unrecoverable error occurs while closing.
-
getConnectionString
public java.lang.String getConnectionString()
Description copied from interface:TargetDataStoreReturns the connection string for this data store.- Specified by:
getConnectionStringin interfaceTargetDataStore- Returns:
- Connection string for this datastore.
-
apply
public int apply(byte[] updateDescriptor, boolean useCommitFlag, boolean checkUpdateConflict) throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreApplies XLA update descriptor to the target datastore.- Specified by:
applyin interfaceTargetDataStore- Parameters:
updateDescriptor- XLA update descriptor. This can be extracted from JMS/XLA TimesTenMapMessage.useCommitFlag- If set, transactions will be committed if TT_UPDCOMMIT flag is set or if the record type is COMMITONLY.checkUpdateConflict- If set, check for update conflicts and report.- Returns:
- 0 if successful. Otherwise, a transient error code is returned. Applications can retry.
- Throws:
jakarta.jms.JMSException- If there are database errors or schema mismatch, this exception will be thrown.
-
apply
public int apply(byte[] updateDescriptor, boolean useCommitFlag) throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreApplies XLA update descriptor to the target datastore. If updateConflictCheckFlag is set, update conflicts will be checked and reported.- Specified by:
applyin interfaceTargetDataStore- Parameters:
updateDescriptor- XLA update descriptor. This can be extracted from JMS/XLA TimesTenMapMessage.useCommitFlag- If set, transactions will be committed if TT_UPDCOMMIT flag is set or if the record type is COMMITONLY.- Returns:
- 0 if successful. Otherwise, a transient error code is returned. Applications can retry.
- Throws:
jakarta.jms.JMSException- If there are database errors or schema mismatch, this exception will be thrown.- See Also:
TargetDataStore.setUpdateConflictCheckFlag(boolean)
-
apply
public int apply(byte[] updateDescriptor) throws jakarta.jms.JMSExceptionDescription copied from interface:TargetDataStoreApplies XLA update descriptor to the target datastore. Transactions will be committed if TT_UPDCOMMIT flag is set or if the record type is COMMITONLY. If updateConflictCheckFlag is set, update conflicts will be checked and reported.- Specified by:
applyin interfaceTargetDataStore- Parameters:
updateDescriptor- XLA update descriptor. This can be extracted from JMS/XLA TimesTenMapMessage.- Returns:
- 0 if successful. Otherwise, a transient error code is returned. Applications can retry.
- Throws:
jakarta.jms.JMSException- If there are database errors or schema mismatch, this exception will be thrown.- See Also:
TargetDataStore.setAutoCommitFlag(boolean),TargetDataStore.setUpdateConflictCheckFlag(boolean)
-
getAutoCommitFlag
public boolean getAutoCommitFlag()
Description copied from interface:TargetDataStoreReturns the value of autocommit flag.- Specified by:
getAutoCommitFlagin interfaceTargetDataStore- Returns:
- true if this flag is set.
-
getUpdateConflictCheckFlag
public boolean getUpdateConflictCheckFlag()
Description copied from interface:TargetDataStoreReturns the value of the flag to check update conflicts.- Specified by:
getUpdateConflictCheckFlagin interfaceTargetDataStore- Returns:
- true if update conflicts are checked during apply.
-
setAutoCommitFlag
public void setAutoCommitFlag(boolean flag)
Description copied from interface:TargetDataStoreSets the flag for autocommit during apply.- Specified by:
setAutoCommitFlagin interfaceTargetDataStore- Parameters:
flag- If set to true, apply will commit if TT_UPDCOMMIT is set or record type is COMMITONLY.- See Also:
TargetDataStore.apply(byte[]),TargetDataStore.commit(),TargetDataStore.rollback()
-
setUpdateConflictCheckFlag
public void setUpdateConflictCheckFlag(boolean flag)
Description copied from interface:TargetDataStoreSets the flag for checking update conflicts during apply.- Specified by:
setUpdateConflictCheckFlagin interfaceTargetDataStore- Parameters:
flag- If set to true, update conflicts will be checked during apply.- See Also:
TargetDataStore.apply(byte[]),TargetDataStore.apply(byte[], boolean)
-
isClosed
public boolean isClosed()
Description copied from interface:TargetDataStoreUse this method to check if this object is closed. A closed object cannot be used any longer.- Specified by:
isClosedin interfaceTargetDataStore- Returns:
- true if this object is closed.
-
-