org.sapia.regis.remote
Class RegistryServer

java.lang.Object
  extended by org.sapia.regis.remote.RegistryServer
All Implemented Interfaces:
RemoteConsts

public class RegistryServer
extends java.lang.Object
implements RemoteConsts

Basics

An instance of this class connects to a registry and exports it as a remote registry to a Ubik JNDI server, or on an explicit port.

This class is configured through Java properties. The path to a Java properties file can be specified at the command-line. This class attempts to load the file from:

If no such path is given, this class defaults to the system properties - in fact this class also defaults to the system properties if a given property could not be found at the level of the loaded properties.

This class expects one of the following properties to be specified:

If the host on which the server is started has multiple network interfaces, then the one to specifically use can be set through the following system property (see the Ubik documentation): ubik.rmi.address-pattern. The value of the property must correspond to a valid regular expression (for example: 192\.\d+\.\d+\.\d+).

The following provides a sample registry server configuration:

 org.sapia.regis.factory=org.sapia.regis.local.LocalRegistryFactory
 org.sapia.regis.remote.jndi.name=services/regis
 java.naming.provider.url=ubik://192.168.0.103:1099/
 ubik.jndi.domain=default
 org.sapia.regis.remote.p2p=true
 ubik.rmi.address-pattern=192\.\d+\.\d+\.\d+
 
The properties are further explained below.

Note that if the Ubik JNDI server is used in order to publish the server on the network, the required Ubik JNDI properties must be given as part of properties loaded by this server (again, see the Ubik documentation).

Remote Configuration Upload

A registry server supports remotely loading configuration files (all remote registry nodes implement the Configurable interface). However, since this can pause a security or access control issue, a registry server supports username/password authentication. That is: as part of the server's configuration properties, a username and password can be specified, which are used to perform authentication of remote users that attempt loading a configuration into the registry.

The username and password must be given as values of the following properties, respectively:

If no username and/or password are given, the following default ones are respectively used:

Bootstrap Configuration

A registry server can be provided with a boostrap XML configuration, that it will load at startup to initialize itself. This can be useful between shutdowns, if the configuration that a registry contains is not persisted. For bootstrapping to work, the following property must be specified as part of the registry server's properties: org.sapia.regis.remote.bootstrap. The value of that property consists of a comma-delimited list of resources that are to be loaded. Each resource is interpreted either as (whichever works first): The following is an example of a bootstrap property:
 org.sapia.regis.remote.bootstrap=/home/conf/host.xml, http://mercury.acmeco.net/global.xml
 
Attempt is made to load all resources (loading does not stop at the first resource that is found).

Peer-to-Peer

A registry server can act in peer-to-peer mode, meaning that in this case all registry servers belonging to the same given domain will upload their configuration to their peers. For example, given registry A and B belonging to the same domain, if registry A is updated with a configuration by an end-user, it will in turn upload that configuration to registry B.

Replication is not performed in the case of boostrap configuration.

The domain of a registry server is passed to it through the properties that it loads. It is identified by the following property: ubik.jndi.domain (the server uses Ubik's multicast to discover other registry servers in the domain, and publish itself to these peers). If the property is not specified, default is used as domain name.

In addition, for the replicated mechanism to work, the following property also has to be specified: org.sapia.regis.remote.p2p, with a value of true.

The RegistryTask Ant task has been implemented in order to upload registry configuration remotely, from an Ant script.

Author:
yduchesne

Nested Class Summary
static class RegistryServer.ShutdownHook
           
 
Field Summary
static boolean startThread
           
 
Fields inherited from interface org.sapia.regis.remote.RemoteConsts
BOOTSTRAP, DEBUG, DEFAULT_PASSWORD, DEFAULT_USERNAME, PASSWORD, PEER_TO_PEER, SERVER_JNDI_NAME, SERVER_PORT, USERNAME
 
Constructor Summary
RegistryServer()
           
 
Method Summary
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startThread

public static boolean startThread
Constructor Detail

RegistryServer

public RegistryServer()
Method Detail

main

public static void main(java.lang.String[] args)


Copyright © 2011 Sapia OSS. All Rights Reserved.