org.apache.jackrabbit.rmi.server
Class ServerSession

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.apache.jackrabbit.rmi.server.ServerObject
                  extended by org.apache.jackrabbit.rmi.server.ServerSession
All Implemented Interfaces:
Serializable, Remote, RemoteSession
Direct Known Subclasses:
ServerXASession

public class ServerSession
extends ServerObject
implements RemoteSession

Remote adapter for the JCR Session interface. This class makes a local session available as an RMI service using the RemoteSession interface.

See Also:
Session, RemoteSession, Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ServerSession(Session session, RemoteAdapterFactory factory)
          Creates a remote adapter for the given local session.
 
Method Summary
 void addLockToken(String token)
          Remote version of the Session.addLockToken(String) method.
 byte[] exportDocumentView(String path, boolean binaryAsLink, boolean noRecurse)
          Exports the identified repository subtree as a document view XML stream.
 byte[] exportSystemView(String path, boolean binaryAsLink, boolean noRecurse)
          Exports the identified repository subtree as a system view XML stream.
 RemoteAccessControlManager getAccessControlManager()
          Remote version of the Session.getAccessControlManager() method.
 Object getAttribute(String name)
          Returns the named attribute.
 String[] getAttributeNames()
          Remote version of the Session.getAttributeNames() method.
 RemoteItem getItem(String path)
          Remote version of the Session.getItem(String) method.
 String[] getLockTokens()
          Remote version of the Session.getLockTokens() method.
 String getNamespacePrefix(String uri)
          Remote version of the Session.getNamespacePrefix(String) method.
 String[] getNamespacePrefixes()
          Remote version of the Session.getNamespacePrefixes() method.
 String getNamespaceURI(String prefix)
          Remote version of the Session.getNamespaceURI(String) method.
 RemoteNode getNode(String path)
          Remote version of the Session.getNode(String) method.
 RemoteNode getNodeByIdentifier(String id)
          Remote version of the Session.getNodeByIdentifier(String) method.
 RemoteNode getNodeByUUID(String uuid)
          Remote version of the Session.getNodeByUUID(String) method.
 RemoteProperty getProperty(String path)
          Remote version of the Session.getProperty(String) method.
 RemoteNode getRootNode()
          Remote version of the Session.getRootNode() method.
 String getUserID()
          Remote version of the Session.getUserID() method.
 RemoteWorkspace getWorkspace()
          Remote version of the Session.getWorkspace() method.
 boolean hasPendingChanges()
          Remote version of the Session.hasPendingChanges() method.
 boolean hasPermission(String path, String actions)
          Remote version of the Session.hasPermission(String,String) method.
 RemoteSession impersonate(Credentials credentials)
          Remote version of the Session.impersonate(Credentials) method.
 void importXML(String path, byte[] xml, int mode)
          Imports the system or document view XML data into a subtree of the identified node.
 boolean isLive()
          Remote version of the Session.isLive() method.
 boolean itemExists(String path)
          Remote version of the Session.itemExists(String) method.
 void logout()
          Remote version of the Session.logout() method.
 void move(String from, String to)
          Remote version of the Session.move(String,String) method.
 boolean nodeExists(String path)
          Remote version of the Session.nodeExists(String) method.
 boolean propertyExists(String path)
          Remote version of the Session.propertyExists(String) method.
 void refresh(boolean keepChanges)
          Remote version of the Session.refresh(boolean) method.
 void removeItem(String path)
          Remote version of the Session.removeItem(String) method.
 void removeLockToken(String token)
          Remote version of the Session.removeLockToken(String) method.
 void save()
          Remote version of the Session.save() method.
 void setNamespacePrefix(String prefix, String uri)
          Remote version of the Session.setNamespacePrefix(String,String) method.
 
Methods inherited from class org.apache.jackrabbit.rmi.server.ServerObject
getFactory, getRemoteItem, getRemoteNode, getRemoteNodeTypeArray, getRepositoryException, getSerialValue, getSerialValues
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerSession

public ServerSession(Session session,
                     RemoteAdapterFactory factory)
              throws RemoteException
Creates a remote adapter for the given local session.

Parameters:
session - local session
factory - remote adapter factory
Throws:
RemoteException - on RMI errors
Method Detail

getUserID

public String getUserID()
                 throws RemoteException
Remote version of the Session.getUserID() method.

Specified by:
getUserID in interface RemoteSession
Returns:
user id
Throws:
RemoteException - on RMI errors
See Also:
Session.getUserID()

getAttribute

public Object getAttribute(String name)
                    throws RemoteException
Returns the named attribute. Note that only serializable attribute values can be transmitted over the network and that the client should have (or be able to fetch) the object class to access the returned value. Failures to meet these conditions are signalled with RemoteExceptions.

Specified by:
getAttribute in interface RemoteSession
Parameters:
name - attribute name
Returns:
attribute value
Throws:
RemoteException - on RMI errors
See Also:
Session.getAttribute(java.lang.String)

getAttributeNames

public String[] getAttributeNames()
                           throws RemoteException
Remote version of the Session.getAttributeNames() method.

Specified by:
getAttributeNames in interface RemoteSession
Returns:
attribute names
Throws:
RemoteException - on RMI errors

impersonate

public RemoteSession impersonate(Credentials credentials)
                          throws RepositoryException,
                                 RemoteException
Remote version of the Session.impersonate(Credentials) method.

Specified by:
impersonate in interface RemoteSession
Parameters:
credentials - credentials for the new session
Returns:
new session
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getWorkspace

public RemoteWorkspace getWorkspace()
                             throws RemoteException
Remote version of the Session.getWorkspace() method.

Specified by:
getWorkspace in interface RemoteSession
Returns:
workspace
Throws:
RemoteException - on RMI errors
See Also:
Session.getWorkspace()

hasPermission

public boolean hasPermission(String path,
                             String actions)
                      throws RepositoryException,
                             RemoteException
Remote version of the Session.hasPermission(String,String) method.

Specified by:
hasPermission in interface RemoteSession
Parameters:
path - item path
actions - actions
Returns:
true if permission is granted, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNamespacePrefix

public String getNamespacePrefix(String uri)
                          throws RepositoryException,
                                 RemoteException
Remote version of the Session.getNamespacePrefix(String) method.

Specified by:
getNamespacePrefix in interface RemoteSession
Parameters:
uri - namespace uri
Returns:
namespace prefix
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNamespacePrefixes

public String[] getNamespacePrefixes()
                              throws RepositoryException,
                                     RemoteException
Remote version of the Session.getNamespacePrefixes() method.

Specified by:
getNamespacePrefixes in interface RemoteSession
Returns:
namespace prefixes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNamespaceURI

public String getNamespaceURI(String prefix)
                       throws RepositoryException,
                              RemoteException
Remote version of the Session.getNamespaceURI(String) method.

Specified by:
getNamespaceURI in interface RemoteSession
Parameters:
prefix - namespace prefix
Returns:
namespace uri
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

setNamespacePrefix

public void setNamespacePrefix(String prefix,
                               String uri)
                        throws RepositoryException,
                               RemoteException
Remote version of the Session.setNamespacePrefix(String,String) method.

Specified by:
setNamespacePrefix in interface RemoteSession
Parameters:
prefix - namespace prefix
uri - namespace uri
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

itemExists

public boolean itemExists(String path)
                   throws RepositoryException,
                          RemoteException
Remote version of the Session.itemExists(String) method.

Specified by:
itemExists in interface RemoteSession
Parameters:
path - item path
Returns:
true if the item exists, false otherwise
Throws:
RepositoryException - on repository exception
RemoteException - on RMI errors

nodeExists

public boolean nodeExists(String path)
                   throws RepositoryException,
                          RemoteException
Remote version of the Session.nodeExists(String) method.

Specified by:
nodeExists in interface RemoteSession
Parameters:
path - node path
Returns:
true if the node exists, false otherwise
Throws:
RepositoryException - on repository exception
RemoteException - on RMI errors

propertyExists

public boolean propertyExists(String path)
                       throws RepositoryException,
                              RemoteException
Remote version of the Session.propertyExists(String) method.

Specified by:
propertyExists in interface RemoteSession
Parameters:
path - property path
Returns:
true if the property exists, false otherwise
Throws:
RepositoryException - on repository exception
RemoteException - on RMI errors

getNodeByIdentifier

public RemoteNode getNodeByIdentifier(String id)
                               throws RepositoryException,
                                      RemoteException
Remote version of the Session.getNodeByIdentifier(String) method.

Specified by:
getNodeByIdentifier in interface RemoteSession
Parameters:
id - node identifier
Returns:
node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNodeByUUID

public RemoteNode getNodeByUUID(String uuid)
                         throws RepositoryException,
                                RemoteException
Remote version of the Session.getNodeByUUID(String) method.

Specified by:
getNodeByUUID in interface RemoteSession
Parameters:
uuid - node uuid
Returns:
node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getRootNode

public RemoteNode getRootNode()
                       throws RepositoryException,
                              RemoteException
Remote version of the Session.getRootNode() method.

Specified by:
getRootNode in interface RemoteSession
Returns:
root node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getItem

public RemoteItem getItem(String path)
                   throws RepositoryException,
                          RemoteException
Remote version of the Session.getItem(String) method.

Specified by:
getItem in interface RemoteSession
Parameters:
path - item path
Returns:
item
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNode

public RemoteNode getNode(String path)
                   throws RepositoryException,
                          RemoteException
Remote version of the Session.getNode(String) method.

Specified by:
getNode in interface RemoteSession
Parameters:
path - node path
Returns:
node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getProperty

public RemoteProperty getProperty(String path)
                           throws RepositoryException,
                                  RemoteException
Remote version of the Session.getProperty(String) method.

Specified by:
getProperty in interface RemoteSession
Parameters:
path - property path
Returns:
property
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

hasPendingChanges

public boolean hasPendingChanges()
                          throws RepositoryException,
                                 RemoteException
Remote version of the Session.hasPendingChanges() method.

Specified by:
hasPendingChanges in interface RemoteSession
Returns:
true if the session has pending changes, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

removeItem

public void removeItem(String path)
                throws RepositoryException,
                       RemoteException
Remote version of the Session.removeItem(String) method.

Specified by:
removeItem in interface RemoteSession
Parameters:
path - item path
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

move

public void move(String from,
                 String to)
          throws RepositoryException,
                 RemoteException
Remote version of the Session.move(String,String) method.

Specified by:
move in interface RemoteSession
Parameters:
from - source path
to - destination path
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

save

public void save()
          throws RepositoryException,
                 RemoteException
Remote version of the Session.save() method.

Specified by:
save in interface RemoteSession
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

refresh

public void refresh(boolean keepChanges)
             throws RepositoryException,
                    RemoteException
Remote version of the Session.refresh(boolean) method.

Specified by:
refresh in interface RemoteSession
Parameters:
keepChanges - flag to keep transient changes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

logout

public void logout()
            throws RemoteException
Remote version of the Session.logout() method.

Specified by:
logout in interface RemoteSession
Throws:
RemoteException - on RMI errors

isLive

public boolean isLive()
               throws RemoteException
Remote version of the Session.isLive() method.

Specified by:
isLive in interface RemoteSession
Returns:
true if the session is live, false otherwise
Throws:
RemoteException - on RMI errors

importXML

public void importXML(String path,
                      byte[] xml,
                      int mode)
               throws IOException,
                      RepositoryException,
                      RemoteException
Imports the system or document view XML data into a subtree of the identified node. Note that the entire XML stream is transferred as a single byte array over the network. This may cause problems with large XML streams. The remote server will wrap the XML data into a ByteArrayInputStream and feed it to the normal importXML method.

Specified by:
importXML in interface RemoteSession
Parameters:
path - node path
xml - imported XML document
mode - UUID handling mode
Throws:
IOException - on IO errors
RemoteException - on RMI errors
RepositoryException - on repository errors
See Also:
Session.importXML(java.lang.String, java.io.InputStream, int)

addLockToken

public void addLockToken(String token)
                  throws RemoteException
Remote version of the Session.addLockToken(String) method.

Specified by:
addLockToken in interface RemoteSession
Parameters:
token - lock token
Throws:
RemoteException - on RMI errors

getLockTokens

public String[] getLockTokens()
                       throws RemoteException
Remote version of the Session.getLockTokens() method.

Specified by:
getLockTokens in interface RemoteSession
Returns:
lock tokens
Throws:
RemoteException - on RMI errors

removeLockToken

public void removeLockToken(String token)
                     throws RemoteException
Remote version of the Session.removeLockToken(String) method.

Specified by:
removeLockToken in interface RemoteSession
Parameters:
token - lock token
Throws:
RemoteException - on RMI errors

exportDocumentView

public byte[] exportDocumentView(String path,
                                 boolean binaryAsLink,
                                 boolean noRecurse)
                          throws IOException,
                                 RepositoryException,
                                 RemoteException
Exports the identified repository subtree as a document view XML stream. Note that the entire XML stream is transferred as a single byte array over the network. This may cause problems with large exports. The remote server uses a ByteArrayOutputStream to capture the XML data written by the normal exportDocView method.

Specified by:
exportDocumentView in interface RemoteSession
Parameters:
path - node path
binaryAsLink - skip binary flag
noRecurse - no recursion flag
Returns:
exported XML document
Throws:
IOException - on IO errors
RemoteException - on RMI errors
RepositoryException - on repository errors
See Also:
Session.exportDocumentView(java.lang.String, org.xml.sax.ContentHandler, boolean, boolean)

exportSystemView

public byte[] exportSystemView(String path,
                               boolean binaryAsLink,
                               boolean noRecurse)
                        throws IOException,
                               RepositoryException,
                               RemoteException
Exports the identified repository subtree as a system view XML stream. Note that the entire XML stream is transferred as a single byte array over the network. This may cause problems with large exports. The remote server uses a ByteArrayOutputStream to capture the XML data written by the normal exportSysView method.

Specified by:
exportSystemView in interface RemoteSession
Parameters:
path - node path
binaryAsLink - binary skip flag
noRecurse - no recursion flag
Returns:
exported XML document
Throws:
IOException - on IO errors
RemoteException - on RMI errors
RepositoryException - on repository errors
See Also:
Session.exportSystemView(java.lang.String, org.xml.sax.ContentHandler, boolean, boolean)

getAccessControlManager

public RemoteAccessControlManager getAccessControlManager()
                                                   throws UnsupportedRepositoryOperationException,
                                                          RepositoryException,
                                                          RemoteException
Remote version of the Session.getAccessControlManager() method.

Specified by:
getAccessControlManager in interface RemoteSession
Throws:
UnsupportedRepositoryOperationException - if the remote session does not support this method
RepositoryException - if an error occurred getting the access control manager
RemoteException - on RMI errors


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