Package org.exoplatform.forum.common.jcr
Class JCRSessionManager
java.lang.Object
org.exoplatform.forum.common.jcr.JCRSessionManager
- All Implemented Interfaces:
SessionManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCloses the current session and discard the changes done during the session.booleancloseSession(boolean save) Closes the current session and optionally saves its content.javax.jcr.SessionCreate a new Sessionstatic javax.jcr.Session<T> TExecute a readonly jcr task.<T> TexecuteAndSave(JCRTask<T> jcrTask) Execute an jcr task and persists the changes.javax.jcr.SessionReturns the session currently associated with the current thread of execution.
The current session is set withopenSession()javax.jcr.SessiongetSession(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) This method is here for backward compatibility, but will be removed to get rid of SessionProviderjavax.jcr.Sessionjavax.jcr.SessionOpen and returns a session to the model.voidsetWorkspaceName(String workspaceName)
-
Constructor Details
-
JCRSessionManager
Constructor- Parameters:
workspace-
-
-
Method Details
-
getWorkspaceName
-
setWorkspaceName
-
getCurrentSession
public javax.jcr.Session getCurrentSession()Returns the session currently associated with the current thread of execution.
The current session is set withopenSession()- Specified by:
getCurrentSessionin interfaceSessionManager- Returns:
- the current session if exists, null otherwise
-
currentSession
public static javax.jcr.Session currentSession() -
getSession
public javax.jcr.Session getSession(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) Description copied from interface:SessionManagerThis method is here for backward compatibility, but will be removed to get rid of SessionProvider- Specified by:
getSessionin interfaceSessionManager- Returns:
-
openSession
public javax.jcr.Session openSession()Open and returns a session to the model. When the current thread is already associated with a previously opened session the method will throw an
IllegalStateException.- Specified by:
openSessionin interfaceSessionManager- Returns:
- a session to the model.
-
openOrReuseSession
public javax.jcr.Session openOrReuseSession() -
createSession
public javax.jcr.Session createSession()Description copied from interface:SessionManagerCreate a new Session- Specified by:
createSessionin interfaceSessionManager- Returns:
-
closeSession
public boolean closeSession()Description copied from interface:SessionManagerCloses the current session and discard the changes done during the session.
- Specified by:
closeSessionin interfaceSessionManager- Returns:
- a boolean indicating if the session was closed
- See Also:
-
closeSession
public boolean closeSession(boolean save) Description copied from interface:SessionManagerCloses the current session and optionally saves its content. If no session is associated then this method has no effects and returns false.
- Specified by:
closeSessionin interfaceSessionManager- Parameters:
save- if the session must be saved- Returns:
- a boolean indicating if the session was closed
-
executeAndSave
Description copied from interface:SessionManagerExecute an jcr task and persists the changes. ASession.save()is called on the current at the end.- Specified by:
executeAndSavein interfaceSessionManager- Returns:
-
execute
Description copied from interface:SessionManagerExecute a readonly jcr task. NoSession.save()is called on the current session after the call.- Specified by:
executein interfaceSessionManager- Returns:
-