Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database.connection
Class FileBasedDatabaseConnection<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection<O>
              extended by de.lmu.ifi.dbs.elki.database.connection.InputStreamDatabaseConnection<O>
                  extended by de.lmu.ifi.dbs.elki.database.connection.FileBasedDatabaseConnection<O>
Type Parameters:
O - the type of DatabaseObject to be provided by the implementing class as element of the supplied database
All Implemented Interfaces:
DatabaseConnection<O>, Parameterizable

public class FileBasedDatabaseConnection<O extends DatabaseObject>
extends InputStreamDatabaseConnection<O>

Provides a file based database connection based on the parser to be set.

Author:
Arthur Zimek

Field Summary
static OptionID INPUT_ID
          OptionID for INPUT_PARAM
private  FileParameter INPUT_PARAM
          Parameter that specifies the name of the input file to be parsed.
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.connection.InputStreamDatabaseConnection
in, parser, PARSER_ID
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection
CLASS_LABEL_CLASS_ID, CLASS_LABEL_INDEX_ID, classLabelIndex, database, DATABASE_ID, EXTERNAL_ID_INDEX_ID, forceExternalID, LABEL_CONCATENATION
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
FileBasedDatabaseConnection()
          Provides a file based database connection based on the parser to be set, adding parameter INPUT_PARAM to the option handler additionally to parameters of super class.
 
Method Summary
 List<String> setParameters(List<String> args)
          Calls the super method InputStreamDatabaseConnection#setParameters(args)} and sets additionally the value of the parameter INPUT_PARAM.
static InputStream tryGzipInput(InputStream in)
          Try to open a stream as gzip, if it starts with the gzip magic.
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.connection.InputStreamDatabaseConnection
getDatabase, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection
normalizeAndTransformLabels
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters
 

Field Detail

INPUT_ID

public static final OptionID INPUT_ID
OptionID for INPUT_PARAM


INPUT_PARAM

private final FileParameter INPUT_PARAM
Parameter that specifies the name of the input file to be parsed.

Key: -dbc.in

Constructor Detail

FileBasedDatabaseConnection

public FileBasedDatabaseConnection()
Provides a file based database connection based on the parser to be set, adding parameter INPUT_PARAM to the option handler additionally to parameters of super class.

Method Detail

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Calls the super method InputStreamDatabaseConnection#setParameters(args)} and sets additionally the value of the parameter INPUT_PARAM.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class InputStreamDatabaseConnection<O extends DatabaseObject>
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting

tryGzipInput

public static InputStream tryGzipInput(InputStream in)
                                throws IOException
Try to open a stream as gzip, if it starts with the gzip magic. TODO: move to utils package.

Parameters:
in - original input stream
Returns:
old input stream or a GZIPInputStream if appropriate.
Throws:
IOException

Release 0.2.1 (2009-07-13_1605)