org.apache.jackrabbit.rmi.client
Class ClientSession

java.lang.Object
  extended by org.apache.jackrabbit.rmi.client.ClientObject
      extended by org.apache.jackrabbit.rmi.client.ClientSession
All Implemented Interfaces:
javax.jcr.Session
Direct Known Subclasses:
ClientXASession

public class ClientSession
extends ClientObject
implements javax.jcr.Session

Local adapter for the JCR-RMI RemoteSession interface. This class makes a remote session locally available using the JCR Session interface.

See Also:
Session, RemoteSession

Field Summary
protected  RemoteSession remote
          The adapted remote session.
 
Fields inherited from interface javax.jcr.Session
ACTION_ADD_NODE, ACTION_READ, ACTION_REMOVE, ACTION_SET_PROPERTY
 
Constructor Summary
ClientSession(javax.jcr.Repository repository, RemoteSession remote, LocalAdapterFactory factory)
          Creates a client adapter for the given remote session.
 
Method Summary
 void addLockToken(java.lang.String name)
          
 void checkPermission(java.lang.String path, java.lang.String actions)
          
 void exportDocumentView(java.lang.String path, org.xml.sax.ContentHandler handler, boolean binaryAsLink, boolean noRecurse)
          Exports the XML document view of the specified repository location to the given XML content handler.
 void exportDocumentView(java.lang.String path, java.io.OutputStream output, boolean binaryAsLink, boolean noRecurse)
          Exports the XML document view of the specified repository location to the given output stream.
 void exportSystemView(java.lang.String path, org.xml.sax.ContentHandler handler, boolean binaryAsLink, boolean noRecurse)
          Exports the XML system view of the specified repository location to the given XML content handler.
 void exportSystemView(java.lang.String path, java.io.OutputStream output, boolean binaryAsLink, boolean noRecurse)
          Exports the XML system view of the specified repository location to the given output stream.
 javax.jcr.security.AccessControlManager getAccessControlManager()
           
 java.lang.Object getAttribute(java.lang.String name)
          
 java.lang.String[] getAttributeNames()
          
 org.xml.sax.ContentHandler getImportContentHandler(java.lang.String path, int mode)
          
 javax.jcr.Item getItem(java.lang.String path)
          
 java.lang.String[] getLockTokens()
          
 java.lang.String getNamespacePrefix(java.lang.String uri)
          
 java.lang.String[] getNamespacePrefixes()
          
 java.lang.String getNamespaceURI(java.lang.String prefix)
          
 javax.jcr.Node getNode(java.lang.String path)
          
 javax.jcr.Node getNodeByIdentifier(java.lang.String id)
          
 javax.jcr.Node getNodeByUUID(java.lang.String uuid)
          
 javax.jcr.Property getProperty(java.lang.String path)
          
 javax.jcr.Repository getRepository()
          Returns the current repository without contacting the remote session.
 javax.jcr.retention.RetentionManager getRetentionManager()
           
 javax.jcr.Node getRootNode()
          
 java.lang.String getUserID()
          
 javax.jcr.ValueFactory getValueFactory()
          Returns the SerialValueFactory.getInstance().
 javax.jcr.Workspace getWorkspace()
          
 boolean hasCapability(java.lang.String methodName, java.lang.Object target, java.lang.Object[] arguments)
           
 boolean hasPendingChanges()
          
 boolean hasPermission(java.lang.String path, java.lang.String actions)
          
 javax.jcr.Session impersonate(javax.jcr.Credentials credentials)
          
 void importXML(java.lang.String path, java.io.InputStream xml, int mode)
          
 boolean isLive()
          
 boolean itemExists(java.lang.String path)
          
 void logout()
          
 void move(java.lang.String from, java.lang.String to)
          
 boolean nodeExists(java.lang.String path)
          
 boolean propertyExists(java.lang.String path)
          
 void refresh(boolean keepChanges)
          
 void removeItem(java.lang.String path)
          
 void removeLockToken(java.lang.String name)
          
 void save()
          
 void setNamespacePrefix(java.lang.String prefix, java.lang.String uri)
          
 
Methods inherited from class org.apache.jackrabbit.rmi.client.ClientObject
getFactory, getItem, getNode, getNodeTypeArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remote

protected final RemoteSession remote
The adapted remote session.

Constructor Detail

ClientSession

public ClientSession(javax.jcr.Repository repository,
                     RemoteSession remote,
                     LocalAdapterFactory factory)
Creates a client adapter for the given remote session.

Parameters:
repository - current repository
remote - remote repository
factory - local adapter factory
Method Detail

getRepository

public javax.jcr.Repository getRepository()
Returns the current repository without contacting the remote session.

Specified by:
getRepository in interface javax.jcr.Session

getUserID

public java.lang.String getUserID()

Specified by:
getUserID in interface javax.jcr.Session

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

Specified by:
getAttribute in interface javax.jcr.Session

getAttributeNames

public java.lang.String[] getAttributeNames()

Specified by:
getAttributeNames in interface javax.jcr.Session

getWorkspace

public javax.jcr.Workspace getWorkspace()

Specified by:
getWorkspace in interface javax.jcr.Session

impersonate

public javax.jcr.Session impersonate(javax.jcr.Credentials credentials)
                              throws javax.jcr.RepositoryException

Specified by:
impersonate in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getRootNode

public javax.jcr.Node getRootNode()
                           throws javax.jcr.RepositoryException

Specified by:
getRootNode in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNodeByIdentifier

public javax.jcr.Node getNodeByIdentifier(java.lang.String id)
                                   throws javax.jcr.RepositoryException

Specified by:
getNodeByIdentifier in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNodeByUUID

public javax.jcr.Node getNodeByUUID(java.lang.String uuid)
                             throws javax.jcr.RepositoryException

Specified by:
getNodeByUUID in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getItem

public javax.jcr.Item getItem(java.lang.String path)
                       throws javax.jcr.RepositoryException

Specified by:
getItem in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNode

public javax.jcr.Node getNode(java.lang.String path)
                       throws javax.jcr.RepositoryException

Specified by:
getNode in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getProperty

public javax.jcr.Property getProperty(java.lang.String path)
                               throws javax.jcr.RepositoryException

Specified by:
getProperty in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

itemExists

public boolean itemExists(java.lang.String path)
                   throws javax.jcr.RepositoryException

Specified by:
itemExists in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

nodeExists

public boolean nodeExists(java.lang.String path)
                   throws javax.jcr.RepositoryException

Specified by:
nodeExists in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

propertyExists

public boolean propertyExists(java.lang.String path)
                       throws javax.jcr.RepositoryException

Specified by:
propertyExists in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

removeItem

public void removeItem(java.lang.String path)
                throws javax.jcr.RepositoryException

Specified by:
removeItem in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

move

public void move(java.lang.String from,
                 java.lang.String to)
          throws javax.jcr.RepositoryException

Specified by:
move in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

save

public void save()
          throws javax.jcr.RepositoryException

Specified by:
save in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

refresh

public void refresh(boolean keepChanges)
             throws javax.jcr.RepositoryException

Specified by:
refresh in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

hasPendingChanges

public boolean hasPendingChanges()
                          throws javax.jcr.RepositoryException

Specified by:
hasPendingChanges in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getValueFactory

public javax.jcr.ValueFactory getValueFactory()
Returns the SerialValueFactory.getInstance().

Specified by:
getValueFactory in interface javax.jcr.Session

checkPermission

public void checkPermission(java.lang.String path,
                            java.lang.String actions)
                     throws java.security.AccessControlException,
                            javax.jcr.RepositoryException

Specified by:
checkPermission in interface javax.jcr.Session
Throws:
java.security.AccessControlException
javax.jcr.RepositoryException

hasPermission

public boolean hasPermission(java.lang.String path,
                             java.lang.String actions)
                      throws javax.jcr.RepositoryException

Specified by:
hasPermission in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

importXML

public void importXML(java.lang.String path,
                      java.io.InputStream xml,
                      int mode)
               throws java.io.IOException,
                      javax.jcr.RepositoryException

Specified by:
importXML in interface javax.jcr.Session
Throws:
java.io.IOException
javax.jcr.RepositoryException

getImportContentHandler

public org.xml.sax.ContentHandler getImportContentHandler(java.lang.String path,
                                                          int mode)
                                                   throws javax.jcr.RepositoryException

Specified by:
getImportContentHandler in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

setNamespacePrefix

public void setNamespacePrefix(java.lang.String prefix,
                               java.lang.String uri)
                        throws javax.jcr.RepositoryException

Specified by:
setNamespacePrefix in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNamespacePrefixes

public java.lang.String[] getNamespacePrefixes()
                                        throws javax.jcr.RepositoryException

Specified by:
getNamespacePrefixes in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
                                 throws javax.jcr.RepositoryException

Specified by:
getNamespaceURI in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

getNamespacePrefix

public java.lang.String getNamespacePrefix(java.lang.String uri)
                                    throws javax.jcr.RepositoryException

Specified by:
getNamespacePrefix in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

logout

public void logout()

Specified by:
logout in interface javax.jcr.Session

addLockToken

public void addLockToken(java.lang.String name)

Specified by:
addLockToken in interface javax.jcr.Session

getLockTokens

public java.lang.String[] getLockTokens()

Specified by:
getLockTokens in interface javax.jcr.Session

removeLockToken

public void removeLockToken(java.lang.String name)

Specified by:
removeLockToken in interface javax.jcr.Session

exportSystemView

public void exportSystemView(java.lang.String path,
                             org.xml.sax.ContentHandler handler,
                             boolean binaryAsLink,
                             boolean noRecurse)
                      throws org.xml.sax.SAXException,
                             javax.jcr.RepositoryException
Exports the XML system view of the specified repository location to the given XML content handler. This method first requests the raw XML data from the remote session, and then uses an identity transformation to feed the data to the given XML content handler. Possible IO and transformer exceptions are thrown as SAXExceptions.

Specified by:
exportSystemView in interface javax.jcr.Session
Throws:
org.xml.sax.SAXException
javax.jcr.RepositoryException

exportSystemView

public void exportSystemView(java.lang.String path,
                             java.io.OutputStream output,
                             boolean binaryAsLink,
                             boolean noRecurse)
                      throws java.io.IOException,
                             javax.jcr.RepositoryException
Exports the XML system view of the specified repository location to the given output stream. This method first requests the raw XML data from the remote session, and then writes the data to the output stream.

Specified by:
exportSystemView in interface javax.jcr.Session
Throws:
java.io.IOException
javax.jcr.RepositoryException

exportDocumentView

public void exportDocumentView(java.lang.String path,
                               org.xml.sax.ContentHandler handler,
                               boolean binaryAsLink,
                               boolean noRecurse)
                        throws org.xml.sax.SAXException,
                               javax.jcr.RepositoryException
Exports the XML document view of the specified repository location to the given XML content handler. This method first requests the raw XML data from the remote session, and then uses an identity transformation to feed the data to the given XML content handler. Possible IO and transformer exceptions are thrown as SAXExceptions.

Specified by:
exportDocumentView in interface javax.jcr.Session
Throws:
org.xml.sax.SAXException
javax.jcr.RepositoryException

exportDocumentView

public void exportDocumentView(java.lang.String path,
                               java.io.OutputStream output,
                               boolean binaryAsLink,
                               boolean noRecurse)
                        throws java.io.IOException,
                               javax.jcr.RepositoryException
Exports the XML document view of the specified repository location to the given output stream. This method first requests the raw XML data from the remote session, and then writes the data to the output stream.

Specified by:
exportDocumentView in interface javax.jcr.Session
Throws:
java.io.IOException
javax.jcr.RepositoryException

isLive

public boolean isLive()

Specified by:
isLive in interface javax.jcr.Session

getAccessControlManager

public javax.jcr.security.AccessControlManager getAccessControlManager()
                                                                throws javax.jcr.UnsupportedRepositoryOperationException,
                                                                       javax.jcr.RepositoryException
Specified by:
getAccessControlManager in interface javax.jcr.Session
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException

getRetentionManager

public javax.jcr.retention.RetentionManager getRetentionManager()
                                                         throws javax.jcr.RepositoryException
Specified by:
getRetentionManager in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException

hasCapability

public boolean hasCapability(java.lang.String methodName,
                             java.lang.Object target,
                             java.lang.Object[] arguments)
                      throws javax.jcr.RepositoryException
Specified by:
hasCapability in interface javax.jcr.Session
Throws:
javax.jcr.RepositoryException


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.