de.unihalle.informatik.Alida.dataio
Class ALDDataIOManagerCmdline

java.lang.Object
  extended by de.unihalle.informatik.Alida.dataio.ALDDataIOManager
      extended by de.unihalle.informatik.Alida.dataio.ALDDataIOManagerCmdline

public class ALDDataIOManagerCmdline
extends ALDDataIOManager

This class implements a DataIO manager for reading/writing from command line. For reading and writing, it essentially looks up the correct provider for command line execution using the method of its super class and invokes its method.

It does its work in collaboration with ALDDataIOCmdline.

Author:
posch

Field Summary
private  boolean doHistory
          If true writeData should try to write the history to file if the object itself is written to a file
(package private) static ALDDataIOManagerCmdline instance
          The singleton instance of this class
 
Fields inherited from class de.unihalle.informatik.Alida.dataio.ALDDataIOManager
debug, mapTable
 
Constructor Summary
private ALDDataIOManagerCmdline()
          private constructor
 
Method Summary
static ALDDataIOManagerCmdline getInstance()
          Return the single instance of this class
 boolean isDoHistory()
           
 java.lang.Object readData(java.lang.reflect.Field field, java.lang.Class<?> cl, java.lang.String valueString)
          Reads data of given class from a specified source.
 void setDoHistory(boolean doHistory)
           
 java.lang.String writeData(java.lang.Object obj, java.lang.String locatationString)
          Writes data to the specified location.
 
Methods inherited from class de.unihalle.informatik.Alida.dataio.ALDDataIOManager
getProvider, getProviderMap, initMapTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doHistory

private boolean doHistory
If true writeData should try to write the history to file if the object itself is written to a file


instance

static final ALDDataIOManagerCmdline instance
The singleton instance of this class

Constructor Detail

ALDDataIOManagerCmdline

private ALDDataIOManagerCmdline()
private constructor

Method Detail

getInstance

public static ALDDataIOManagerCmdline getInstance()
Return the single instance of this class

Returns:
single instance

isDoHistory

public boolean isDoHistory()
Returns:
the writeHistory

readData

public java.lang.Object readData(java.lang.reflect.Field field,
                                 java.lang.Class<?> cl,
                                 java.lang.String valueString)
                          throws ALDDataIOManagerException,
                                 ALDDataIOProviderException
Reads data of given class from a specified source. If both field and cl are non-null, the class defined in field is used and cl ignored. If one of field or cl is null, the other non null argument will be used. Some objects can only be read if field is supplied, e.g. Collections.

The valueString is used to actualy read the data. The interpretation is specific to the class to be read and defined by the corresponding provider class. As a convention, if valueString starts with FILEIO_CHAR (see ALDStandardizedDataIOCmdline) data are to be read from file, where the remaining value of valueString defines the filename. Otherwise valueString is directly parsed for the value.

Parameters:
field - field of object to be returned.
cl - Class of data to be read.
valueString - Source or value string to read data.
Returns:
Read data object
Throws:
ALDDataIOManagerException
ALDDataIOProviderException

setDoHistory

public void setDoHistory(boolean doHistory)
Parameters:
writeHistory - the writeHistory to set

writeData

public java.lang.String writeData(java.lang.Object obj,
                                  java.lang.String locatationString)
                           throws ALDDataIOManagerException,
                                  ALDDataIOProviderException
Writes data to the specified location. This method may return a String with a representation of parameters value or may choose to write the value itself, e.g. to a file. The latter will by convention be true, if locatationString starts with cmdlineFILEIO_CHAR (see de.unihalle.informatik.Alida.dataio.provider.cmdline).

Parameters:
obj - Object to write.
locatationString - String indicated whether to return the value of where to write the value to.
Returns:
String formated from obj
Throws:
ALDDataIOManagerException
ALDDataIOProviderException