|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.commons.AbstractSession org.apache.jackrabbit.core.SessionImpl
public class SessionImpl
A SessionImpl
...
Field Summary | |
---|---|
protected AccessManager |
accessMgr
the AccessManager associated with this session |
static String |
ADD_NODE_ACTION
|
protected boolean |
alive
flag indicating whether this session is alive |
protected HashMap |
attributes
the attributes of this session |
protected HierarchyManager |
hierMgr
the HierarchyManager associated with this session |
protected ItemManager |
itemMgr
the item mgr associated with this session |
protected SessionItemStateManager |
itemStateMgr
the item state mgr associated with this session |
protected Map |
listeners
Listeners (weak references) |
protected Set |
lockTokens
Lock tokens |
protected AuthContext |
loginContext
the AuthContext of this session (can be null if this session was not instantiated through a login process) |
protected NamePathResolver |
namePathResolver
Name and Path resolver |
protected org.apache.jackrabbit.core.LocalNamespaceMappings |
nsMappings
the transient prefix/namespace mappings with session scope |
protected NodeTypeManagerImpl |
ntMgr
the node type manager |
static String |
READ_ACTION
prededfined action constants in checkPermission |
static String |
REMOVE_ACTION
|
protected RepositoryImpl |
rep
the repository that issued this session |
static String |
SET_PROPERTY_ACTION
|
protected Subject |
subject
the Subject of this session |
protected String |
userId
the user ID that was used to acquire this session |
protected ValueFactory |
valueFactory
value factory |
protected VersionManager |
versionMgr
The version manager for this session |
protected WorkspaceImpl |
wsp
the Workspace associated with this session |
Constructor Summary | |
---|---|
protected |
SessionImpl(RepositoryImpl rep,
AuthContext loginContext,
WorkspaceConfig wspConfig)
Protected constructor. |
protected |
SessionImpl(RepositoryImpl rep,
Subject subject,
WorkspaceConfig wspConfig)
Protected constructor. |
Method Summary | |
---|---|
void |
addListener(SessionListener listener)
Add a SessionListener |
void |
addLockToken(String lt)
|
void |
addLockToken(String lt,
boolean notify)
Internal implementation of addLockToken(String) . |
void |
checkPermission(String absPath,
String actions)
|
protected AccessManager |
createAccessManager(Subject subject,
HierarchyManager hierMgr)
Create the access manager. |
GarbageCollector |
createDataStoreGarbageCollector()
Create a data store garbage collector for this repository. |
protected ItemManager |
createItemManager(SessionItemStateManager itemStateMgr,
HierarchyManager hierMgr)
Create the item manager. |
protected SessionItemStateManager |
createSessionItemStateManager(LocalItemStateManager manager)
Create the session item state manager. |
protected VersionManager |
createVersionManager(RepositoryImpl rep)
Create the version manager. |
protected void |
createWorkspace(String workspaceName)
Creates a workspace with the given name. |
protected void |
createWorkspace(String workspaceName,
InputSource configTemplate)
Creates a workspace with the given name and a workspace configuration template. |
protected WorkspaceImpl |
createWorkspaceInstance(WorkspaceConfig wspConfig,
SharedItemStateManager stateMgr,
RepositoryImpl rep,
SessionImpl session)
Creates the workspace instance backing this session. |
void |
dump(PrintStream ps)
Dumps the state of this instance in a human readable format for diagnostic purposes. |
void |
exportDocumentView(String absPath,
ContentHandler contentHandler,
boolean skipBinary,
boolean noRecurse)
|
void |
exportSystemView(String absPath,
ContentHandler contentHandler,
boolean skipBinary,
boolean noRecurse)
|
AccessManager |
getAccessManager()
Returns the AccessManager associated with this session. |
Object |
getAttribute(String name)
|
String[] |
getAttributeNames()
|
HierarchyManager |
getHierarchyManager()
Returns the HierarchyManager associated with this session. |
ContentHandler |
getImportContentHandler(String parentAbsPath,
int uuidBehavior)
|
Item |
getItem(String absPath)
Returns the node or property at the given path. |
ItemManager |
getItemManager()
Returns the ItemManager of this session. |
protected SessionItemStateManager |
getItemStateManager()
Returns the SessionItemStateManager associated with this session. |
String |
getJCRName(Name name)
Returns the prefixed JCR name for the given qualified name. |
String |
getJCRPath(Path path)
Returns the prefixed JCR path for the given qualified path. |
LockManager |
getLockManager()
Return the lock manager for this session. |
Lock[] |
getLocks()
Returns all locks owned by this session. |
String[] |
getLockTokens()
|
NamePathResolver |
getNamePathResolver()
Returns the NamePathResolver of this session. |
String |
getNamespacePrefix(String uri)
|
String[] |
getNamespacePrefixes()
|
NamespaceResolver |
getNamespaceResolver()
Returns the NamespaceResolver of this session. |
String |
getNamespaceURI(String prefix)
|
Node |
getNode(String absPath)
Returns the node at the specified absolute path in the workspace. |
NodeImpl |
getNodeById(NodeId id)
Retrieves the Node with the given id. |
Node |
getNodeByIdentifier(String id)
Returns the node specified by the given identifier. |
Node |
getNodeByUUID(String uuid)
|
Node |
getNodeByUUID(UUID uuid)
Retrieves the referenceable node with the given UUID . |
NodeTypeManagerImpl |
getNodeTypeManager()
Returns the NodeTypeManager . |
Property |
getProperty(String absPath)
Returns the property at the specified absolute path in the workspace. |
Name |
getQName(String name)
Returns the qualified name for the given prefixed JCR name. |
Path |
getQPath(String path)
Returns the qualified path for the given prefixed JCR path. |
Repository |
getRepository()
|
Node |
getRootNode()
|
protected Subject |
getSubject()
Returns the Subject associated with this session. |
String |
getUserID()
|
ValueFactory |
getValueFactory()
|
VersionManager |
getVersionManager()
Returns the VersionManager associated with this session. |
Workspace |
getWorkspace()
|
protected String[] |
getWorkspaceNames()
Returns the names of all workspaces of this repository with respect of the access rights of this session. |
boolean |
hasPendingChanges()
|
Session |
impersonate(Credentials otherCredentials)
Logs in the same workspace with the given credentials. |
boolean |
isLive()
|
boolean |
itemExists(String absPath)
Calls AbstractSession.getItem(String) with the given path and returns
true if the call succeeds. |
void |
logout()
|
void |
move(String srcAbsPath,
String destAbsPath)
|
boolean |
nodeExists(String absPath)
Returns true if a node exists at absPath
and this Session has read access to it; otherwise returns
false . |
protected void |
notifyLoggedOut()
Notify the listeners that this session has been closed. |
protected void |
notifyLoggingOut()
Notify the listeners that this session is about to be closed. |
void |
refresh(boolean keepChanges)
|
void |
removeListener(SessionListener listener)
Remove a SessionListener |
void |
removeLockToken(String lt)
|
void |
removeLockToken(String lt,
boolean notify)
Internal implementation of removeLockToken(String) . |
protected void |
sanityCheck()
Performs a sanity check on this session. |
void |
save()
|
void |
setNamespacePrefix(String prefix,
String uri)
|
Methods inherited from class org.apache.jackrabbit.commons.AbstractSession |
---|
exportDocumentView, exportSystemView, importXML |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String READ_ACTION
public static final String REMOVE_ACTION
public static final String ADD_NODE_ACTION
public static final String SET_PROPERTY_ACTION
protected boolean alive
protected final RepositoryImpl rep
protected AuthContext loginContext
protected final Subject subject
protected final String userId
protected final HashMap attributes
protected final NodeTypeManagerImpl ntMgr
protected AccessManager accessMgr
protected final SessionItemStateManager itemStateMgr
protected final HierarchyManager hierMgr
protected final ItemManager itemMgr
protected final WorkspaceImpl wsp
protected final org.apache.jackrabbit.core.LocalNamespaceMappings nsMappings
protected final NamePathResolver namePathResolver
protected final VersionManager versionMgr
protected final Map listeners
protected final Set lockTokens
protected ValueFactory valueFactory
Constructor Detail |
---|
protected SessionImpl(RepositoryImpl rep, AuthContext loginContext, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
rep
- loginContext
- wspConfig
-
AccessDeniedException
- if the subject of the given login context
is not granted access to the specified
workspace
RepositoryException
- if another error occursprotected SessionImpl(RepositoryImpl rep, Subject subject, WorkspaceConfig wspConfig) throws AccessDeniedException, RepositoryException
rep
- subject
- wspConfig
-
AccessDeniedException
- if the given subject is not granted access
to the specified workspace
RepositoryException
- if another error occursMethod Detail |
---|
protected SessionItemStateManager createSessionItemStateManager(LocalItemStateManager manager)
protected WorkspaceImpl createWorkspaceInstance(WorkspaceConfig wspConfig, SharedItemStateManager stateMgr, RepositoryImpl rep, SessionImpl session)
wspConfig
- The workspace configurationstateMgr
- The shared item state managerrep
- The repositorysession
- The session
WorkspaceImpl
class or an extension
thereof.protected ItemManager createItemManager(SessionItemStateManager itemStateMgr, HierarchyManager hierMgr)
protected VersionManager createVersionManager(RepositoryImpl rep) throws RepositoryException
RepositoryException
protected AccessManager createAccessManager(Subject subject, HierarchyManager hierMgr) throws AccessDeniedException, RepositoryException
AccessDeniedException
- if the current subject is not granted access
to the current workspace
RepositoryException
- if the access manager cannot be instantiatedprotected void sanityCheck() throws RepositoryException
RepositoryException
- if this session has been rendered invalid
for some reason (e.g. if this session has
been closed explicitly or if it has expired)protected Subject getSubject()
Subject
associated with this session.
Subject
associated with this sessionpublic AccessManager getAccessManager()
AccessManager
associated with this session.
AccessManager
associated with this sessionpublic NodeTypeManagerImpl getNodeTypeManager()
NodeTypeManager
.
NodeTypeManager
public ItemManager getItemManager()
ItemManager
of this session.
ItemManager
public NamespaceResolver getNamespaceResolver()
NamespaceResolver
of this session.
NamespaceResolver
of this sessionpublic NamePathResolver getNamePathResolver()
NamePathResolver
of this session.
NamePathResolver
of this sessionprotected SessionItemStateManager getItemStateManager()
SessionItemStateManager
associated with this session.
SessionItemStateManager
associated with this sessionpublic HierarchyManager getHierarchyManager()
HierarchyManager
associated with this session.
HierarchyManager
associated with this sessionpublic VersionManager getVersionManager()
VersionManager
associated with this session.
VersionManager
associated with this sessionpublic Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException
UUID
.
uuid
- uuid of the node to be retrieved
ItemNotFoundException
- if no node exists with the given uuid or
if the existing node is not referenceable.
RepositoryException
- if another error occurs.getNodeByUUID(String)
,
getNodeById(NodeId)
public NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException
Node
with the given id.
id
- id of node to be retrieved
NodeId
.
ItemNotFoundException
- if no such node exists or if this
Session
does not have permission to access the node.
RepositoryException
- if another error occurs.protected String[] getWorkspaceNames() throws RepositoryException
RepositoryException
- if an error occursprotected void createWorkspace(String workspaceName) throws AccessDeniedException, RepositoryException
workspaceName
- name of the new workspace
AccessDeniedException
- if the current session is not allowed to
create the workspace
RepositoryException
- if a workspace with the given name
already exists or if another error occursprotected void createWorkspace(String workspaceName, InputSource configTemplate) throws AccessDeniedException, RepositoryException
workspaceName
- name of the new workspaceconfigTemplate
- the configuration template of the new workspace
AccessDeniedException
- if the current session is not allowed to
create the workspace
RepositoryException
- if a workspace with the given name already
exists or if another error occursprotected void notifyLoggingOut()
protected void notifyLoggedOut()
public void addListener(SessionListener listener)
SessionListener
listener
- the new listener to be informed on modificationspublic void removeListener(SessionListener listener)
SessionListener
listener
- an existing listenerpublic GarbageCollector createDataStoreGarbageCollector() throws RepositoryException, ItemStateException
ItemStateException
RepositoryException
public String getJCRName(Name name) throws NamespaceException
NameResolver
getJCRName
in interface NameResolver
name
- qualified name
NamespaceException
- if the namespace URI can not be resolvedpublic Name getQName(String name) throws IllegalNameException, NamespaceException
NameResolver
getQName
in interface NameResolver
name
- prefixed JCR name
IllegalNameException
- if the JCR name format is invalid
NamespaceException
- if the namespace prefix can not be resolvedpublic String getJCRPath(Path path) throws NamespaceException
PathResolver
getJCRPath
in interface PathResolver
path
- qualified path
NamespaceException
- if a namespace URI can not be resolvedpublic Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException
PathResolver
getQPath
in interface PathResolver
path
- prefixed JCR path
MalformedPathException
- if the JCR path format is invalid.
IllegalNameException
- if any of the JCR names contained in the path are invalid.
NamespaceException
- if a namespace prefix can not be resolved.public void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException
checkPermission
in interface Session
AccessControlException
RepositoryException
public Workspace getWorkspace()
getWorkspace
in interface Session
public Session impersonate(Credentials otherCredentials) throws LoginException, RepositoryException
The default implementation:
Repository
instance using
Session.getRepository()
Session.getWorkspace()
Workspace#getName()
Repository#login(Credentials, String)
on the
retrieved repository with the given credentials and the retrieved
workspace name.
impersonate
in interface Session
impersonate
in class AbstractSession
otherCredentials
- login credentials
RepositoryException
- if an error occurs
LoginException
public Node getRootNode() throws RepositoryException
getRootNode
in interface Session
RepositoryException
public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException
getNodeByUUID
in interface Session
ItemNotFoundException
RepositoryException
public Item getItem(String absPath) throws PathNotFoundException, RepositoryException
The default implementation:
PathNotFoundException
if the given path
does not start with a slash.
Node.getNode(String)
on the root node with the
part of the given path after the first slash
Node.getProperty(String)
similarly in case the
above call fails with a PathNotFoundException
getItem
in interface Session
getItem
in class AbstractSession
absPath
- absolute path
PathNotFoundException
- if the given path is invalid or not found
RepositoryException
- if another error occurspublic boolean itemExists(String absPath) throws RepositoryException
AbstractSession.getItem(String)
with the given path and returns
true
if the call succeeds. Returns false
if a PathNotFoundException
was thrown. Other exceptions are
passed through.
itemExists
in interface Session
itemExists
in class AbstractSession
absPath
- absolute path
true
if an item exists at the given path,
false
otherwise
RepositoryException
- if an error occurspublic void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException
save
in interface Session
AccessDeniedException
ItemExistsException
ConstraintViolationException
InvalidItemStateException
VersionException
LockException
NoSuchNodeTypeException
RepositoryException
public void refresh(boolean keepChanges) throws RepositoryException
refresh
in interface Session
RepositoryException
public boolean hasPendingChanges() throws RepositoryException
hasPendingChanges
in interface Session
RepositoryException
public void move(String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException
move
in interface Session
ItemExistsException
PathNotFoundException
VersionException
ConstraintViolationException
LockException
RepositoryException
public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, RepositoryException
getImportContentHandler
in interface Session
PathNotFoundException
ConstraintViolationException
VersionException
LockException
RepositoryException
public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException
exportDocumentView
in interface Session
PathNotFoundException
SAXException
RepositoryException
public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException
exportSystemView
in interface Session
PathNotFoundException
SAXException
RepositoryException
public boolean isLive()
isLive
in interface Session
public void logout()
logout
in interface Session
public Repository getRepository()
getRepository
in interface Session
public ValueFactory getValueFactory() throws UnsupportedRepositoryOperationException, RepositoryException
getValueFactory
in interface Session
UnsupportedRepositoryOperationException
RepositoryException
public String getUserID()
getUserID
in interface Session
public Object getAttribute(String name)
getAttribute
in interface Session
public String[] getAttributeNames()
getAttributeNames
in interface Session
public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException
setNamespacePrefix
in interface Session
NamespaceException
RepositoryException
public String[] getNamespacePrefixes() throws NamespaceException, RepositoryException
getNamespacePrefixes
in interface Session
NamespaceException
RepositoryException
public String getNamespaceURI(String prefix) throws NamespaceException, RepositoryException
getNamespaceURI
in interface Session
NamespaceException
RepositoryException
public String getNamespacePrefix(String uri) throws NamespaceException, RepositoryException
getNamespacePrefix
in interface Session
NamespaceException
RepositoryException
public void addLockToken(String lt)
addLockToken
in interface Session
public void addLockToken(String lt, boolean notify)
addLockToken(String)
. Additionally
takes a parameter indicating whether the lock manager needs to be
informed.
public String[] getLockTokens()
getLockTokens
in interface Session
public void removeLockToken(String lt)
removeLockToken
in interface Session
public void removeLockToken(String lt, boolean notify)
removeLockToken(String)
. Additionally
takes a parameter indicating whether the lock manager needs to be
informed.
public LockManager getLockManager() throws RepositoryException
RepositoryException
public Node getNodeByIdentifier(String id) throws ItemNotFoundException, RepositoryException
ItemNotFoundException
is thrown if no node with the
specified identifier exists. This exception is also thrown if this
Session does not have read access to the node with the
specified identifier.
A RepositoryException
is thrown if another error occurs.
- Parameters:
id
- An identifier.
- Returns:
- A
Node
.
- Throws:
ItemNotFoundException
- if the specified identifier is not found.
RepositoryException
- if another error occurs.- Since:
- JCR 2.0
public Node getNode(String absPath) throws PathNotFoundException, RepositoryException
PathNotFoundException
is thrown.
absPath
- An absolute path.
Node
.
PathNotFoundException
- If no node exists.
RepositoryException
- If another error occurs.public Property getProperty(String absPath) throws PathNotFoundException, RepositoryException
PathNotFoundException
is thrown.
absPath
- An absolute path.
Property
.
PathNotFoundException
- If no property exists.
RepositoryException
- if another error occurs.public boolean nodeExists(String absPath) throws RepositoryException
true
if a node exists at absPath
and this Session
has read access to it; otherwise returns
false
.
Throws a RepositoryException
if absPath
is not a well-formed absolute path.
absPath
- An absolute path.
boolean
RepositoryException
- if absPath
is not a well-formed
absolute path.public Lock[] getLocks()
Lock
spublic void dump(PrintStream ps)
dump
in interface Dumpable
ps
- stream to dump state to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |