public class JCRSessionManager extends Object implements SessionManager
| Constructor and Description |
|---|
JCRSessionManager(String workspace)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
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
|
static javax.jcr.Session |
currentSession() |
<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
|
String |
getWorkspaceName() |
javax.jcr.Session |
openOrReuseSession() |
javax.jcr.Session |
openSession()
Open and returns a session to the model.
|
void |
setWorkspaceName(String workspaceName) |
public JCRSessionManager(String workspace)
workspace - public String getWorkspaceName()
public void setWorkspaceName(String workspaceName)
public javax.jcr.Session getCurrentSession()
Returns the session currently associated with the current thread of execution.
The current session is set with openSession()
getCurrentSession in interface SessionManagerpublic static javax.jcr.Session currentSession()
public javax.jcr.Session getSession(org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
SessionManagergetSession in interface SessionManagerpublic 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.
openSession in interface SessionManagerpublic javax.jcr.Session openOrReuseSession()
public javax.jcr.Session createSession()
SessionManagercreateSession in interface SessionManagerpublic boolean closeSession()
SessionManagerCloses the current session and discard the changes done during the session.
closeSession in interface SessionManagerSessionManager.closeSession(boolean)public boolean closeSession(boolean save)
SessionManagerCloses the current session and optionally saves its content. If no session is associated then this method has no effects and returns false.
closeSession in interface SessionManagersave - if the session must be savedpublic <T> T executeAndSave(JCRTask<T> jcrTask)
SessionManagerSession.save() is called on the current at the end.executeAndSave in interface SessionManagerpublic <T> T execute(JCRTask<T> jcrTask)
SessionManagerSession.save()is called on the current session after the call.execute in interface SessionManagerCopyright © 2003–2021 eXo Platform SAS. All rights reserved.