public class SessionImpl extends AbstractSession implements NamespaceResolver, ManagerProvider
SessionImpl
...Modifier and Type | Method and Description |
---|---|
void |
addListener(SessionListener listener)
Add a
SessionListener |
void |
addLockToken(String lt) |
void |
checkPermission(String absPath,
String actions) |
protected ItemManager |
createItemManager(HierarchyManager hierarchyManager) |
protected SessionItemStateManager |
createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager,
ItemStateFactory isf) |
protected WorkspaceImpl |
createWorkspaceInstance(RepositoryConfig config,
SessionInfo sessionInfo) |
javax.jcr.security.AccessControlManager |
getAccessControlManager() |
AccessControlProvider |
getAccessControlProvider() |
AccessManager |
getAccessManager() |
Object |
getAttribute(String name)
Always returns
null . |
String[] |
getAttributeNames()
Always returns an empty String array.
|
EffectiveNodeTypeProvider |
getEffectiveNodeTypeProvider() |
HierarchyManager |
getHierarchyManager() |
IdFactory |
getIdFactory() |
ContentHandler |
getImportContentHandler(String parentAbsPath,
int uuidBehavior) |
javax.jcr.Item |
getItem(String absPath)
Returns the node or property at the given path.
|
ItemDefinitionProvider |
getItemDefinitionProvider() |
javax.jcr.ValueFactory |
getJcrValueFactory()
Same as
Session.getValueFactory() but omits the check, if this repository
is really level 2 compliant. |
LockStateManager |
getLockStateManager()
Returns the
LockStateManager associated with this
ManagerProvider . |
String[] |
getLockTokens() |
NameFactory |
getNameFactory() |
NamePathResolver |
getNamePathResolver() |
NameResolver |
getNameResolver() |
NamespaceResolver |
getNamespaceResolver() |
javax.jcr.Node |
getNode(String absPath)
Returns the node with the given absolute path.
|
javax.jcr.Node |
getNodeByIdentifier(String id) |
javax.jcr.Node |
getNodeByUUID(String uuid) |
NodeTypeDefinitionProvider |
getNodeTypeDefinitionProvider() |
PathResolver |
getPathResolver() |
String |
getPrefix(String uri)
Returns the prefix which is mapped to the given URI.
|
javax.jcr.Property |
getProperty(String absPath)
Returns the property with the given absolute path.
|
QValueFactory |
getQValueFactory() |
javax.jcr.Repository |
getRepository() |
javax.jcr.retention.RetentionManager |
getRetentionManager() |
javax.jcr.Node |
getRootNode() |
String |
getURI(String prefix)
Returns the URI to which the given prefix is mapped.
|
String |
getUserID() |
ItemStateValidator |
getValidator() |
javax.jcr.ValueFactory |
getValueFactory() |
VersionManager |
getVersionStateManager()
Returns the
VersionManager associated with this
ManagerProvider . |
javax.jcr.Workspace |
getWorkspace() |
boolean |
hasCapability(String methodName,
Object target,
Object[] arguments) |
boolean |
hasPendingChanges() |
boolean |
hasPermission(String absPath,
String actions) |
javax.jcr.Session |
impersonate(javax.jcr.Credentials credentials)
Logs in the same workspace with the given credentials.
|
void |
importXML(String parentAbsPath,
InputStream in,
int uuidBehavior)
Parses the given input stream as an XML document and processes the
SAX events using the
ContentHandler returned by
Session.getImportContentHandler(String, int) . |
boolean |
isLive() |
boolean |
itemExists(String absPath)
Calls
AbstractSession.getItem(String) with the given path and returns
true if the call succeeds. |
void |
logout()
Clears the local namespace mappings.
|
void |
move(String srcAbsPath,
String destAbsPath) |
boolean |
nodeExists(String absPath)
Checks whether a node with the given absolute path exists.
|
boolean |
propertyExists(String absPath)
Checks whether a property with the given absolute path exists.
|
void |
refresh(boolean keepChanges) |
void |
removeItem(String absPath)
Removes the identified item.
|
void |
removeListener(SessionListener listener)
Remove a
SessionListener |
void |
removeLockToken(String lt) |
void |
save() |
void |
setNamespacePrefix(String prefix,
String uri)
Modifies the session local namespace mappings to contain the given
prefix to URI mapping.
|
exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI
public javax.jcr.Repository getRepository()
getRepository
in interface javax.jcr.Session
Session.getRepository()
public String getUserID()
getUserID
in interface javax.jcr.Session
Session.getUserID()
public Object getAttribute(String name)
null
.getAttribute
in interface javax.jcr.Session
Session.getAttribute(String)
public String[] getAttributeNames()
getAttributeNames
in interface javax.jcr.Session
Session.getAttributeNames()
public javax.jcr.Workspace getWorkspace()
getWorkspace
in interface javax.jcr.Session
Session.getWorkspace()
public javax.jcr.Session impersonate(javax.jcr.Credentials credentials) throws javax.jcr.LoginException, javax.jcr.RepositoryException
AbstractSession
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 javax.jcr.Session
impersonate
in class AbstractSession
credentials
- login credentialsjavax.jcr.RepositoryException
- if an error occursjavax.jcr.LoginException
Session.impersonate(Credentials)
public javax.jcr.Node getRootNode() throws javax.jcr.RepositoryException
getRootNode
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.getRootNode()
public javax.jcr.Node getNodeByUUID(String uuid) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
getNodeByUUID
in interface javax.jcr.Session
javax.jcr.ItemNotFoundException
javax.jcr.RepositoryException
Session.getNodeByUUID(String)
public javax.jcr.Item getItem(String absPath) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AbstractSession
The default implementation:
Session.getNodeByIdentifier(String)
for identifier
paths
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 javax.jcr.Session
getItem
in class AbstractSession
absPath
- absolute pathjavax.jcr.PathNotFoundException
- if the given path is invalid or not foundjavax.jcr.RepositoryException
- if another error occursSession.getItem(String)
public boolean itemExists(String absPath) throws javax.jcr.RepositoryException
AbstractSession
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 javax.jcr.Session
itemExists
in class AbstractSession
absPath
- absolute pathtrue
if an item exists at the given path,
false
otherwisejavax.jcr.RepositoryException
- if an error occursSession.itemExists(String)
public void move(String srcAbsPath, String destAbsPath) throws javax.jcr.ItemExistsException, javax.jcr.PathNotFoundException, javax.jcr.version.VersionException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
move
in interface javax.jcr.Session
javax.jcr.ItemExistsException
javax.jcr.PathNotFoundException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
Session.move(String, String)
public void save() throws javax.jcr.AccessDeniedException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.InvalidItemStateException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
save
in interface javax.jcr.Session
javax.jcr.AccessDeniedException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.InvalidItemStateException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
Session.save()
public void refresh(boolean keepChanges) throws javax.jcr.RepositoryException
refresh
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.refresh(boolean)
public boolean hasPendingChanges() throws javax.jcr.RepositoryException
hasPendingChanges
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.hasPendingChanges()
public javax.jcr.ValueFactory getValueFactory() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
getValueFactory
in interface javax.jcr.Session
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Session.getValueFactory()
public void checkPermission(String absPath, String actions) throws AccessControlException, javax.jcr.RepositoryException
checkPermission
in interface javax.jcr.Session
AccessControlException
javax.jcr.RepositoryException
Session.checkPermission(String, String)
public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws javax.jcr.PathNotFoundException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
getImportContentHandler
in interface javax.jcr.Session
javax.jcr.PathNotFoundException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
Session.getImportContentHandler(String, int)
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, javax.jcr.PathNotFoundException, javax.jcr.ItemExistsException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.version.VersionException, javax.jcr.InvalidSerializedDataException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
AbstractSession
ContentHandler
returned by
Session.getImportContentHandler(String, int)
.importXML
in interface javax.jcr.Session
importXML
in class AbstractSession
parentAbsPath
- passed throughin
- input stream to be parsed as XML and importeduuidBehavior
- passed throughIOException
- if an I/O error occursjavax.jcr.InvalidSerializedDataException
- if an XML parsing error occursjavax.jcr.RepositoryException
- if a repository error occursjavax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
Session.importXML(String, java.io.InputStream, int)
public void setNamespacePrefix(String prefix, String uri) throws javax.jcr.RepositoryException
AbstractSession
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
setNamespacePrefix
in interface javax.jcr.Session
setNamespacePrefix
in class AbstractSession
prefix
- namespace prefixuri
- namespace URIjavax.jcr.NamespaceException
- if the mapping is illegaljavax.jcr.RepositoryException
- if a repository error occursSession.setNamespacePrefix(String, String)
public void logout()
AbstractSession
super.logout()
when overriding this method to avoid
namespace mappings to be carried over to a new session.logout
in interface javax.jcr.Session
logout
in class AbstractSession
Session.logout()
public boolean isLive()
isLive
in interface javax.jcr.Session
Session.isLive()
public void addLockToken(String lt)
addLockToken
in interface javax.jcr.Session
Session.addLockToken(String)
public String[] getLockTokens()
getLockTokens
in interface javax.jcr.Session
Session.getLockTokens()
public void removeLockToken(String lt)
removeLockToken
in interface javax.jcr.Session
Session.removeLockToken(String)
public javax.jcr.security.AccessControlManager getAccessControlManager() throws javax.jcr.RepositoryException
getAccessControlManager
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.getAccessControlManager()
public javax.jcr.Node getNode(String absPath) throws javax.jcr.RepositoryException
AbstractSession
getNode
in interface javax.jcr.Session
getNode
in class AbstractSession
absPath
- absolute pathjavax.jcr.RepositoryException
- if the node can not be accessedSession.getNode(String)
public javax.jcr.Node getNodeByIdentifier(String id) throws javax.jcr.RepositoryException
getNodeByIdentifier
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.getNodeByIdentifier(String)
public javax.jcr.Property getProperty(String absPath) throws javax.jcr.RepositoryException
AbstractSession
getProperty
in interface javax.jcr.Session
getProperty
in class AbstractSession
absPath
- absolute pathjavax.jcr.RepositoryException
- if the property can not be accessedSession.getProperty(String)
public javax.jcr.retention.RetentionManager getRetentionManager() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
getRetentionManager
in interface javax.jcr.Session
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Session.getRetentionManager()
public boolean hasCapability(String methodName, Object target, Object[] arguments) throws javax.jcr.RepositoryException
hasCapability
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.hasCapability(String, Object, Object[])
public boolean hasPermission(String absPath, String actions) throws javax.jcr.RepositoryException
hasPermission
in interface javax.jcr.Session
javax.jcr.RepositoryException
Session.hasPermission(String, String)
public boolean nodeExists(String absPath) throws javax.jcr.RepositoryException
AbstractSession
nodeExists
in interface javax.jcr.Session
nodeExists
in class AbstractSession
absPath
- absolute pathtrue
if a node with the given path exists,
false
otherwisejavax.jcr.RepositoryException
- if the path is invalidSession.nodeExists(String)
public boolean propertyExists(String absPath) throws javax.jcr.RepositoryException
AbstractSession
propertyExists
in interface javax.jcr.Session
propertyExists
in class AbstractSession
absPath
- absolute pathtrue
if a property with the given path exists,
false
otherwisejavax.jcr.RepositoryException
- if the path is invalidSession.propertyExists(String)
public void removeItem(String absPath) throws javax.jcr.RepositoryException
AbstractSession
Item.remove()
on the item removed by AbstractSession.getItem(String)
.removeItem
in interface javax.jcr.Session
removeItem
in class AbstractSession
absPath
- An absolute path of the item to be removedjavax.jcr.RepositoryException
- if the item can not be removedSession.removeItem(String)
public String getPrefix(String uri) throws javax.jcr.NamespaceException
NamespaceResolver
getPrefix
in interface NamespaceResolver
uri
- namespace URIjavax.jcr.NamespaceException
- if the URI is unknown.NamespaceResolver.getPrefix(String)
public String getURI(String prefix) throws javax.jcr.NamespaceException
NamespaceResolver
getURI
in interface NamespaceResolver
prefix
- namespace prefixjavax.jcr.NamespaceException
- if the prefix is unknown.NamespaceResolver.getURI(String)
public void addListener(SessionListener listener)
SessionListener
listener
- the new listener to be informed on modificationspublic void removeListener(SessionListener listener)
SessionListener
listener
- an existing listenerprotected WorkspaceImpl createWorkspaceInstance(RepositoryConfig config, SessionInfo sessionInfo) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected SessionItemStateManager createSessionItemStateManager(UpdatableItemStateManager workspaceStateManager, ItemStateFactory isf) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected ItemManager createItemManager(HierarchyManager hierarchyManager)
public NamePathResolver getNamePathResolver()
getNamePathResolver
in interface ManagerProvider
ManagerProvider.getNamePathResolver()
public NameResolver getNameResolver()
getNameResolver
in interface ManagerProvider
ManagerProvider.getNameResolver()
public PathResolver getPathResolver()
getPathResolver
in interface ManagerProvider
ManagerProvider.getPathResolver()
public NamespaceResolver getNamespaceResolver()
getNamespaceResolver
in interface ManagerProvider
ManagerProvider.getNamespaceResolver()
public HierarchyManager getHierarchyManager()
getHierarchyManager
in interface ManagerProvider
ManagerProvider.getHierarchyManager()
public LockStateManager getLockStateManager()
ManagerProvider
LockStateManager
associated with this
ManagerProvider
.getLockStateManager
in interface ManagerProvider
LockStateManager
associated with this
ManagerProvider
ManagerProvider.getLockStateManager()
public AccessManager getAccessManager()
getAccessManager
in interface ManagerProvider
ManagerProvider.getAccessManager()
public VersionManager getVersionStateManager()
ManagerProvider
VersionManager
associated with this
ManagerProvider
.getVersionStateManager
in interface ManagerProvider
VersionManager
associated with this
ManagerProvider
ManagerProvider.getVersionStateManager()
public ItemDefinitionProvider getItemDefinitionProvider()
getItemDefinitionProvider
in interface ManagerProvider
ManagerProvider.getItemDefinitionProvider()
public NodeTypeDefinitionProvider getNodeTypeDefinitionProvider()
getNodeTypeDefinitionProvider
in interface ManagerProvider
ManagerProvider.getNodeTypeDefinitionProvider()
public EffectiveNodeTypeProvider getEffectiveNodeTypeProvider()
getEffectiveNodeTypeProvider
in interface ManagerProvider
ManagerProvider.getEffectiveNodeTypeProvider()
public QValueFactory getQValueFactory() throws javax.jcr.RepositoryException
getQValueFactory
in interface ManagerProvider
javax.jcr.RepositoryException
ManagerProvider.getQValueFactory()
public AccessControlProvider getAccessControlProvider() throws javax.jcr.RepositoryException
getAccessControlProvider
in interface ManagerProvider
javax.jcr.RepositoryException
ManagerProvider.getAccessControlProvider()
public javax.jcr.ValueFactory getJcrValueFactory() throws javax.jcr.RepositoryException
ManagerProvider
Session.getValueFactory()
but omits the check, if this repository
is really level 2 compliant. Therefore, this method may be used for
internal functionality only, that require creation and conversion of
JCR values.getJcrValueFactory
in interface ManagerProvider
javax.jcr.RepositoryException
ManagerProvider.getJcrValueFactory()
public ItemStateValidator getValidator()
public IdFactory getIdFactory() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public NameFactory getNameFactory() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.