See: Description
Interface | Description |
---|---|
RemoteAdapterFactory |
Factory interface for creating remote adapters for local resources.
|
Class | Description |
---|---|
ServerAdapterFactory |
Default implementation of the
RemoteAdapterFactory interface. |
ServerEventCollection |
The
ServerEventCollection class implements the
RemoteEventCollection event to
actually sent the server-side event to the client. |
ServerEventCollection.ServerEvent |
Server side implementation of the
RemoteEvent interface. |
ServerItem |
Remote adapter for the JCR
Item interface. |
ServerItemDefinition |
Remote adapter for the JCR
ItemDefinition
interface. |
ServerLock |
Remote adapter for the JCR
Lock interface. |
ServerLockManager | |
ServerNamespaceRegistry |
Remote adapter for the JCR
NamespaceRegistry interface. |
ServerNode |
Remote adapter for the JCR
Node interface. |
ServerNodeDefinition |
Remote adapter for the JCR
NodeDefinition
interface. |
ServerNodeType |
Remote adapter for the JCR
NodeType
interface. |
ServerNodeTypeManager |
Remote adapter for the JCR
NodeTypeManager
interface. |
ServerObject |
Base class for remote adapters.
|
ServerObservationManager |
Remote adapter for the JCR
ObservationManager interface. |
ServerProperty |
Remote adapter for the JCR
Property
interface. |
ServerPropertyDefinition |
Remote adapter for the JCR
PropertyDefinition interface. |
ServerQuery |
Remote adapter for the JCR
Query interface. |
ServerQueryManager |
Remote adapter for the JCR
QueryManager
interface. |
ServerQueryResult |
Remote adapter for the JCR
QueryResult interface. |
ServerRepository |
Remote adapter for the JCR
Repository
interface. |
ServerRow |
Remote adapter for the JCR
Row interface. |
ServerSession |
Remote adapter for the JCR
Session interface. |
ServerVersion |
Remote adapter for the JCR
Version interface. |
ServerVersionHistory |
Remote adapter for the JCR
VersionHistory
interface. |
ServerVersionManager | |
ServerWorkspace |
Remote adapter for the JCR
Workspace interface. |
ServerXASession |
Remote adapter for XA-enabled sessions.
|
This package contains the default server implementation of the transparent JCR-RMI layer. The classes in this package can be used to make a local JCR repository available as an RMI service. In addition, this package offers a straightforward mechanism for extending or modifying the behaviour of the server layer.
The contents of this package is designed using two design patterns, Factory and Adapter. All the remotely accessible ServerObject subclasses implement the Adapter pattern to adapt a local JCR interface to the corresponding remote JCR-RMI interface. The Factory pattern is used to centralize the creation and configuration of all adapter instances.
Setting up the server part of the JCR-RMI layer is quite straightforward. After instantiating a local JCR repository you need to wrap it into a remote adapter and create an RMI binding for the repository. A variation of the following code is usually all that is needed in addition to the standard RMI setup (starting rmiregistry, etc.):
Repository repository = ...; // The local repository String name = ...; // The RMI URL for the repository RemoteAdapterFactory factory = new ServerAdapterFactory(); RemoteRepository remote = factory.getRemoteRepository(repository); Naming.bind(name, remote); // Make the RMI binding using java.rmi.Naming
The Factory pattern used by this package makes it easy to extend the behaviour of the JCR-RMI server. Such changes in behaviour or policy can be implemented by modifying or replacing the default ServerAdapterFactory used in the example above.
The following example code adds transparent logging of all session logins and logouts:
Repository repository = ...; // The local repository String name = ...; // The RMI URL for the repository RemoteAdapterFactory factory = new ServerAdapterFactory() { public RemoteSession getRemoteSession(Session session) throws RemoteException { System.out.println("LOGIN: " + session.getUserId()); return new ServerSession(session, this) { public void logout() { System.out.println("LOGOUT: " + session.getUserId()); super.logout(); } }; } }; RemoteRepository remote = factory.getRemoteRepository(repository); Naming.bind(name, remote); // Make the RMI binding using java.rmi.Naming
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.