Package com.emc.documentum.rest.dfc
Interface ContextSessionManager
public interface ContextSessionManager
An interface to provide the functions to get the context DFC session. A context DFC session
is used in one or multiple transactional operations.
Implementation beans for this interface could be autowired in callers.
Below is the right usage of methods in
ContextSessionManager
.
@Autowired
ContextSessionManager contextSessionManager;
try {
// enable using context DFC session
contextSessionManager.enableContextSession();
// do whatever DFC operations using RepositorySession
// ...
// complete using context DFC session
contextSessionManager.completeContextSession();
} catch(DfException e) {
// abort and clear context DFC session
contextSessionManager.abortContextSession();
// error handling
// ...
}
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Callable operation with automatically assigning the session -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the context DFC session, indicating to rollback intermediate work done by this session if it is in transaction.void
Complete the context DFC session, indicating to commit intermediate work done by this session if it is in transaction.void
enableContextSession
(boolean makeTransactional) Enable using context wide DFC session, indicating that the session got fromRepositorySession
will be marked as private to this security context, and it will not be released untilcompleteContextSession
orabortContextSession
is called.<T> T
Execute the operation within the current context transaction If the context transaction is enabled before, then the operation will be executed within the current context.<T> T
executeWithinTheContextTran
(Callable<T> operation) Deprecated.com.documentum.fc.client.IDfSession
FOR INTERNAL USE.boolean
Check whether using context wide DFC session is enabled.boolean
Check whether using context DFC session is marked as transactionalvoid
setContextSession
(com.documentum.fc.client.IDfSession session) FOR INTERNAL USE.
-
Method Details
-
enableContextSession
void enableContextSession(boolean makeTransactional) Enable using context wide DFC session, indicating that the session got fromRepositorySession
will be marked as private to this security context, and it will not be released untilcompleteContextSession
orabortContextSession
is called.- Parameters:
makeTransactional
- mark the context DFC session as transactional, indicating that the intermediate work done by this session won't be committed untilcompleteContextSession
is called.- See Also:
-
isContextSessionEnabled
boolean isContextSessionEnabled()Check whether using context wide DFC session is enabled.- Returns:
true
if the context session is enabled;false
for otherwise.
-
isContextSessionTransactional
boolean isContextSessionTransactional()Check whether using context DFC session is marked as transactional- Returns:
- TRUE indicates using context session is transactional; FALSE for otherwise.
-
completeContextSession
void completeContextSession() throws com.documentum.fc.common.DfExceptionComplete the context DFC session, indicating to commit intermediate work done by this session if it is in transaction. This session will be released after completion.- Throws:
com.documentum.fc.common.DfException
- the exception during the operation
-
abortContextSession
void abortContextSession()Abort the context DFC session, indicating to rollback intermediate work done by this session if it is in transaction. This session will be released after abortion. -
getContextSession
com.documentum.fc.client.IDfSession getContextSession()FOR INTERNAL USE. Get the context DFC session being used; it may return null if context session is not initialized yet. Do not call this method in controllers.- Returns:
- the context DFC session being used
-
setContextSession
void setContextSession(com.documentum.fc.client.IDfSession session) FOR INTERNAL USE. Set the context DFC session. Do not call this method in controllers.- Parameters:
session
- the DFC session to be set as context wide usage.
-
executeWithinTheContextTran
@Deprecated <T> T executeWithinTheContextTran(Callable<T> operation) throws com.documentum.fc.common.DfException Deprecated.Execute the operation within the current context transaction If the context transaction is enabled before, then the operation will be executed within the current context. The context will not start or commit the transaction. The transaction is controlled by the owner who starts the context transaction, e.g. an operation in the batch. Otherwise, the transaction will be started and committed/aborted when executing the operation.- Type Parameters:
T
- the operation result- Parameters:
operation
- the operation to be executed- Returns:
- the executed result
- Throws:
com.documentum.fc.common.DfException
- exception during the operation
-
executeWithinTheContextTran
<T> T executeWithinTheContextTran(ContextSessionManager.SessionCallable<T> operation) throws com.documentum.fc.common.DfException Execute the operation within the current context transaction If the context transaction is enabled before, then the operation will be executed within the current context. The context will not start or commit the transaction. The transaction is controlled by the owner who starts the context transaction, e.g. an operation in the batch. Otherwise, the transaction will be started and committed/aborted when executing the operation.- Type Parameters:
T
- the operation result- Parameters:
operation
- the operation to be executed- Returns:
- the executed result
- Throws:
com.documentum.fc.common.DfException
- exception during the operation
-
executeWithinTheContextTran(SessionCallable)