es.rediris.aarr.data
Interface DataSource

All Known Implementing Classes:
PlaintextDataFile

public interface DataSource

This interface defines the methods that external data sources will have to implement.

Author:
macias

Method Summary
 boolean exists(java.lang.String key)
          Returns true if the given key exists in the datasource.
 java.lang.String getName()
          Gets the name for the data source.
 java.lang.String getValue(java.lang.String key)
          Returns the value for the given key.
 void init()
          This method is used to initiate the data source; this may consist in the load of a file, the connection to an LDAP server or an SQL database, or whatever other form of initiating a data retrieving.
 void setName(java.lang.String id)
          Sets a name for the data source.
 

Method Detail

init

void init()
          throws DataSourceException
This method is used to initiate the data source; this may consist in the load of a file, the connection to an LDAP server or an SQL database, or whatever other form of initiating a data retrieving.

Throws:
DataSourceException - If there was an error when initting the data source

setName

void setName(java.lang.String id)
Sets a name for the data source.

Parameters:
id - A identificator for the data source

getName

java.lang.String getName()
Gets the name for the data source.

Returns:
an string with the name of the data source

getValue

java.lang.String getValue(java.lang.String key)
                          throws DataSourceException
Returns the value for the given key.

Parameters:
key - the name of the key
Returns:
The value for the given key
Throws:
DataSourceException - If there was a problem retrieving the key from the data source

exists

boolean exists(java.lang.String key)
               throws DataSourceException
Returns true if the given key exists in the datasource.

Parameters:
key - the name of the key
Returns:
A boolean balue. True if the key exists, false otherwise
Throws:
DataSourceException - If there was a problem when trying to guess if the key exists