public interface ExtendedSession
extends javax.jcr.Session
Modifier and Type | Method and Description |
---|---|
void |
exportSystemView(String absPath,
OutputStream out,
boolean skipBinary,
boolean noRecurse,
boolean exportChildVersionHisotry)
Serializes the node (and if
noRecurse is false ,
the whole subtree) at absPath into a series of SAX events by
calling the methods of the supplied org.xml.sax.ContentHandler . |
String |
getId() |
org.exoplatform.services.jcr.impl.core.LocationFactory |
getLocationFactory() |
javax.jcr.Node |
getNodeByIdentifier(String identifier)
Get node by unique identifier.
|
long |
getTimeout()
Gives the local timeout of the session
|
XAResource |
getXAResource()
Gives the XA representation of the session
|
boolean |
hasExpired()
Indicates whether the session has expired or not.
|
void |
importXML(String parentAbsPath,
InputStream in,
int uuidBehavior,
Map<String,Object> context)
Deserialize an XML document and adds the resulting item subtree as a child of the node at
parentAbsPath.
|
void |
move(String srcAbsPath,
String destAbsPath,
boolean triggerEventsForDescendants)
Moves the node at
srcAbsPath (and its entire subtree) to the new location
at destAbsPath . |
void |
registerLifecycleListener(SessionLifecycleListener listener)
Registers session listener.
|
void |
setTimeout(long timeout)
Sets the local timeout of the session
|
addLockToken, checkPermission, exportDocumentView, exportDocumentView, exportSystemView, exportSystemView, getAttribute, getAttributeNames, getImportContentHandler, getItem, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNodeByUUID, getRepository, getRootNode, getUserID, getValueFactory, getWorkspace, hasPendingChanges, impersonate, importXML, isLive, itemExists, logout, move, refresh, removeLockToken, save, setNamespacePrefix
String getId()
org.exoplatform.services.jcr.impl.core.LocationFactory getLocationFactory()
javax.jcr.Node getNodeByIdentifier(String identifier) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
identifier
- node identifierjavax.jcr.ItemNotFoundException
- id node with supplied identifier not foundjavax.jcr.RepositoryException
- if any repository errors occursvoid importXML(String parentAbsPath, InputStream in, int uuidBehavior, Map<String,Object> context) throws IOException, javax.jcr.PathNotFoundException, javax.jcr.ItemExistsException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.InvalidSerializedDataException, javax.jcr.RepositoryException
parentAbsPath
- the absolute path of the node below which the deserialized subtree is added.in
- The Inputstream
from which the XML to be deserilaized is read.uuidBehavior
- a four-value flag that governs how incoming UUIDs are handled.context
- IOException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.InvalidSerializedDataException
javax.jcr.RepositoryException
void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse, boolean exportChildVersionHisotry) throws IOException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
noRecurse
is false
,
the whole subtree) at absPath
into a series of SAX events by
calling the methods of the supplied org.xml.sax.ContentHandler
.
The resulting XML is in the document view form. Note that absPath
must be the path of a node, not a property.
If skipBinary
is true then any properties of PropertyType.BINARY
will be
serialized as if they are empty. That is, the existence of the property
will be serialized, but its content will not appear in the serialized
output (the value of the attribute will be empty). If skipBinary
is false
then the actual value(s) of each BINARY
property is recorded using Base64
encoding.
If noRecurse
is true then only the node at
absPath
and its properties, but not its child nodes, are
serialized. If noRecurse
is false
then the entire subtree
rooted at absPath
is serialized.
If the user lacks read access to some subsection of the specified tree, that section simply does not get serialized, since, from the user's point of view, it is not there.
The serialized output will reflect the state of the current workspace as
modified by the state of this Session
. This means that
pending changes (regardless of whether they are valid according to
node type constraints) and the current session-mapping of namespaces
are reflected in the output.
A PathNotFoundException
is thrown if no node exists at absPath
.
A SAXException
is thrown if an error occurs while feeding events to the
ContentHandler
.
absPath
- The path of the root of the subtree to be serialized.
This must be the path to a node, not a propertyout
- The org.xml.sax.ContentHandler
to
which the SAX events representing the XML serialization of the subtree
will be output.skipBinary
- A boolean
governing whether binary
properties are to be serialized.noRecurse
- A boolean
governing whether the subtree at
absPath is to be recursed.exportChildVersionHisotry
- A boolean
governing whether child nodes
version histories must be included into resulting xml.javax.jcr.PathNotFoundException
- if no node exists at absPath
.SAXException
- if an error occurs while feeding events to the
org.xml.sax.ContentHandler
.javax.jcr.RepositoryException
- if another error occurs.IOException
void registerLifecycleListener(SessionLifecycleListener listener)
listener
- long getTimeout()
void setTimeout(long timeout)
timeout
- the new local timeout any value lower or equals to 0 will disable the timeout,
the expected value is expressed in millisecondsboolean hasExpired()
true
if it has expired, false
otherwise.XAResource getXAResource()
XAResource
corresponding to the sessionvoid move(String srcAbsPath, String destAbsPath, boolean triggerEventsForDescendants) throws javax.jcr.ItemExistsException, javax.jcr.PathNotFoundException, javax.jcr.version.VersionException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.lock.LockException, javax.jcr.RepositoryException
srcAbsPath
(and its entire subtree) to the new location
at destAbsPath
. Method can help to avoid performance impacts on "rename" of big trees.
Rename means move of node within same parent. Keep in mind that this method will not give a performance growth
on renaming of small trees but even probably will cause a decrease. Also it means that all listeners connected
with descendants will not get events. Also in case of QuotaManager it will call re-calculating size of
moved node and this will affect performance decrease.
In order to persist the change, a save
must be called on either the session or a common ancestor to both the source and destination locations.
ConstraintViolationException
is thrown either immediately or on save
if performing this operation would violate a node type or implementation-specific constraint.
Implementations may differ on when this validation is performed.
As well, a ConstraintViolationException
will be thrown on
save
if an attempt is made to separately save
either the source or destination node.
Note that this behavior differs from that of
Workspace.move(java.lang.String, java.lang.String)
, which operates directly in the persistent
workspace and does not require a save
.
destAbsPath
provided must not
have an index on its final element. If it does then a RepositoryException
is thrown. Strictly speaking, the destAbsPath
parameter is actually an absolute path
to the parent node of the new location, appended with the new name desired for the
moved node. It does not specify a position within the child node
ordering (if such ordering is supported). If ordering is supported by the node type of
the parent node of the new location, then the newly moved node is appended to the end of the
child node list.
This method cannot be used to move just an individual property by itself.
It moves an entire node and its subtree (including, of course, any properties
contained therein).
If no node exists at srcAbsPath
or no node exists one level above destAbsPath
(in other words, there is no node that will serve as the parent of the moved item) then a
PathNotFoundException
is thrown either immediately or on save
.
Implementations may differ on when this validation is performed.
An ItemExistsException
is thrown either immediately or on save
if a property already exists at destAbsPath
or a node already exists there and same-name siblings
are not allowed. Implementations may differ on when this validation is performed.
A VersionException
is thrown either immediately or on save
if the parent node of destAbsPath
or the parent node of srcAbsPath] is versionable and
checked-in, or is non-versionable and its nearest versionable ancestor is checked-in.
Implementations may differ on when this validation is performed.
A LockException
is thrown either immediately or on save
if a lock prevents the move
. Implementations may differ on when this validation is performed.
srcAbsPath
- the root of the subtree to be moved.destAbsPath
- the location to which the subtree is to be moved.triggerEventsForDescendants
- indicates whether or not each descendant item must be included into the
changes log in case of a move or a rename. If you have a small amount of nodes to move, it is faster to set it to
true
but in case you have a big amount of nodes it will be faster to set it to false
javax.jcr.ItemExistsException
- if a property already exists at
destAbsPath
or a node already exist there, and same name
siblings are not allowed and this
implementation performs this validation immediately instead of waiting until save
.javax.jcr.PathNotFoundException
- if either srcAbsPath
or destAbsPath
cannot be found and this
implementation performs this validation immediately instead of waiting until save
.javax.jcr.version.VersionException
- if the parent node of destAbsPath
or the parent node of srcAbsPath
is versionable and checked-in, or or is non-verionable and its nearest versionable ancestor is checked-in and this
implementation performs this validation immediately instead of waiting until save
.javax.jcr.nodetype.ConstraintViolationException
- if a node-type or other constraint violation is detected immediately and this
implementation performs this validation immediately instead of waiting until save
.javax.jcr.lock.LockException
- if the move operation would violate a lock and this
implementation performs this validation immediately instead of waiting until save
.javax.jcr.RepositoryException
- if the last element of destAbsPath
has an index or if another error occurs.Copyright © 2003-2017 eXo Platform SAS. All Rights Reserved.