Package org.apache.jackrabbit.rmi.server
Class ServerObject
- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteServer
-
- java.rmi.server.UnicastRemoteObject
-
- org.apache.jackrabbit.rmi.server.ServerObject
-
- All Implemented Interfaces:
Serializable
,Remote
- Direct Known Subclasses:
ServerAccessControlEntry
,ServerAccessControlManager
,ServerAccessControlPolicy
,ServerEventCollection
,ServerEventCollection.ServerEvent
,ServerItem
,ServerItemDefinition
,ServerIterator
,ServerLock
,ServerLockManager
,ServerNamespaceRegistry
,ServerNodeType
,ServerNodeTypeManager
,ServerObservationManager
,ServerPrincipal
,ServerPrivilege
,ServerQuery
,ServerQueryManager
,ServerQueryResult
,ServerRepository
,ServerRow
,ServerSession
,ServerVersionManager
,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
Constructors Modifier Constructor Description protected
ServerObject(RemoteAdapterFactory factory)
Creates a basic server adapter that uses the given factory to create new adapters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected Value
getSerialValue(Value value)
Utility method for decorating a value.protected Value[]
getSerialValues(Value[] values)
Utility method for preparing an array of values for serialization.-
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
-
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
-
-
-
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 thegetRemoteNode(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
-
getSerialValues
protected Value[] getSerialValues(Value[] values) throws RepositoryException
Utility method for preparing an array of values for serialization. The returned array will contain serializable versions of all the given values.If the given array is
null
, then an empty array is returned.- Parameters:
values
- the values to be decorated- Returns:
- array of decorated values
- Throws:
RepositoryException
- if the values can not be serialized
-
getSerialValue
protected Value getSerialValue(Value value) throws RepositoryException
Utility method for decorating a value. Note that the contents of the original values will only be copied when the decorators are serialized. Null referenced and already serializable values are passed as-is.- Parameters:
value
- the value to be decorated, ornull
- Returns:
- the decorated value, or
null
- Throws:
RepositoryException
- if the value can not be serialized
-
-