com.niggle.data
Interface DataRegistry

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
DataRegistryImpl

public interface DataRegistry
extends java.rmi.Remote

The interface implemented by objects that vend "virgin" instances of a Record. A virgin instance is "vended" based on the type and version number passed in as arguments to the getExemplar() method. This is a creational pattern called the exemplar or canonical object pattern IIRC.

Author:
Jonathan Revusky

Method Summary
 DataSource getDataSource(java.lang.String name)
           
 java.util.List getDataSourceNames()
           
 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 dataSource)
          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.
 

Method Detail

registerRecordType

public void registerRecordType(RecordDescriptor descriptor)
                        throws java.io.IOException
Register the metadata for a record type.

getExemplar

public Record getExemplar(java.lang.String type,
                          int version)
                   throws java.io.IOException
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
Returns:
a "virgin" record of the given type and the highest version available.

getDataSource

public DataSource getDataSource(java.lang.String name)
                         throws java.io.IOException
Returns:
a DataSource by its unique name

registerDataSource

public void registerDataSource(DataSource dataSource)
                        throws java.io.IOException
register a DataSource by its unique name

registerDataSource

public void registerDataSource(DataSourceMetadata dsm)
                        throws java.io.IOException
register the metadata for a DataSource by its unique name.

getMetadata

public RecordDescriptor getMetadata(java.lang.String type,
                                    int version)
                             throws java.io.IOException
get record Metadata for the type and version.

getMetadata

public RecordDescriptor getMetadata(java.lang.String type)
                             throws java.io.IOException
get record Metadata for the type and the highest version number available.

getRecordNames

public java.util.List getRecordNames()
                              throws java.io.IOException
Returns:
a List of the names of all of the record types that this data registry knows about.

getDataSourceNames

public java.util.List getDataSourceNames()
                                  throws java.io.IOException
Returns:
a List of the names of all of the data sources that this data registry knows about.