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:
Session
Direct Known Subclasses:
ClientXASession

public class ClientSession
extends ClientObject
implements 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(Repository repository, RemoteSession remote, LocalAdapterFactory factory)
          Creates a client adapter for the given remote session.
 
Method Summary
 void addLockToken(String name)
          
 void checkPermission(String path, String actions)
          
 void exportDocumentView(String path, ContentHandler handler, boolean binaryAsLink, boolean noRecurse)
          Exports the XML document view of the specified repository location to the given XML content handler.
 void exportDocumentView(String path, OutputStream output, boolean binaryAsLink, boolean noRecurse)
          Exports the XML document view of the specified repository location to the given output stream.
 void exportSystemView(String path, ContentHandler handler, boolean binaryAsLink, boolean noRecurse)
          Exports the XML system view of the specified repository location to the given XML content handler.
 void exportSystemView(String path, OutputStream output, boolean binaryAsLink, boolean noRecurse)
          Exports the XML system view of the specified repository location to the given output stream.
 AccessControlManager getAccessControlManager()
           
 Object getAttribute(String name)
          
 String[] getAttributeNames()
          
 ContentHandler getImportContentHandler(String path, int mode)
          
 Item getItem(String path)
          
 String[] getLockTokens()
          
 String getNamespacePrefix(String uri)
          
 String[] getNamespacePrefixes()
          
 String getNamespaceURI(String prefix)
          
 Node getNode(String path)
          
 Node getNodeByIdentifier(String id)
          
 Node getNodeByUUID(String uuid)
          
 Property getProperty(String path)
          
 Repository getRepository()
          Returns the current repository without contacting the remote session.
 RetentionManager getRetentionManager()
           
 Node getRootNode()
          
 String getUserID()
          
 ValueFactory getValueFactory()
          Returns the SerialValueFactory.getInstance().
 Workspace getWorkspace()
          
 boolean hasCapability(String methodName, Object target, Object[] arguments)
           
 boolean hasPendingChanges()
          
 boolean hasPermission(String path, String actions)
          
 Session impersonate(Credentials credentials)
          
 void importXML(String path, InputStream xml, int mode)
          
 boolean isLive()
          
 boolean itemExists(String path)
          
 void logout()
          
 void move(String from, String to)
          
 boolean nodeExists(String path)
          
 boolean propertyExists(String path)
          
 void refresh(boolean keepChanges)
          
 void removeItem(String path)
          
 void removeLockToken(String name)
          
 void save()
          
 void setNamespacePrefix(String prefix, 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(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 Repository getRepository()
Returns the current repository without contacting the remote session.

Specified by:
getRepository in interface Session

getUserID

public String getUserID()

Specified by:
getUserID in interface Session

getAttribute

public Object getAttribute(String name)

Specified by:
getAttribute in interface Session

getAttributeNames

public String[] getAttributeNames()

Specified by:
getAttributeNames in interface Session

getWorkspace

public Workspace getWorkspace()

Specified by:
getWorkspace in interface Session

impersonate

public Session impersonate(Credentials credentials)
                    throws RepositoryException

Specified by:
impersonate in interface Session
Throws:
RepositoryException

getRootNode

public Node getRootNode()
                 throws RepositoryException

Specified by:
getRootNode in interface Session
Throws:
RepositoryException

getNodeByIdentifier

public Node getNodeByIdentifier(String id)
                         throws RepositoryException

Specified by:
getNodeByIdentifier in interface Session
Throws:
RepositoryException

getNodeByUUID

public Node getNodeByUUID(String uuid)
                   throws RepositoryException

Specified by:
getNodeByUUID in interface Session
Throws:
RepositoryException

getItem

public Item getItem(String path)
             throws RepositoryException

Specified by:
getItem in interface Session
Throws:
RepositoryException

getNode

public Node getNode(String path)
             throws RepositoryException

Specified by:
getNode in interface Session
Throws:
RepositoryException

getProperty

public Property getProperty(String path)
                     throws RepositoryException

Specified by:
getProperty in interface Session
Throws:
RepositoryException

itemExists

public boolean itemExists(String path)
                   throws RepositoryException

Specified by:
itemExists in interface Session
Throws:
RepositoryException

nodeExists

public boolean nodeExists(String path)
                   throws RepositoryException

Specified by:
nodeExists in interface Session
Throws:
RepositoryException

propertyExists

public boolean propertyExists(String path)
                       throws RepositoryException

Specified by:
propertyExists in interface Session
Throws:
RepositoryException

removeItem

public void removeItem(String path)
                throws RepositoryException

Specified by:
removeItem in interface Session
Throws:
RepositoryException

move

public void move(String from,
                 String to)
          throws RepositoryException

Specified by:
move in interface Session
Throws:
RepositoryException

save

public void save()
          throws RepositoryException

Specified by:
save in interface Session
Throws:
RepositoryException

refresh

public void refresh(boolean keepChanges)
             throws RepositoryException

Specified by:
refresh in interface Session
Throws:
RepositoryException

hasPendingChanges

public boolean hasPendingChanges()
                          throws RepositoryException

Specified by:
hasPendingChanges in interface Session
Throws:
RepositoryException

getValueFactory

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

Specified by:
getValueFactory in interface Session

checkPermission

public void checkPermission(String path,
                            String actions)
                     throws AccessControlException,
                            RepositoryException

Specified by:
checkPermission in interface Session
Throws:
AccessControlException
RepositoryException

hasPermission

public boolean hasPermission(String path,
                             String actions)
                      throws RepositoryException

Specified by:
hasPermission in interface Session
Throws:
RepositoryException

importXML

public void importXML(String path,
                      InputStream xml,
                      int mode)
               throws IOException,
                      RepositoryException

Specified by:
importXML in interface Session
Throws:
IOException
RepositoryException

getImportContentHandler

public ContentHandler getImportContentHandler(String path,
                                              int mode)
                                       throws RepositoryException

Specified by:
getImportContentHandler in interface Session
Throws:
RepositoryException

setNamespacePrefix

public void setNamespacePrefix(String prefix,
                               String uri)
                        throws RepositoryException

Specified by:
setNamespacePrefix in interface Session
Throws:
RepositoryException

getNamespacePrefixes

public String[] getNamespacePrefixes()
                              throws RepositoryException

Specified by:
getNamespacePrefixes in interface Session
Throws:
RepositoryException

getNamespaceURI

public String getNamespaceURI(String prefix)
                       throws RepositoryException

Specified by:
getNamespaceURI in interface Session
Throws:
RepositoryException

getNamespacePrefix

public String getNamespacePrefix(String uri)
                          throws RepositoryException

Specified by:
getNamespacePrefix in interface Session
Throws:
RepositoryException

logout

public void logout()

Specified by:
logout in interface Session

addLockToken

public void addLockToken(String name)

Specified by:
addLockToken in interface Session

getLockTokens

public String[] getLockTokens()

Specified by:
getLockTokens in interface Session

removeLockToken

public void removeLockToken(String name)

Specified by:
removeLockToken in interface Session

exportSystemView

public void exportSystemView(String path,
                             ContentHandler handler,
                             boolean binaryAsLink,
                             boolean noRecurse)
                      throws SAXException,
                             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 Session
Throws:
SAXException
RepositoryException

exportSystemView

public void exportSystemView(String path,
                             OutputStream output,
                             boolean binaryAsLink,
                             boolean noRecurse)
                      throws IOException,
                             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 Session
Throws:
IOException
RepositoryException

exportDocumentView

public void exportDocumentView(String path,
                               ContentHandler handler,
                               boolean binaryAsLink,
                               boolean noRecurse)
                        throws SAXException,
                               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 Session
Throws:
SAXException
RepositoryException

exportDocumentView

public void exportDocumentView(String path,
                               OutputStream output,
                               boolean binaryAsLink,
                               boolean noRecurse)
                        throws IOException,
                               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 Session
Throws:
IOException
RepositoryException

isLive

public boolean isLive()

Specified by:
isLive in interface Session

getAccessControlManager

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

getRetentionManager

public RetentionManager getRetentionManager()
                                     throws RepositoryException
Specified by:
getRetentionManager in interface Session
Throws:
RepositoryException

hasCapability

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


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