com.gridsystems.storage
Interface DAO<T>

Type Parameters:
T - Class to store/load.

public interface DAO<T>

Data Access Object.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo, Xmas (Generics)

Method Summary
 java.lang.String[] getFileNames(java.util.Map<java.lang.String,java.lang.String> initData)
          Gets the list of file names from where to load an object from the specified Map.
 java.lang.String[] getFileNames(T obj)
          Gets the list of file names where an object must be stored, from the object itself.
 T load(java.lang.String[] fileNames)
          Loads an object from the speficied file list.
 void store(java.lang.String[] fileNames, T obj)
          Stores an object in the specified file list.
 

Method Detail

load

T load(java.lang.String[] fileNames)
       throws java.lang.Exception
Loads an object from the speficied file list.

Parameters:
fileNames - The names of the files where the object data is stored
Returns:
The loaded object instance
Throws:
java.lang.Exception - in case of error

store

void store(java.lang.String[] fileNames,
           T obj)
           throws java.lang.Exception
Stores an object in the specified file list.

Parameters:
fileNames - The names of the files where the object data must be stored
obj - The object to store
Throws:
java.lang.Exception - In case of error

getFileNames

java.lang.String[] getFileNames(java.util.Map<java.lang.String,java.lang.String> initData)
Gets the list of file names from where to load an object from the specified Map.

Parameters:
initData - A map containing data that can be used to find out the file names from where to load an object
Returns:
The list of file names

getFileNames

java.lang.String[] getFileNames(T obj)
Gets the list of file names where an object must be stored, from the object itself.

It can also be used to obtain the list of files to delete on object removal.

Parameters:
obj - The object to store
Returns:
The list of file names


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.