org.apache.jackrabbit.rmi.server
Class ServerNode

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.ServerItem
                      extended by org.apache.jackrabbit.rmi.server.ServerNode
All Implemented Interfaces:
Serializable, Remote, RemoteItem, RemoteNode
Direct Known Subclasses:
ServerVersion, ServerVersionHistory

public class ServerNode
extends ServerItem
implements RemoteNode

Remote adapter for the JCR Node interface. This class makes a local node available as an RMI service using the RemoteNode interface.

See Also:
Node, RemoteNode, Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ServerNode(Node node, RemoteAdapterFactory factory)
          Creates a remote adapter for the given local node.
 
Method Summary
 void addMixin(String name)
          Remote version of the Node.addMixin(String) method.
 RemoteNode addNode(String path)
          Remote version of the Node.addNode(Sring) method.
 RemoteNode addNode(String path, String type)
          Remote version of the Node.addNode(String,String) method.
 boolean canAddMixin(String name)
          Remote version of the Node.canAddMixin(String) method.
 void cancelMerge(String versionUUID)
          Remote version of the Node.cancelMerge(Version) method.
 RemoteVersion checkin()
          Remote version of the Node.checkin() method.
 void checkout()
          Remote version of the Node.checkout() method.
 void doneMerge(String versionUUID)
          Remote version of the Node.doneMerge(Version) method.
 RemoteVersion getBaseVersion()
          Remote version of the Node.getBaseVersion() method.
 String getCorrespondingNodePath(String workspace)
          Remote version of the Node.getCorrespondingNodePath(String) method.
 RemoteNodeDefinition getDefinition()
          Remote version of the Node.getDefinition() method.
 String getIdentifier()
          Remote version of the Node.getIdentifier() method.
 int getIndex()
          Remote version of the Node.getIndex() method.
 RemoteLock getLock()
          Remote version of the Node.getLock() method.
 RemoteNodeType[] getMixinNodeTypes()
          Remote version of the Node.getMixinNodeTypes() method.
 RemoteNode getNode(String path)
          Remote version of the Node.getNode(String) method.
 RemoteIterator getNodes()
          Remote version of the Node.getNodes() method.
 RemoteIterator getNodes(String pattern)
          Remote version of the Node.getNodes(String) method.
 RemoteIterator getNodes(String[] globs)
          Remote version of the Node.getNodes(String[]) method.
 RemoteItem getPrimaryItem()
          Remote version of the Node.getPrimaryItem() method.
 RemoteNodeType getPrimaryNodeType()
          Remote version of the Node.getPrimaryNodeType() method.
 RemoteIterator getProperties()
          Remote version of the Node.getProperties() method.
 RemoteIterator getProperties(String pattern)
          Remote version of the Node.getProperties(String) method.
 RemoteIterator getProperties(String[] globs)
          Remote version of the Node.getProperties(String[]) method.
 RemoteProperty getProperty(String path)
          Remote version of the Node.getProperty(String) method.
 RemoteIterator getReferences()
          Remote version of the Node.getReferences() method.
 RemoteIterator getReferences(String name)
          Remote version of the Node.getReferences(String) method.
 String getUUID()
          Remote version of the Node.getUUID() method.
protected  Version getVersionByUUID(String versionUUID)
          Returns the Version instance for the given UUID.
 RemoteVersionHistory getVersionHistory()
          Remote version of the Node.getVersionHistory() method.
 boolean hasNode(String path)
          Remote version of the Node.hasNode(String) method.
 boolean hasNodes()
          Remote version of the Node.hasNodes() method.
 boolean hasProperties()
          Remote version of the Node.hasProperties() method.
 boolean hasProperty(String path)
          Remote version of the Node.hasProperty() method.
 boolean holdsLock()
          Remote version of the Node.holdsLock() method.
 boolean isCheckedOut()
          Remote version of the Node.isCheckedOut() method.
 boolean isLocked()
          Remote version of the Node.isLocked() method.
 boolean isNodeType(String type)
          Remote version of the Node.isNodeType(String) method.
 RemoteLock lock(boolean isDeep, boolean isSessionScoped)
          Remote version of the Node.lock(boolean,boolean) method.
 RemoteIterator merge(String workspace, boolean bestEffort)
          Remote version of the Node.merge(String,boolean) method.
 void orderBefore(String src, String dst)
          Remote version of the Node.orderBefore(String,String) method.
 void removeMixin(String name)
          Remote version of the Node.removeMixin(String) method.
 void restore(String version, boolean removeExisting)
          Remote version of the Node.restore(String,boolean) method.
 void restore(String versionUUID, String path, boolean removeExisting)
          Remote version of the Node.restore(Version,String,boolean) method.
 void restoreByLabel(String label, boolean removeExisting)
          Remote version of the Node.restoreByLabel(String,boolean) method.
 void restoreByUUID(String versionUUID, boolean removeExisting)
          Remote version of the Node.restore(Version,boolean) method.
 RemoteProperty setProperty(String name, Value value)
          Remote version of the Node.setProperty(String,Value) method.
 RemoteProperty setProperty(String name, Value[] values)
          Remote version of the Node.setProperty(String,Value[]) method.
 RemoteProperty setProperty(String name, Value[] values, int type)
          Remote version of the Node.setProperty(String,Value[],int) method.
 RemoteProperty setProperty(String name, Value value, int type)
          Remote version of the Node.setProperty(String,Value) method.
 void unlock()
          Remote version of the Node.unlock() method.
 void update(String workspace)
          Remote version of the Node.update(String) method.
 
Methods inherited from class org.apache.jackrabbit.rmi.server.ServerItem
getAncestor, getDepth, getName, getParent, getPath, isModified, isNew, refresh, remove, save
 
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
 
Methods inherited from interface org.apache.jackrabbit.rmi.remote.RemoteItem
getAncestor, getDepth, getName, getParent, getPath, isModified, isNew, refresh, remove, save
 

Constructor Detail

ServerNode

public ServerNode(Node node,
                  RemoteAdapterFactory factory)
           throws RemoteException
Creates a remote adapter for the given local node.

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

addNode

public RemoteNode addNode(String path)
                   throws RepositoryException,
                          RemoteException
Remote version of the Node.addNode(Sring) method.

Specified by:
addNode in interface RemoteNode
Parameters:
path - relative path
Returns:
new node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

addNode

public RemoteNode addNode(String path,
                          String type)
                   throws RepositoryException,
                          RemoteException
Remote version of the Node.addNode(String,String) method.

Specified by:
addNode in interface RemoteNode
Parameters:
path - relative path
type - node type name
Returns:
new node
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getProperty

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

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

getProperties

public RemoteIterator getProperties()
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getProperties() method.

Specified by:
getProperties in interface RemoteNode
Returns:
node properties
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getPrimaryItem

public RemoteItem getPrimaryItem()
                          throws RepositoryException,
                                 RemoteException
Remote version of the Node.getPrimaryItem() method.

Specified by:
getPrimaryItem in interface RemoteNode
Returns:
primary item
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getProperties

public RemoteIterator getProperties(String pattern)
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getProperties(String) method.

Specified by:
getProperties in interface RemoteNode
Parameters:
pattern - property name pattern
Returns:
matching node properties
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getProperties

public RemoteIterator getProperties(String[] globs)
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getProperties(String[]) method.

Specified by:
getProperties in interface RemoteNode
Parameters:
globs - property name globs
Returns:
matching node properties
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getReferences

public RemoteIterator getReferences()
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getReferences() method.

Specified by:
getReferences in interface RemoteNode
Returns:
reference properties
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getReferences

public RemoteIterator getReferences(String name)
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getReferences(String) method.

Specified by:
getReferences in interface RemoteNode
Parameters:
name - reference property name
Returns:
reference properties
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getIdentifier

public String getIdentifier()
                     throws RepositoryException,
                            RemoteException
Remote version of the Node.getIdentifier() method.

Specified by:
getIdentifier in interface RemoteNode
Returns:
node identifier
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getUUID

public String getUUID()
               throws RepositoryException,
                      RemoteException
Remote version of the Node.getUUID() method.

Specified by:
getUUID in interface RemoteNode
Returns:
node uuid
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

hasNodes

public boolean hasNodes()
                 throws RepositoryException,
                        RemoteException
Remote version of the Node.hasNodes() method.

Specified by:
hasNodes in interface RemoteNode
Returns:
true if this node has child nodes, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

hasProperties

public boolean hasProperties()
                      throws RepositoryException,
                             RemoteException
Remote version of the Node.hasProperties() method.

Specified by:
hasProperties in interface RemoteNode
Returns:
true if this node has properties, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

hasProperty

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

Specified by:
hasProperty in interface RemoteNode
Parameters:
path - relative path
Returns:
true if the identified property exists, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getMixinNodeTypes

public RemoteNodeType[] getMixinNodeTypes()
                                   throws RepositoryException,
                                          RemoteException
Remote version of the Node.getMixinNodeTypes() method.

Specified by:
getMixinNodeTypes in interface RemoteNode
Returns:
mixin node types
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getPrimaryNodeType

public RemoteNodeType getPrimaryNodeType()
                                  throws RepositoryException,
                                         RemoteException
Remote version of the Node.getPrimaryNodeType() method.

Specified by:
getPrimaryNodeType in interface RemoteNode
Returns:
primary node type
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

isNodeType

public boolean isNodeType(String type)
                   throws RepositoryException,
                          RemoteException
Remote version of the Node.isNodeType(String) method.

Specified by:
isNodeType in interface RemoteNode
Parameters:
type - node type name
Returns:
true if this node is an instance of the identified type, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNodes

public RemoteIterator getNodes()
                        throws RepositoryException,
                               RemoteException
Remote version of the Node.getNodes() method.

Specified by:
getNodes in interface RemoteNode
Returns:
child nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNodes

public RemoteIterator getNodes(String pattern)
                        throws RepositoryException,
                               RemoteException
Remote version of the Node.getNodes(String) method.

Specified by:
getNodes in interface RemoteNode
Parameters:
pattern - node name pattern
Returns:
matching child nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNodes

public RemoteIterator getNodes(String[] globs)
                        throws RepositoryException,
                               RemoteException
Remote version of the Node.getNodes(String[]) method.

Specified by:
getNodes in interface RemoteNode
Parameters:
globs - node name globs
Returns:
matching child nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getNode

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

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

hasNode

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

Specified by:
hasNode in interface RemoteNode
Parameters:
path - relative path
Returns:
true if the identified node exists, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

setProperty

public RemoteProperty setProperty(String name,
                                  Value value)
                           throws RepositoryException,
                                  RemoteException
Remote version of the Node.setProperty(String,Value) method.

Specified by:
setProperty in interface RemoteNode
Parameters:
name - property name
value - property value
Returns:
property
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

setProperty

public RemoteProperty setProperty(String name,
                                  Value value,
                                  int type)
                           throws RepositoryException,
                                  RemoteException
Remote version of the Node.setProperty(String,Value) method.

Specified by:
setProperty in interface RemoteNode
Parameters:
name - property name
value - property value
type - property type
Returns:
property
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

addMixin

public void addMixin(String name)
              throws RepositoryException,
                     RemoteException
Remote version of the Node.addMixin(String) method.

Specified by:
addMixin in interface RemoteNode
Parameters:
name - mixin type name
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

canAddMixin

public boolean canAddMixin(String name)
                    throws RepositoryException,
                           RemoteException
Remote version of the Node.canAddMixin(String) method.

Specified by:
canAddMixin in interface RemoteNode
Parameters:
name - mixin type name
Returns:
true if the mixin type can be added, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

removeMixin

public void removeMixin(String name)
                 throws RepositoryException,
                        RemoteException
Remote version of the Node.removeMixin(String) method.

Specified by:
removeMixin in interface RemoteNode
Parameters:
name - mixin type name
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

orderBefore

public void orderBefore(String src,
                        String dst)
                 throws RepositoryException,
                        RemoteException
Remote version of the Node.orderBefore(String,String) method.

Specified by:
orderBefore in interface RemoteNode
Parameters:
src - source path
dst - destination path
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

setProperty

public RemoteProperty setProperty(String name,
                                  Value[] values)
                           throws RepositoryException,
                                  RemoteException
Remote version of the Node.setProperty(String,Value[]) method.

Specified by:
setProperty in interface RemoteNode
Parameters:
name - property name
values - property values
Returns:
property
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getDefinition

public RemoteNodeDefinition getDefinition()
                                   throws RepositoryException,
                                          RemoteException
Remote version of the Node.getDefinition() method.

Specified by:
getDefinition in interface RemoteNode
Returns:
node definition
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

checkin

public RemoteVersion checkin()
                      throws RepositoryException,
                             RemoteException
Remote version of the Node.checkin() method.

Specified by:
checkin in interface RemoteNode
Returns:
checked in version
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

checkout

public void checkout()
              throws RepositoryException,
                     RemoteException
Remote version of the Node.checkout() method.

Specified by:
checkout in interface RemoteNode
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getCorrespondingNodePath

public String getCorrespondingNodePath(String workspace)
                                throws RepositoryException,
                                       RemoteException
Remote version of the Node.getCorrespondingNodePath(String) method.

Specified by:
getCorrespondingNodePath in interface RemoteNode
Parameters:
workspace - workspace name
Returns:
corresponding node path
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getIndex

public int getIndex()
             throws RepositoryException,
                    RemoteException
Remote version of the Node.getIndex() method.

Specified by:
getIndex in interface RemoteNode
Returns:
node index
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

merge

public RemoteIterator merge(String workspace,
                            boolean bestEffort)
                     throws RepositoryException,
                            RemoteException
Remote version of the Node.merge(String,boolean) method.

Specified by:
merge in interface RemoteNode
Parameters:
workspace - source workspace name
bestEffort - best effort flag
Returns:
nodes that failed to merge
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

cancelMerge

public void cancelMerge(String versionUUID)
                 throws RepositoryException,
                        RemoteException
Remote version of the Node.cancelMerge(Version) method.

Specified by:
cancelMerge in interface RemoteNode
Parameters:
versionUUID - The UUID of the version whose labels are to be returned.
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

doneMerge

public void doneMerge(String versionUUID)
               throws RepositoryException,
                      RemoteException
Remote version of the Node.doneMerge(Version) method.

Specified by:
doneMerge in interface RemoteNode
Parameters:
versionUUID - The UUID of the version whose labels are to be returned.
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

restore

public void restore(String version,
                    boolean removeExisting)
             throws RepositoryException,
                    RemoteException
Remote version of the Node.restore(String,boolean) method.

Specified by:
restore in interface RemoteNode
Parameters:
version - version name
removeExisting - flag to remove conflicting nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

restoreByUUID

public void restoreByUUID(String versionUUID,
                          boolean removeExisting)
                   throws RepositoryException,
                          RemoteException
Remote version of the Node.restore(Version,boolean) method.

This method has been rename to prevent a naming clash with RemoteNode.restore(String, boolean).

Specified by:
restoreByUUID in interface RemoteNode
Parameters:
versionUUID - The UUID of the version whose labels are to be returned.
removeExisting - flag to remove conflicting nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

restore

public void restore(String versionUUID,
                    String path,
                    boolean removeExisting)
             throws RepositoryException,
                    RemoteException
Remote version of the Node.restore(Version,String,boolean) method.

Specified by:
restore in interface RemoteNode
Parameters:
versionUUID - The UUID of the version whose labels are to be returned.
path - the path to which the version is to be restored
removeExisting - flag to remove conflicting nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

restoreByLabel

public void restoreByLabel(String label,
                           boolean removeExisting)
                    throws RepositoryException,
                           RemoteException
Remote version of the Node.restoreByLabel(String,boolean) method.

Specified by:
restoreByLabel in interface RemoteNode
Parameters:
label - version label
removeExisting - flag to remove conflicting nodes
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

update

public void update(String workspace)
            throws RepositoryException,
                   RemoteException
Remote version of the Node.update(String) method.

Specified by:
update in interface RemoteNode
Parameters:
workspace - source workspace name
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

holdsLock

public boolean holdsLock()
                  throws RepositoryException,
                         RemoteException
Remote version of the Node.holdsLock() method.

Specified by:
holdsLock in interface RemoteNode
Returns:
true if this node holds a lock, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

isCheckedOut

public boolean isCheckedOut()
                     throws RepositoryException,
                            RemoteException
Remote version of the Node.isCheckedOut() method.

Specified by:
isCheckedOut in interface RemoteNode
Returns:
true if this node is checked out, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getVersionHistory

public RemoteVersionHistory getVersionHistory()
                                       throws RepositoryException,
                                              RemoteException
Remote version of the Node.getVersionHistory() method.

Specified by:
getVersionHistory in interface RemoteNode
Returns:
the remote version history.
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getBaseVersion

public RemoteVersion getBaseVersion()
                             throws RepositoryException,
                                    RemoteException
Remote version of the Node.getBaseVersion() method.

Specified by:
getBaseVersion in interface RemoteNode
Returns:
the remote base version
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

isLocked

public boolean isLocked()
                 throws RepositoryException,
                        RemoteException
Remote version of the Node.isLocked() method.

Specified by:
isLocked in interface RemoteNode
Returns:
true if this node is locked, false otherwise
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

setProperty

public RemoteProperty setProperty(String name,
                                  Value[] values,
                                  int type)
                           throws RepositoryException,
                                  RemoteException
Remote version of the Node.setProperty(String,Value[],int) method.

Specified by:
setProperty in interface RemoteNode
Parameters:
name - property name
values - property values
type - property type
Returns:
property
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

unlock

public void unlock()
            throws RepositoryException,
                   RemoteException
Remote version of the Node.unlock() method.

Specified by:
unlock in interface RemoteNode
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getLock

public RemoteLock getLock()
                   throws RepositoryException,
                          RemoteException
Remote version of the Node.getLock() method.

Specified by:
getLock in interface RemoteNode
Returns:
lock
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

lock

public RemoteLock lock(boolean isDeep,
                       boolean isSessionScoped)
                throws RepositoryException,
                       RemoteException
Remote version of the Node.lock(boolean,boolean) method.

Specified by:
lock in interface RemoteNode
Parameters:
isDeep - flag to create a deep lock
isSessionScoped - flag to create a session-scoped lock
Returns:
lock
Throws:
RepositoryException - on repository errors
RemoteException - on RMI errors

getVersionByUUID

protected Version getVersionByUUID(String versionUUID)
                            throws RepositoryException
Returns the Version instance for the given UUID.

Parameters:
versionUUID - The UUID of the version.
Returns:
The version node.
Throws:
RepositoryException - if an error occurrs accessing the version node or if the UUID does not denote a version.


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