org.apache.torque.generator.source.stream
Class FileSource

java.lang.Object
  extended by org.apache.torque.generator.source.SourceImpl
      extended by org.apache.torque.generator.source.stream.FileSource
All Implemented Interfaces:
Source

public class FileSource
extends SourceImpl

A Source which uses a file as input.


Constructor Summary
FileSource(StreamSourceFormat format, File path, ControllerState controllerState)
          Constructor.
 
Method Summary
 SourceElement createRootElement()
          Reads and parses the input file and creates the element tree from it.
 String getDescription()
          Returns the path of the file as a description.
 File getPath()
          Returns the path to the source file.
 File getSourceFile()
          Returns the source file, if it exists.
 StreamSourceFormat getSourceFormat()
          Returns the format of the source.
 String toString()
           
 
Methods inherited from class org.apache.torque.generator.source.SourceImpl
getRootElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileSource

public FileSource(StreamSourceFormat format,
                  File path,
                  ControllerState controllerState)
Constructor.

Parameters:
format - the source format, not null.
path - the path to the file to read, not null.
ControllerState - the controller state, not null.
Throws:
NullPointerException - if path or format is null.
Method Detail

getSourceFormat

public StreamSourceFormat getSourceFormat()
Returns the format of the source.

Returns:
the source format, not null.

getPath

public File getPath()
Returns the path to the source file.

Returns:
the path to the source file, not null.

createRootElement

public SourceElement createRootElement()
                                throws SourceException
Reads and parses the input file and creates the element tree from it.

Specified by:
createRootElement in class SourceImpl
Returns:
the root element of the element tree.
Throws:
SourceException - if the input file cannot be read or parsed.

getDescription

public String getDescription()
Returns the path of the file as a description.

Returns:
path of the file, not null.
See Also:
Source.getDescription()

getSourceFile

public File getSourceFile()
Returns the source file, if it exists.

Returns:
the source file, or null if the source is not read from a file.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.