Package org.exoplatform.forum.common.jcr
Interface SessionManager
- All Known Implementing Classes:
JCRSessionManager
public interface SessionManager
- Version:
- $Revision$
- Author:
- Patrice Lamarque
-
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 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.SessionOpen and returns a session to the model.
-
Method Details
-
openSession
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.- Returns:
- a session to the model.
-
getSession
javax.jcr.Session getSession(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) This method is here for backward compatibility, but will be removed to get rid of SessionProvider- Parameters:
sessionProvider-- Returns:
-
getCurrentSession
javax.jcr.Session getCurrentSession()Returns the session currently associated with the current thread of execution.
The current session is set withopenSession()- Returns:
- the current session if exists, null otherwise
-
createSession
javax.jcr.Session createSession()Create a new Session- Returns:
-
closeSession
boolean closeSession()Closes the current session and discard the changes done during the session.
- Returns:
- a boolean indicating if the session was closed
- See Also:
-
closeSession
boolean closeSession(boolean save) Closes the current session and optionally saves its content. If no session is associated then this method has no effects and returns false.
- Parameters:
save- if the session must be saved- Returns:
- a boolean indicating if the session was closed
-
executeAndSave
Execute an jcr task and persists the changes. ASession.save()is called on the current at the end.- Type Parameters:
T-- Parameters:
jcrTask-- Returns:
-
execute
Execute a readonly jcr task. NoSession.save()is called on the current session after the call.- Type Parameters:
T-- Parameters:
jcrTask-- Returns:
-