|
Oracle Beehive Java Content Repository Java API Reference Release 1 (1.4) E13801-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OracleSession
The OracleSession
object provides read and (in level 2) write access to the content of a particular workspace in the repository. <p/> The OracleSession
object is returned by OracleRepository.login(javax.jcr.Credentials, java.lang.String)
. It encapsulates both the authorization settings of a particular user (as specified by the passed Credentials
). <p/> Each OracleSession
object is associated one-to-one with a OracleWorkspace
object. The Workspace
object represents a "view" of an actual repository workspace entity as seen through the authorization settings of its associated OracleSession
.
Method Summary | |
---|---|
void |
addLockToken(java.lang.String lt) Adds the specified lock token to this session. |
void |
checkPermission(java.lang.String absPath, java.lang.String actions) Determines whether this Session has permission to perform the specified actions at the specified absPath . |
void |
exportDocumentView(java.lang.String absPath, org.xml.sax.ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) This operation is not supported |
void |
exportDocumentView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) |
void |
exportSystemView(java.lang.String absPath, org.xml.sax.ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) |
void |
exportSystemView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) |
java.lang.Object |
getAttribute(java.lang.String name) Returns the value of the named attribute as an Object , or null if no attribute of the given name exists. |
java.lang.String[] |
getAttributeNames() Returns the names of the attributes set in this session as a result of the Credentials that were used to acquire it. |
org.xml.sax.ContentHandler |
getImportContentHandler(java.lang.String parentAbsPath, int uuidBehavior) Returns an org.xml.sax.ContentHandler which can be used to push SAX events into the repository. |
javax.jcr.Item |
getItem(java.lang.String absPath) Returns the item at the specified absolute path in the workspace. |
java.lang.String[] |
getLockTokens() Returns an array containing all lock tokens currently held by this session. |
java.lang.String |
getNamespacePrefix(java.lang.String uri) Returns the prefix to which the given URI is mapped |
java.lang.String[] |
getNamespacePrefixes() Returns all prefixes currently set for this session. |
java.lang.String |
getNamespaceURI(java.lang.String prefix) For a given prefix, returns the URI to which it is mapped as currently set in this Session . |
javax.jcr.Node |
getNodeByUUID(java.lang.String uuid) Returns the node specified by the given UUID. |
javax.jcr.Repository |
getRepository() Returns the Repository object through which this session was acquired. |
javax.jcr.Node |
getRootNode() Returns the root node of the workspace. |
java.lang.String |
getUserID() Gets the user ID that was used to acquire this session. |
javax.jcr.ValueFactory |
getValueFactory() This method returns a ValueFactory that is used to create Value objects for use when setting repository properties. |
javax.jcr.Workspace |
getWorkspace() Returns the Workspace attached to this Session . |
boolean |
hasPendingChanges() Returns true if this session holds pending (that is, unsaved) changes; otherwise returns false . |
javax.jcr.Session |
impersonate(javax.jcr.Credentials credentials) Returns a new session in accordance with the specified (new) Credentials. |
void |
importXML(java.lang.String parentAbsPath, java.io.InputStream in, int uuidBehavior) Deserializes an XML document and adds the resulting item subtree as a child of the node at parentAbsPath. |
boolean |
isLive() Returns true if this Session object is usable by the client. |
boolean |
itemExists(java.lang.String absPath) Returns true if an item exists at absPath ; otherwise returns false . |
void |
logout() Releases all resources associated with this Session . |
void |
move(java.lang.String srcAbsPath, java.lang.String destAbsPath) Moves the node at srcAbsPath (and its entire subtree) to the new location at destAbsPath . |
void |
refresh(boolean keepChanges) If keepChanges is false , this method discards all pending changes currently recorded in this Session and returns all items to reflect the current saved state. |
void |
removeLockToken(java.lang.String lt) Removes the specified lock token from this session. |
void |
save() Validates all pending changes currently recorded in this Session . |
void |
setNamespacePrefix(java.lang.String prefix, java.lang.String uri) Within the scope of this session, rename a persistently registered namespace URI to the new prefix. |
Method Detail |
---|
javax.jcr.Repository getRepository()
Repository
object through which this session was acquired.getRepository
in interface javax.jcr.Session
Repository
object.java.lang.String getUserID()
getUserID
in interface javax.jcr.Session
java.lang.Object getAttribute(java.lang.String name)
Object
, or null
if no attribute of the given name exists. See Session.getAttributeNames()
.getAttribute
in interface javax.jcr.Session
name
- the name of an attribute passed in the credentials used to acquire this session.java.lang.String[] getAttributeNames()
Credentials
that were used to acquire it.getAttributeNames
in interface javax.jcr.Session
javax.jcr.Workspace getWorkspace()
Workspace
attached to this Session
.getWorkspace
in interface javax.jcr.Session
Workspace
object.javax.jcr.Session impersonate(javax.jcr.Credentials credentials) throws javax.jcr.LoginException, javax.jcr.RepositoryException
Session
is tied to a new Workspace
instance. In other words, Workspace
instances are not re-used. However, the Workspace
instance returned represents the same actual persistent workspace entity in the repository as is represented by the Workspace
object tied to this Session
. <p/> Throws a LoginException
if the current session does not have sufficient rights.impersonate
in interface javax.jcr.Session
credentials
- A Credentials
objectSession
objectjavax.jcr.LoginException
- if the current session does not have sufficient rights.javax.jcr.RepositoryException
- if another error occurs.javax.jcr.Node getRootNode() throws javax.jcr.RepositoryException
getRootNode
in interface javax.jcr.Session
Node
object.javax.jcr.RepositoryException
- if an error occurs.javax.jcr.Node getNodeByUUID(java.lang.String uuid) throws javax.jcr.ItemNotFoundException, javax.jcr.RepositoryException
getNodeByUUID
in interface javax.jcr.Session
uuid
- A universally unique identifier.Node
.javax.jcr.ItemNotFoundException
- if the specified UUID is not found.javax.jcr.RepositoryException
- if another error occurs.javax.jcr.Item getItem(java.lang.String absPath) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
getItem
in interface javax.jcr.Session
absPath
- An absolute path.Item
.javax.jcr.PathNotFoundException
- if the specified path cannot be found.javax.jcr.RepositoryException
- if another error occurs.boolean itemExists(java.lang.String absPath) throws javax.jcr.RepositoryException
true
if an item exists at absPath
; otherwise returns false
. Also returns false
if the specified absPath
is malformed.itemExists
in interface javax.jcr.Session
absPath
- an absolute pathtrue
if an item exists at absPath
; otherwise returns false
.javax.jcr.RepositoryException
- if an error occurs.void move(java.lang.String srcAbsPath, java.lang.String destAbsPath) 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
.
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. <p/> A ConstraintViolationException
is thrown either immediately if performing this operation would violate a node type constraint.
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
. <p/> 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. <p/> 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). <p/> 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 immediately. <p/> An ItemExistsException
is thrown either immediately if a property already exists at destAbsPath
or a node already exists there and same-name siblings are not allowed. <p/> A VersionException
is thrown either immediately or on save
if the parent node of destAbsPath
. <p/> A LockException
is thrown either immediately
move
in interface javax.jcr.Session
srcAbsPath
- the root of the subtree to be moved.destAbsPath
- the location to which the subtree is to be moved.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 and this implementation performs this validation immediately instead of waiting until save
.javax.jcr.nodetype.ConstraintViolationException
- if a node-type 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 another error occurs.void save() throws javax.jcr.AccessDeniedException, javax.jcr.ItemExistsException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.InvalidItemStateException, javax.jcr.version.VersionException, javax.jcr.lock.LockException, javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.RepositoryException
Session
. If validation of all pending changes succeeds, then this change information is cleared from the Session
. After the save
, the changes are persisted and thus made visible to other Sessions
.
If validation fails, then this is best-effort or partial save and not atomic.
When an item is saved the item in persistent storage to which pending changes are written is determined as follows:
save
of an item that has a UUID will succeed even if that item has, in the meantime, been moved in persistent storage to a new location (that is, its path has changed). However, a save
of a non-UUID item will fail (throwing an InvalidItemStateException
) if it has, in the meantime, been moved in persistent storage to a new location. A save
of a non-UUID item will also fail if it has, in addition to being moved, been replaced in its original position by a UUID-bearing item.
An AccessDeniedException
will be thrown if any of the changes to be persisted would violate the access privileges of this Session
.
An ItemExistsException
will be thrown if any of the changes to be persisted would be prevented by the presence of an already existing item in the workspace.
A ConstraintViolationException
will be thrown if any of the changes to be persisted would violate a node type restriction.
A LockException
is thrown if any of the changes to be persisted would violate a lock.
An InvalidItemStateException
is thrown if any of the changes to be persisted conflicts with a change already persisted through another session and the implementation is such that this conflict can only be detected at save-time and therefore was not detected earlier, at change-time.
A VersionException
is thrown if the save
would make a result in a change to persistent storage that would violate the read-only status of a checked-in node.
A LockException
is thrown if the save
would result in a change to persistent storage that would violate a lock.
A NoSuchNodeTypeException
is thrown if the save
would result in the addition of a node with an unrecognized node type.
A RepositoryException
will be thrown if another error occurs.
save
in interface javax.jcr.Session
javax.jcr.AccessDeniedException
- if any of the changes to be persisted would violate the access privileges of the this Session
.javax.jcr.ItemExistsException
- if any of the changes to be persisted would be prevented by the presence of an already existing item in the workspace.javax.jcr.lock.LockException
- if any of the changes to be persisted would violate a lock.javax.jcr.nodetype.ConstraintViolationException
- if any of the changes to be persisted would violate a node type or restriction. Additionally, a repository may use this exception to enforce implementation.javax.jcr.InvalidItemStateException
- if any of the changes to be persisted conflicts with a change already persisted through another session and the implementation is such that this conflict can only be detected at save-time and therefore was not detected earlier, at change-time.javax.jcr.version.VersionException
- if the save
would make a result in a change to persistent storage that would violate the read-only status of a checked-in node.javax.jcr.lock.LockException
- if the save
would result in a change to persistent storage that would violate a lock.javax.jcr.nodetype.NoSuchNodeTypeException
- if the save
would result in the addition of a node with an unrecognized node type.javax.jcr.RepositoryException
- if another error occurs.void refresh(boolean keepChanges) throws javax.jcr.RepositoryException
keepChanges
is false
, this method discards all pending changes currently recorded in this Session
and returns all items to reflect the current saved state.
If keepChanges
is true then pending change are not discarded but items that do not have changes pending have their state refreshed to reflect the current saved state, thus revealing changes made by other sessions.
refresh
in interface javax.jcr.Session
javax.jcr.RepositoryException
- if an error occurs.boolean hasPendingChanges() throws javax.jcr.RepositoryException
true
if this session holds pending (that is, unsaved) changes; otherwise returns false
.hasPendingChanges
in interface javax.jcr.Session
javax.jcr.RepositoryException
- if an error occursjavax.jcr.ValueFactory getValueFactory() throws javax.jcr.RepositoryException
ValueFactory
that is used to create Value
objects for use when setting repository properties. <p/>getValueFactory
in interface javax.jcr.Session
ValueFactory
javax.jcr.RepositoryException
- if another error occurs.void checkPermission(java.lang.String absPath, java.lang.String actions) throws java.security.AccessControlException, javax.jcr.RepositoryException
Session
has permission to perform the specified actions at the specified absPath
. This method quietly returns if the access request is permitted, or throws a suitable java.security.AccessControlException
otherwise. <p/> The actions
parameter is a comma separated list of action strings. The following action strings are defined:
add_node
: If checkPermission(path, "add_node")
returns quietly, then this Session
has permission to add a node at path
, otherwise permission is denied.set_property
: If checkPermission(path, "set_property")
returns quietly, then this Session
has permission to set (add or change) a property at path
, otherwise permission is denied.remove
: If checkPermission(path, "remove")
returns quietly, then this Session
has permission to remove an item at path
, otherwise permission is denied.read
: If checkPermission(path, "read")
returns quietly, then this Session
has permission to retrieve (and read the value of, in the case of a property) an item at path
, otherwise permission is denied.actions
parameter, this method will only return quietly if this Session
has permission to perform all of the listed actions at the specified path. <p/> The information returned through this method will only reflect access control policies and not other restrictions that may exist. For example, even though checkPermission
may indicate that a particular Session
may add a property at /A/B/C
, the node type of the node at /A/B
may prevent the addition of a property called C
.checkPermission
in interface javax.jcr.Session
java.security.AccessControlException
- If permission is denied.javax.jcr.RepositoryException
- if another error occurs.org.xml.sax.ContentHandler getImportContentHandler(java.lang.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
parentAbsPath
- the absolute path of a node under which (as child) the imported subtree will be built.uuidBehavior
- a four-value flag that governs how incoming UUIDs are handled.javax.jcr.PathNotFoundException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.RepositoryException
void importXML(java.lang.String parentAbsPath, java.io.InputStream in, int uuidBehavior) throws java.io.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
importXML
in interface javax.jcr.Session
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.java.io.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
void exportSystemView(java.lang.String absPath, org.xml.sax.ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException
exportSystemView
in interface javax.jcr.Session
skipBinary
- A boolean
governing whether binary properties are to be serialized.noRecurse
- A boolean
governing whether the subtree at absPath is to be recursed.javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
void exportSystemView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) throws java.io.IOException, javax.jcr.RepositoryException, javax.jcr.PathNotFoundException
exportSystemView
in interface javax.jcr.Session
absPath
- The path of the root of the subtree to be serialized. This must be the path to a node, not a propertyout
- The OutputStream
to which 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.java.io.IOException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
void exportDocumentView(java.lang.String absPath, org.xml.sax.ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException
exportDocumentView
in interface javax.jcr.Session
absPath
- The path of the root of the subtree to be serialized. This must be the path to a node, not a propertycontentHandler
- 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.javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
void exportDocumentView(java.lang.String absPath, java.io.OutputStream out, boolean skipBinary, boolean noRecurse) throws java.io.IOException, javax.jcr.RepositoryException, javax.jcr.PathNotFoundException
exportDocumentView
in interface javax.jcr.Session
absPath
- The path of the root of the subtree to be serialized. This must be the path to a node, not a propertyout
- The OutputStream
to which 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.java.io.IOException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
void setNamespacePrefix(java.lang.String prefix, java.lang.String uri) throws javax.jcr.NamespaceException, javax.jcr.RepositoryException
A prefix that is currently already mapped to some URI (either persistently in the repository NamespaceRegistry
or transiently within this Session
) cannot be remapped to a new URI using this method, since this would make any content stored using the old URI unreadable. An attempt to do this will throw a NamespaceException
.
As well, a NamespaceException
will be thrown if an attempt is made to remap an existing namespace URI to a prefix beginning with the characters "xml
" (in any combination of case).
A NamespaceException
will also be thrown if the specified uri is not among those registered in the NamespaceRegistry.
setNamespacePrefix
in interface javax.jcr.Session
prefix
- a stringuri
- a stringjavax.jcr.NamespaceException
- if the specified uri is not registered or an attempt is made to remap to an illegal prefix.javax.jcr.RepositoryException
- if another error occurs.java.lang.String[] getNamespacePrefixes() throws javax.jcr.RepositoryException
NamespaceRegistry
but not over-ridden by a Session.setNamespacePrefix
, plus those currently set locally by Session.setNamespacePrefix
.getNamespacePrefixes
in interface javax.jcr.Session
javax.jcr.RepositoryException
- if an error occursjava.lang.String getNamespaceURI(java.lang.String prefix) throws javax.jcr.NamespaceException, javax.jcr.RepositoryException
Session
. If the prefix is unknown, a NamespaceException
is thrown.getNamespaceURI
in interface javax.jcr.Session
prefix
- a stringjavax.jcr.NamespaceException
- if the prefix is unknown.javax.jcr.RepositoryException
- if another error occursjava.lang.String getNamespacePrefix(java.lang.String uri) throws javax.jcr.NamespaceException, javax.jcr.RepositoryException
getNamespacePrefix
in interface javax.jcr.Session
uri
- a stringjavax.jcr.NamespaceException
- if the URI is unknown.javax.jcr.RepositoryException
- if another error occursvoid logout()
Session
. This method should be called when a Session
is no longer needed.logout
in interface javax.jcr.Session
boolean isLive()
true
if this Session
object is usable by the client. Otherwise, returns false
. A usable Session
is one that is neither logged-out, timed-out nor in any other way disconnected from the repository.isLive
in interface javax.jcr.Session
true
if this Session
is usable, false
otherwise.void addLockToken(java.lang.String lt)
Session
object of the lock owner to alter nodes that are locked by the lock specified by that particular lock token.addLockToken
in interface javax.jcr.Session
lt
- a lock token (a string)java.lang.String[] getLockTokens()
getLockTokens
in interface javax.jcr.Session
void removeLockToken(java.lang.String lt)
removeLockToken
in interface javax.jcr.Session
lt
- a lock token (a string)
|
Oracle Beehive Java Content Repository Java API Reference Release 1 (1.4) E13801-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |