eteg.sinon.dao.xml
Class XMLCollectorDAO

java.lang.Object
  extended by eteg.sinon.dao.xml.XMLCollectorDAO
All Implemented Interfaces:
CollectorDAO

public class XMLCollectorDAO
extends java.lang.Object
implements CollectorDAO

Implementation of CollectorDAO that read and write instances of Collector in XML files. These files must have .xml suffix. Files are written and read from the directory passed to XMLCollectorDAO().

Version:
$Revision: 1.2 $
Author:
Thiago H. de Paula Figueiredo, Last modified by $Author: thiagohp $

Field Summary
static java.lang.String COLLECTOR_SUFFIX
          Sufixo que todos os arquivox XML descrevendo coletores devem usar.
static java.lang.String DEFAULT_COLLECTOR_DIRECTORY
          Collector directory used when no one is specified.
 
Constructor Summary
XMLCollectorDAO()
          No-arg constructor.
XMLCollectorDAO(java.io.File collectorDirectory)
          Constructor that receives a File pointing to the configurations file directory.
 
Method Summary
 java.util.List findAll()
          Returns all available collectors.
 java.io.File getCollectorDirectory()
          Returns the collectors file directory.
 Collector load(java.lang.String id)
          Loads the collector which id is id.
 void store(Collector collector)
          Writes collector in collectorDirectory + "/" + collector.getId() + ".xml".
 void store(Collector collector, java.io.File destination)
          Writes collector in a given destination directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLLECTOR_SUFFIX

public static final java.lang.String COLLECTOR_SUFFIX
Sufixo que todos os arquivox XML descrevendo coletores devem usar.

See Also:
Constant Field Values

DEFAULT_COLLECTOR_DIRECTORY

public static final java.lang.String DEFAULT_COLLECTOR_DIRECTORY
Collector directory used when no one is specified. Value: collectors.

See Also:
Constant Field Values
Constructor Detail

XMLCollectorDAO

public XMLCollectorDAO(java.io.File collectorDirectory)
Constructor that receives a File pointing to the configurations file directory.

Parameters:
collectorDirectory - a java.io.File.
Throws:
java.lang.IllegalArgumentException - if collectorDirectory is null.

XMLCollectorDAO

public XMLCollectorDAO()
No-arg constructor. The collectors file directory is the current one.

Method Detail

getCollectorDirectory

public java.io.File getCollectorDirectory()
Returns the collectors file directory.

Returns:
a File.

store

public void store(Collector collector)
           throws SinonException
Writes collector in collectorDirectory + "/" + collector.getId() + ".xml".

Specified by:
store in interface CollectorDAO
Parameters:
collector - a Collector instance.
Throws:
SinonException - if some error ocurrs.

store

public void store(Collector collector,
                  java.io.File destination)
           throws SinonException
Writes collector in a given destination directory.

Parameters:
collector - a Collector instance.
destination - a java.util.File.
Throws:
SinonException - if some error ocurrs.

findAll

public java.util.List findAll()
                       throws java.lang.Exception
Returns all available collectors.

Specified by:
findAll in interface CollectorDAO
Returns:
a java.util.List.
Throws:
java.lang.Exception - if some error ocurrs.

load

public Collector load(java.lang.String id)
               throws SinonException
Loads the collector which id is id.

Specified by:
load in interface CollectorDAO
Parameters:
id - a String containing the collector id.
Returns:
a Collector instance.
Throws:
SinonException - if some error ocurrs.


Copyright © 2004-2005 ETEG Internet Ltda.. All Rights Reserved.