com.niggle.data
Class DataRegistryImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.niggle.data.DataRegistryImpl
All Implemented Interfaces:
DataRegistry, java.rmi.Remote, java.io.Serializable

public class DataRegistryImpl
extends java.rmi.server.UnicastRemoteObject
implements DataRegistry

This object plays a central role in the niggle framework. It is essentially a repository of "metadata" that allows us to get at the various containers as well as "exemplars" of the various data records.

Author:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
DataRegistryImpl()
           
 
Method Summary
 DataSource getDataSource(java.lang.String name)
           
 java.util.List getDataSourceNames()
           
static DataRegistry getDefaultRegistry()
           
 Record getExemplar(java.lang.String type)
           
 Record getExemplar(java.lang.String type, int version)
           
 RecordDescriptor getMetadata(java.lang.String type)
          get record Metadata for the type and the highest version number available.
 RecordDescriptor getMetadata(java.lang.String type, int version)
          get record Metadata for the type and version.
 java.util.List getRecordNames()
           
 void registerDataSource(DataSource source)
          register a DataSource by its unique name
 void registerDataSource(DataSourceMetadata dsm)
          register the metadata for a DataSource by its unique name.
 void registerRecordType(RecordDescriptor descriptor)
          Register the metadata for a record type.
static void setDefaultRegistry(DataRegistry registry)
          Optional hook to call if you want to substitute a custom DataRegistry implementation for the default one.
 void setRemoteRegistry(DataRegistry registry)
          Set a second DataRegistry source that will be used if the type is not found locally.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataRegistryImpl

public DataRegistryImpl()
                 throws java.io.IOException
Method Detail

getDefaultRegistry

public static DataRegistry getDefaultRegistry()

setDefaultRegistry

public static void setDefaultRegistry(DataRegistry registry)
Optional hook to call if you want to substitute a custom DataRegistry implementation for the default one.

setRemoteRegistry

public void setRemoteRegistry(DataRegistry registry)
                       throws java.io.IOException
Set a second DataRegistry source that will be used if the type is not found locally. This will likely be on a remote machine, hence the nomenclature.

getMetadata

public RecordDescriptor getMetadata(java.lang.String type)
                             throws java.io.IOException
Description copied from interface: DataRegistry
get record Metadata for the type and the highest version number available.
Specified by:
getMetadata in interface DataRegistry

getMetadata

public RecordDescriptor getMetadata(java.lang.String type,
                                    int version)
                             throws java.io.IOException
Description copied from interface: DataRegistry
get record Metadata for the type and version.
Specified by:
getMetadata in interface DataRegistry

registerRecordType

public void registerRecordType(RecordDescriptor descriptor)
                        throws java.io.IOException
Description copied from interface: DataRegistry
Register the metadata for a record type.
Specified by:
registerRecordType in interface DataRegistry

registerDataSource

public void registerDataSource(DataSource source)
                        throws java.io.IOException
Description copied from interface: DataRegistry
register a DataSource by its unique name
Specified by:
registerDataSource in interface DataRegistry

registerDataSource

public void registerDataSource(DataSourceMetadata dsm)
                        throws java.io.IOException
Description copied from interface: DataRegistry
register the metadata for a DataSource by its unique name.
Specified by:
registerDataSource in interface DataRegistry

getDataSource

public DataSource getDataSource(java.lang.String name)
                         throws java.io.IOException
Specified by:
getDataSource in interface DataRegistry
Following copied from interface: com.niggle.data.DataRegistry
Returns:
a DataSource by its unique name

getExemplar

public Record getExemplar(java.lang.String type,
                          int version)
                   throws java.io.IOException
Specified by:
getExemplar in interface DataRegistry
Following copied from interface: com.niggle.data.DataRegistry
Returns:
a "virgin" record of the given type and version. If the right version is not found, then it returns the exemplar of the highest available version number. If nothing is available, it returns null.

getExemplar

public Record getExemplar(java.lang.String type)
                   throws java.io.IOException
Specified by:
getExemplar in interface DataRegistry
Following copied from interface: com.niggle.data.DataRegistry
Returns:
a "virgin" record of the given type and the highest version available.

getDataSourceNames

public java.util.List getDataSourceNames()
                                  throws java.io.IOException
Specified by:
getDataSourceNames in interface DataRegistry
Following copied from interface: com.niggle.data.DataRegistry
Returns:
a List of the names of all of the data sources that this data registry knows about.

getRecordNames

public java.util.List getRecordNames()
                              throws java.io.IOException
Specified by:
getRecordNames in interface DataRegistry
Following copied from interface: com.niggle.data.DataRegistry
Returns:
a List of the names of all of the record types that this data registry knows about.