org.apache.jackrabbit.commons
Class AbstractSession

java.lang.Object
  extended by org.apache.jackrabbit.commons.AbstractSession
All Implemented Interfaces:
Session
Direct Known Subclasses:
SessionImpl

public abstract class AbstractSession
extends Object
implements Session

Abstract base class for implementing the JCR Session interface.


Constructor Summary
AbstractSession()
           
 
Method Summary
 void exportDocumentView(String absPath, 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(String absPath, 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(String absPath)
          Returns the node or property at the given path.
 Session impersonate(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 itemExists(String absPath)
          Calls getItem(String) with the given path and returns true if the call succeeds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jcr.Session
addLockToken, checkPermission, exportDocumentView, exportSystemView, getAttribute, getAttributeNames, getImportContentHandler, getLockTokens, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getNodeByUUID, getRepository, getRootNode, getUserID, getValueFactory, getWorkspace, hasPendingChanges, isLive, logout, move, refresh, removeLockToken, save, setNamespacePrefix
 

Constructor Detail

AbstractSession

public AbstractSession()
Method Detail

exportDocumentView

public void exportDocumentView(String absPath,
                               OutputStream out,
                               boolean skipBinary,
                               boolean noRecurse)
                        throws IOException,
                               RepositoryException
Calls Session.exportDocumentView(String, ContentHandler, boolean, boolean) with the given arguments and a ContentHandler that serializes SAX events to the given output stream.

Specified by:
exportDocumentView in interface Session
Parameters:
absPath - passed through
out - output stream to which the SAX events are serialized
skipBinary - passed through
noRecurse - passed through
Throws:
IOException - if the SAX serialization failed
RepositoryException - if another error occurs

exportSystemView

public void exportSystemView(String absPath,
                             OutputStream out,
                             boolean skipBinary,
                             boolean noRecurse)
                      throws IOException,
                             RepositoryException
Calls Session.exportSystemView(String, ContentHandler, boolean, boolean) with the given arguments and a ContentHandler that serializes SAX events to the given output stream.

Specified by:
exportSystemView in interface Session
Parameters:
absPath - passed through
out - output stream to which the SAX events are serialized
skipBinary - passed through
noRecurse - passed through
Throws:
IOException - if the SAX serialization failed
RepositoryException - if another error occurs

importXML

public void importXML(String parentAbsPath,
                      InputStream in,
                      int uuidBehavior)
               throws IOException,
                      RepositoryException
Parses the given input stream as an XML document and processes the SAX events using the ContentHandler returned by Session.getImportContentHandler(String, int).

Specified by:
importXML in interface Session
Parameters:
parentAbsPath - passed through
in - input stream to be parsed as XML and imported
uuidBehavior - passed through
Throws:
IOException - if an I/O error occurs
RepositoryException - if another error occurs

getItem

public Item getItem(String absPath)
             throws PathNotFoundException,
                    RepositoryException
Returns the node or property at the given path.

The default implementation:

Specified by:
getItem in interface Session
Parameters:
absPath - absolute path
Returns:
the node or property with the given path
Throws:
PathNotFoundException - if the given path is invalid or not found
RepositoryException - if another error occurs

itemExists

public boolean itemExists(String absPath)
                   throws RepositoryException
Calls 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.

Specified by:
itemExists in interface Session
Parameters:
absPath - absolute path
Returns:
true if an item exists at the given path, false otherwise
Throws:
RepositoryException - if an error occurs

impersonate

public Session impersonate(Credentials credentials)
                    throws RepositoryException
Logs in the same workspace with the given credentials.

The default implementation:

Specified by:
impersonate in interface Session
Parameters:
credentials - login credentials
Returns:
logged in session
Throws:
RepositoryException - if an error occurs


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.