public abstract class AbstractSession
extends java.lang.Object
Session
interface.Constructor and Description |
---|
AbstractSession() |
Modifier and Type | Method and Description |
---|---|
void |
exportDocumentView(java.lang.String path,
org.xml.sax.ContentHandler handler,
boolean skipBinary,
boolean noRecurse)
Generates a document view export using a
DocumentViewExporter
instance. |
void |
exportDocumentView(java.lang.String absPath,
java.io.OutputStream out,
boolean skipBinary,
boolean noRecurse)
Calls
Session#exportDocumentView(String, ContentHandler, boolean, boolean)
with the given arguments and a ContentHandler that serializes
SAX events to the given output stream. |
void |
exportSystemView(java.lang.String path,
org.xml.sax.ContentHandler handler,
boolean skipBinary,
boolean noRecurse)
Generates a system view export using a
SystemViewExporter
instance. |
void |
exportSystemView(java.lang.String absPath,
java.io.OutputStream out,
boolean skipBinary,
boolean noRecurse)
Calls
Session#exportSystemView(String, ContentHandler, boolean, boolean)
with the given arguments and a ContentHandler that serializes
SAX events to the given output stream. |
Item |
getItem(java.lang.String absPath)
Returns the node or property at the given path.
|
java.lang.String |
getNamespacePrefix(java.lang.String uri)
Returns the namespace prefix mapped to the given URI.
|
java.lang.String[] |
getNamespacePrefixes()
Returns the prefixes of all known namespace mappings.
|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Returns the namespace URI mapped to the given prefix.
|
Node |
getNode(java.lang.String absPath)
Returns the node with the given absolute path.
|
Property |
getProperty(java.lang.String absPath)
Returns the property with the given absolute path.
|
Session |
impersonate(Credentials credentials)
Logs in the same workspace with the given credentials.
|
void |
importXML(java.lang.String parentAbsPath,
java.io.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 |
itemExists(java.lang.String absPath)
Calls
getItem(String) with the given path and returns
true if the call succeeds. |
void |
logout()
Clears the local namespace mappings.
|
boolean |
nodeExists(java.lang.String absPath)
Checks whether a node with the given absolute path exists.
|
boolean |
propertyExists(java.lang.String absPath)
Checks whether a property with the given absolute path exists.
|
void |
removeItem(java.lang.String absPath)
Removes the identified item.
|
void |
setNamespacePrefix(java.lang.String prefix,
java.lang.String uri)
Modifies the session local namespace mappings to contain the given
prefix to URI mapping.
|
public void logout()
super.logout()
when overriding this method to avoid
namespace mappings to be carried over to a new session.public java.lang.String getNamespacePrefix(java.lang.String uri) throws NamespaceException, RepositoryException
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
uri
- namespace URINamespaceException
- if the namespace is not foundRepositoryException
- if a repository error occurspublic java.lang.String getNamespaceURI(java.lang.String prefix) throws NamespaceException, RepositoryException
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
prefix
- namespace prefixNamespaceException
- if the namespace is not foundRepositoryException
- if a repository error occurspublic java.lang.String[] getNamespacePrefixes() throws RepositoryException
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
RepositoryException
- if a repository error occurspublic void setNamespacePrefix(java.lang.String prefix, java.lang.String uri) throws NamespaceException, RepositoryException
This behaviour is based on JSR 283 (JCR 2.0), but remains backwards compatible with JCR 1.0.
prefix
- namespace prefixuri
- namespace URINamespaceException
- if the mapping is illegalRepositoryException
- if a repository error occurspublic void exportDocumentView(java.lang.String path, org.xml.sax.ContentHandler handler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, org.xml.sax.SAXException, RepositoryException
DocumentViewExporter
instance.path
- of the node to be exportedhandler
- handler for the SAX events of the exportskipBinary
- whether binary values should be skippednoRecurse
- whether to export just the identified nodePathNotFoundException
- if a node at the given path does not existorg.xml.sax.SAXException
- if the SAX event handler failedRepositoryException
- if another error occurspublic void exportSystemView(java.lang.String path, org.xml.sax.ContentHandler handler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, org.xml.sax.SAXException, RepositoryException
SystemViewExporter
instance.path
- of the node to be exportedhandler
- handler for the SAX events of the exportskipBinary
- whether binary values should be skippednoRecurse
- whether to export just the identified nodePathNotFoundException
- if a node at the given path does not existorg.xml.sax.SAXException
- if the SAX event handler failedRepositoryException
- if another error occurspublic void exportDocumentView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) throws java.io.IOException, RepositoryException
Session#exportDocumentView(String, ContentHandler, boolean, boolean)
with the given arguments and a ContentHandler
that serializes
SAX events to the given output stream.absPath
- passed throughout
- output stream to which the SAX events are serializedskipBinary
- passed throughnoRecurse
- passed throughjava.io.IOException
- if the SAX serialization failedRepositoryException
- if another error occurspublic void exportSystemView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) throws java.io.IOException, RepositoryException
Session#exportSystemView(String, ContentHandler, boolean, boolean)
with the given arguments and a ContentHandler
that serializes
SAX events to the given output stream.absPath
- passed throughout
- output stream to which the SAX events are serializedskipBinary
- passed throughnoRecurse
- passed throughjava.io.IOException
- if the SAX serialization failedRepositoryException
- if another error occurspublic void importXML(java.lang.String parentAbsPath, java.io.InputStream in, int uuidBehavior) throws java.io.IOException, InvalidSerializedDataException, RepositoryException
ContentHandler
returned by
Session#getImportContentHandler(String, int)
.parentAbsPath
- passed throughin
- input stream to be parsed as XML and importeduuidBehavior
- passed throughjava.io.IOException
- if an I/O error occursInvalidSerializedDataException
- if an XML parsing error occursRepositoryException
- if a repository error occurspublic Item getItem(java.lang.String absPath) throws PathNotFoundException, RepositoryException
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
absPath
- absolute pathPathNotFoundException
- if the given path is invalid or not foundRepositoryException
- if another error occursSession#getItem(String)
public boolean itemExists(java.lang.String absPath) throws RepositoryException
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.absPath
- absolute pathtrue
if an item exists at the given path,
false
otherwiseRepositoryException
- if an error occursSession#itemExists(String)
public void removeItem(java.lang.String absPath) throws RepositoryException
Item#remove()
on the item removed by getItem(String)
.absPath
- An absolute path of the item to be removedRepositoryException
- if the item can not be removedSession#removeItem(String)
public Node getNode(java.lang.String absPath) throws RepositoryException
absPath
- absolute pathRepositoryException
- if the node can not be accessedSession#getNode(String)
public boolean nodeExists(java.lang.String absPath) throws RepositoryException
absPath
- absolute pathtrue
if a node with the given path exists,
false
otherwiseRepositoryException
- if the path is invalidSession#nodeExists(String)
public Property getProperty(java.lang.String absPath) throws RepositoryException
absPath
- absolute pathRepositoryException
- if the property can not be accessedSession#getProperty(String)
public boolean propertyExists(java.lang.String absPath) throws RepositoryException
absPath
- absolute pathtrue
if a property with the given path exists,
false
otherwiseRepositoryException
- if the path is invalidSession#propertyExists(String)
public Session impersonate(Credentials credentials) throws 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.
credentials
- login credentialsRepositoryException
- if an error occurs"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"