org.apache.sling.jcr.jackrabbit.server.impl
Class RmiRegistrationSupport

java.lang.Object
  extended by org.apache.sling.jcr.jackrabbit.server.impl.AbstractRegistrationSupport
      extended by org.apache.sling.jcr.jackrabbit.server.impl.RmiRegistrationSupport

public class RmiRegistrationSupport
extends AbstractRegistrationSupport

The RmiRegistrationSupport extends the AbstractRegistrationSupport class to register repositories with an RMI registry whose provider localhost port may be configured.

Note: Currently only registries in this Java VM are supported. In the future support for external registries may be added.


Field Summary
static String PROP_REGISTRY_PORT
           
 
Fields inherited from class org.apache.sling.jcr.jackrabbit.server.impl.AbstractRegistrationSupport
registryLock
 
Constructor Summary
RmiRegistrationSupport()
           
 
Method Summary
protected  Object bindRepository(String name, javax.jcr.Repository repository)
          Called to actually register a repository with the registry.
protected  boolean doActivate()
          Read the registry port from the configuration properties.
protected  void doDeactivate()
          If a private registry has been acquired this method unexports the registry object to free the RMI registry OID for later use.
protected  org.apache.jackrabbit.rmi.server.RemoteAdapterFactory getRemoteAdapterFactory()
          Returns a Jackrabbit JCR RMI RemoteAdapterFactory to be used to publish local (server-side) JCR objects to a remote client.
protected  void unbindRepository(String name, Object data)
          Called to actually unregister a repository with the registry.
 
Methods inherited from class org.apache.sling.jcr.jackrabbit.server.impl.AbstractRegistrationSupport
activate, bindLog, bindRepository, deactivate, getComponentContext, getName, log, unbindLog, unbindRepository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_REGISTRY_PORT

public static final String PROP_REGISTRY_PORT
See Also:
Constant Field Values
Constructor Detail

RmiRegistrationSupport

public RmiRegistrationSupport()
Method Detail

doActivate

protected boolean doActivate()
Read the registry port from the configuration properties. If the value is invalid (higher than 65525), the RMI registry is disabled. Likewise the registry is disabled, if the port property is negative. If the port is zero or not a number, the default port (1099) is assumed.

Specified by:
doActivate in class AbstractRegistrationSupport
Returns:
Whether the activation succeeded or not. If true is returned, activation succeeded and any repositories which have been bound before the component was activated are now actually registered. If false is returned, activation failed and this component is disabled and receives no further repository bind and unbound events (apart for unbind events for repositories which have already been bound).

doDeactivate

protected void doDeactivate()
If a private registry has been acquired this method unexports the registry object to free the RMI registry OID for later use.

Specified by:
doDeactivate in class AbstractRegistrationSupport

bindRepository

protected Object bindRepository(String name,
                                javax.jcr.Repository repository)
Description copied from class: AbstractRegistrationSupport
Called to actually register a repository with the registry. This method is called by AbstractRegistrationSupport.activate(ComponentContext) for any repositories bound before the component was activated and by AbstractRegistrationSupport.bindRepository(ServiceReference) for any repositories bound after the component was activated.

If actual registration fails, this method is expected to return null to indicate this fact. In this case, the AbstractRegistrationSupport.unbindRepository(String, Object) will NOT be called for the named repository.

This method may safely assume that it is only called on or after activation of this component on or before the component deactivation.

Specified by:
bindRepository in class AbstractRegistrationSupport
Parameters:
name - The name under which the repository is to be registered.
repository - The javax.jcr.Repository to register.
Returns:
Returns an object which is later given as the data parameter to the AbstractRegistrationSupport.unbindRepository(String, Object) method to unregister the repository of the given name. This may be null if actual registration failed.

unbindRepository

protected void unbindRepository(String name,
                                Object data)
Description copied from class: AbstractRegistrationSupport
Called to actually unregister a repository with the registry. This method is called by AbstractRegistrationSupport.unbindRepository(ServiceReference) for any repositories unbound before the component is deactivated and by AbstractRegistrationSupport.deactivate(ComponentContext) for any repositories not unbound before the component is deactivated.

If the AbstractRegistrationSupport.bindRepository(String, Repository) returned null for when the named repository was registered, this method is not called.

This method may safely assume that it is only called on or after activation of this component on or before the component deactivation.

Specified by:
unbindRepository in class AbstractRegistrationSupport
Parameters:
name - The name under which the repository is to be registered.
data - The data object returned by the AbstractRegistrationSupport.bindRepositoryInternal(String, ServiceReference) method.

getRemoteAdapterFactory

protected org.apache.jackrabbit.rmi.server.RemoteAdapterFactory getRemoteAdapterFactory()
Returns a Jackrabbit JCR RMI RemoteAdapterFactory to be used to publish local (server-side) JCR objects to a remote client.

This method returns an instance of the JackrabbitServerAdapterFactory class to enable the use of the Jackrabbit API over RMI. Extensions of this class may overwrite this method to return a different implementation to provide different JCR extension API depending on the server implementation.



Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.