org.apache.jackrabbit.rmi.server
Class ServerObject

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
All Implemented Interfaces:
Serializable, Remote
Direct Known Subclasses:
ServerEventCollection, ServerEventCollection.ServerEvent, ServerItem, ServerItemDefinition, ServerIterator, ServerNamespaceRegistry, ServerNodeType, ServerNodeTypeManager, ServerObservationManager, ServerQuery, ServerQueryManager, ServerQueryResult, ServerRepository, ServerRow, ServerSession, ServerWorkspace

public class ServerObject
extends UnicastRemoteObject

Base class for remote adapters. The purpose of this class is to centralize the handling of the RemoteAdapterFactory instance used to instantiate new server adapters.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected ServerObject(RemoteAdapterFactory factory)
          Creates a basic server adapter that uses the given factory to create new adapters.
 
Method Summary
protected  RemoteAdapterFactory getFactory()
          Returns the remote adapter factory used to create new adapters.
protected  RemoteItem getRemoteItem(Item item)
          Utility method for creating a remote reference for a local item.
protected  RemoteNode getRemoteNode(Node node)
          Utility method for creating a remote reference for a local node.
protected  RemoteNodeType[] getRemoteNodeTypeArray(NodeType[] types)
          Utility method for creating an array of remote references for local node types.
protected  RepositoryException getRepositoryException(RepositoryException ex)
          Returns a cleaned version of the given exception.
 
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

ServerObject

protected ServerObject(RemoteAdapterFactory factory)
                throws RemoteException
Creates a basic server adapter that uses the given factory to create new adapters.

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

getFactory

protected RemoteAdapterFactory getFactory()
Returns the remote adapter factory used to create new adapters.

Returns:
remote adapter factory

getRepositoryException

protected RepositoryException getRepositoryException(RepositoryException ex)
Returns a cleaned version of the given exception. In some cases the underlying repository implementation may throw exceptions that are either unserializable, use exception subclasses that are only locally available, contain references to unserializable or only locally available classes. This method returns a cleaned version of such an exception. The returned exception contains only the message string from the original exception, and uses the public JCR exception class that most specifically matches the original exception.

Parameters:
ex - the original exception
Returns:
clean exception

getRemoteItem

protected RemoteItem getRemoteItem(Item item)
                            throws RemoteException
Utility method for creating a remote reference for a local item. Unlike the factory method for creating remote item references, this method introspects the type of the local item and returns the corresponding node, property, or item remote reference using the remote adapter factory.

If the item, this method calls the getRemoteNode(Node) to return the correct remote type.

Parameters:
item - local node, property, or item
Returns:
remote node, property, or item reference
Throws:
RemoteException - on RMI errors

getRemoteNode

protected RemoteNode getRemoteNode(Node node)
                            throws RemoteException
Utility method for creating a remote reference for a local node. Unlike the factory method for creating remote node references, this method introspects the type of the local node and returns the corresponding node, version, or version history remote reference using the remote adapter factory.

Parameters:
node - local version, versionhistory, or normal node
Returns:
remote node, property, or item reference
Throws:
RemoteException - on RMI errors

getRemoteNodeTypeArray

protected RemoteNodeType[] getRemoteNodeTypeArray(NodeType[] types)
                                           throws RemoteException
Utility method for creating an array of remote references for local node types. The remote references are created using the remote adapter factory.

A null input is treated as an empty array.

Parameters:
types - local node type array
Returns:
remote node type array
Throws:
RemoteException - on RMI errors


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