org.exoplatform.forum.common.jcr
Interface SessionManager

All Known Implementing Classes:
JCRSessionManager

public interface SessionManager

Version:
$Revision$
Author:
Patrice Lamarque

Method Summary
 boolean closeSession()
          Closes the current session and discard the changes done during the session.
 boolean closeSession(boolean save)
          Closes the current session and optionally saves its content.
 javax.jcr.Session createSession()
          Create a new Session
<T> T
execute(JCRTask<T> jcrTask)
          Execute a readonly jcr task.
<T> T
executeAndSave(JCRTask<T> jcrTask)
          Execute an jcr task and persists the changes.
 javax.jcr.Session getCurrentSession()
          Returns the session currently associated with the current thread of execution.
The current session is set with openSession()
 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
 javax.jcr.Session openSession()
          Open and returns a session to the model.
 

Method Detail

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 with openSession()

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 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

<T> T executeAndSave(JCRTask<T> jcrTask)
Execute an jcr task and persists the changes. A Session.save() is called on the current at the end.

Type Parameters:
T -
Parameters:
jcrTask -
Returns:

execute

<T> T execute(JCRTask<T> jcrTask)
Execute a readonly jcr task. No Session.save()is called on the current session after the call.

Type Parameters:
T -
Parameters:
jcrTask -
Returns:


Copyright © 2013 eXo Platform SAS. All Rights Reserved.