Site Navigation


Service Registry (Registrar) Configuration and Application Programming Interfaces (APIs)

Service Registry (Registrar) Configuration File Settings

There is a sample configuration available in the /conf directory. The file localhost-registrar-config.xml contains a basic configuration for a Service Registry to run on the local machine.

The localhost config files should never be used for more than single machine testing. The service will identify itself as localhost, which will cause cause name resolution problems when other services attempt to connect to it.

The Service Registry contains several resources that provide functionality and information to other components. These resources are instantiated at startup and are configured by an XML configuration file. The resources of the Service Registry are:

  1. Mobius Configuration <resource name="mobiusConfig"...>
  2. Registrar Configuration <resource name="registrarConfig"...>

These resources must be specified in order in the configuration file due to dependencies some resources have on others.

Mobius Configuration

The Mobius Configuration section is common to all Mobius Network Services. This block defines the Network Service Descriptor the service will use when identifying itself on the grid, and the handlers for the various protocol in the server. This resource is defined under the element <resource name="mobiusConfig" class="org.projectmobius.services.common.MobiusConfiguration"> All resources are specified in this way; the name attribute is the name the resource will have in the resource manager and the class attribute is the class within Mobius that will be associated with that resource.

The Mobius Configuration has two elements:

<MobiusNetworkServiceDescriptor>
All Mobius services have a Mobius Network Service Descriptor that they use to describe themselves to other services within Mobius. The serviceType attribute defines what kind of service this is. For the Service Registry, set this to REGISTRAR. The hostname attribute defines the name of the host this service is running on. The children of the Mobius Network Service Descriptor describe the service.
<serviceIdentifier>
This element describes the service identification string used to uniquely identify a Mobius Service within the Grid.
<ports>
This element describes the ports the service will use for communication.
<aliases>
This element defines any aliases for the host of the service. Aliases are needed when a host has more than one physical network connection. An <alias> element has attributes id and hostname that define the identification and the hostname that each network interface maps to. If the host does not have any extra network interfaces, it is safe to leave the <aliases> element empty.
<handlers>
The handlers define what classes the Registrar should use to handle certain protocol requests and responses. Changing these from the way they are defined in the example localhost-registrar-config.xml will likely break some functionality.

Registrar Configuration

The Service Registry itself is configured next. This resource contains information about the database the Service Registry will use to store information about registered services. This resource is defined under the element <resource name="registrarConfig" class="org.projectmobius.services.registrar. RegistrarConfiguration"> The resource has a child called <registrar-configuration> that contains the configuration information for the resource. The Service Registry needs configuration information for its database, and this is supplied by the database element. Its children specify configuration parameters for the database:

<name>
This element specifies the name of the database
<driver>
The driver class for accessing the mysql database.
<urlPrefix>
The url prefix for accessing the database.
<host>
The host the database lives on. Usually, this will be localhost.
<port>
The port via which the database can be accessed.
<username>
The username to log into the database with. This username must have privileges to add and remove databases and tables.
<password>
The password to authenticate the username.
<pool>
This element determines how many connections to the database will be made initially.

Service Registry (Registrar) Application Programming Interfaces (APIs)

To facilitate use of the Service Registry within the context of another program or service, there is a client API in the org.projectmobius.client.registrar package.

diagram of layer of service registry api

Registry Service API layers

The Service Registry is accessed via a handle, and the handle is produced by a factory. The ServiceRegistryFactory interface provides the specification for the factory, and its default implementation is DefaultServiceRegist The handle must conform to the interface ServiceRegistryAccess, and the implementation of the interface is ServiceRegistryHandle.

An example instantiation of a handle to a Service Registry:


ServiceRegistryFactory factory = 
  new DefaultServiceRegistryFactory();
ServiceRegistryHandle handle =
  factory.getServiceRegistryHandle(<serviceId>)

where <serviceId> is a String representing the service identification of the Service Registry you wish to access.