1.10.2. The API

The main functionality of the Registry Service is pretty simple and straightforward, it is described in the Registry abstract class as the following:

public abstract class Registry {

  
  /**
   * Returns the Registry object which wraps the Node of the "exo:registry" type
   */
  public abstract RegistryNode getRegistry(SessionProvider sessionProvider) 
      throws RepositoryConfigurationException, RepositoryException;
  
  /**
   * Returns the existing RegistryEntry which wraps the Node of the "exo:registryEntry" type  
   */
  public abstract RegistryEntry getEntry(SessionProvider sessionProvider, String groupName,
      String entryName) throws RepositoryException;
  /**
   * Creates a new RegistryEntry
   */
  public abstract void createEntry(SessionProvider sessionProvider,
      String groupName, RegistryEntry entry) throws RepositoryException;
  /**
   * Replaces a RegistryEntry
   */
  public abstract void recreateEntry(SessionProvider sessionProvider,
      String groupName, RegistryEntry entry) throws RepositoryException;
  /**
   * Removes a RegistryEntry
   */
  public abstract void removeEntry(SessionProvider sessionProvider,
      String groupName, String entryName) throws RepositoryException;

As you can see it looks like a simple CRUD interface for the RegistryEntry object which wraps registry data for some Consumer as a Registry Entry. The Registry Service itself knows nothing about the wrapping data, it is Consumer's responsibility to manage and use its data in its own way.

To create an Entity Consumer you should know how to serialize the data to some XML structure and then create a RegistryEntry from these data at once or populate them in a RegistryEntry object (using RegistryEntry(String entryName) constructor and then obtain and fill a DOM document).

Example of RegistryService using:

    RegistryService regService = (RegistryService) container

    .getComponentInstanceOfType(RegistryService.class);
    RegistryEntry registryEntry = regService.getEntry(sessionProvider,
            RegistryService.EXO_SERVICES, "my-service");
    Document doc = registryEntry.getDocument();
    
    String mySetting = getElementsByTagName("tagname").item(index).getTextContent();
     .....
Copyright ©2012. All rights reserved. eXo Platform SAS