votorola.a.register
Class ReadyDirectory

java.lang.Object
  extended by java.io.File
      extended by ReadyDirectory
All Implemented Interfaces:
Serializable, Comparable<File>

@ThreadSafe
public final class ReadyDirectory
extends File

The file part of the backing to a voter list. Its path is always in canonical form.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
ReadyDirectory(String pathname)
          Constructs a ReadyDirectory.
 
Method Summary
(package private) static ReadyDirectory createReadyDirectory(File snapDirectory)
          Creates a ready directory, and returns an instance of it.
 File inVoterFile()
          Returns the file storing the snapshot of voter input.
 boolean isMounted()
          Returns true if the list is nominally mounted; false otherwise.
(package private)  VoterList mount(Register register)
          Tallies the results and makes them available via the database and filebase.
 File mountedFile()
          Returns the file to which the list is serialized, when mounted.
 String name()
          Returns the service identifier, obtained as the name of the grandparent file.
 String readVoterInputColumn(StringBuilder stringB, Reader in, boolean isLineTerminator)
          Reads a single column value.
 File snapDirectory()
          Returns the parent snap directory.
 String toUIString()
          Returns a short identifier intended for presenting to users.
(package private)  boolean unmount(Register register)
          Reverses a previous mount, erasing the results from the database and filebase.
 
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadyDirectory

public ReadyDirectory(String pathname)
               throws IOException
Constructs a ReadyDirectory.

Parameters:
pathname - per File(pathname), (will be converted to canonical form, if it is non-canonical)
Throws:
FileNotFoundException - if no directory exists at the specified pathname
IOException
See Also:
createReadyDirectory(File)
Method Detail

createReadyDirectory

static ReadyDirectory createReadyDirectory(File snapDirectory)
                                    throws IOException
Creates a ready directory, and returns an instance of it.

Parameters:
snapDirectory - parent directory in which to create the new ready directory
Throws:
IOException

inVoterFile

public File inVoterFile()
Returns the file storing the snapshot of voter input.


isMounted

public boolean isMounted()
Returns true if the list is nominally mounted; false otherwise.


mount

VoterList mount(Register register)
          throws IOException,
                 ScriptException,
                 SQLException
Tallies the results and makes them available via the database and filebase.

Parameters:
register - a register service corresponding to this ready directory
Returns:
mounted list
Throws:
IOException
ScriptException
SQLException
See Also:
isMounted(), unmount(Register)

mountedFile

public File mountedFile()
Returns the file to which the list is serialized, when mounted.


name

public String name()
Returns the service identifier, obtained as the name of the grandparent file.


readVoterInputColumn

public String readVoterInputColumn(StringBuilder stringB,
                                   Reader in,
                                   boolean isLineTerminator)
                            throws IOException
Reads a single column value.

Parameters:
stringB - to use, after clearing it
Returns:
value, or null if input exhausted
Throws:
IOException

snapDirectory

public File snapDirectory()
Returns the parent snap directory.


toUIString

public String toUIString()
Returns a short identifier intended for presenting to users. It includes the names of the parent snap directory, and this ready directory.


unmount

boolean unmount(Register register)
          throws IOException,
                 SQLException
Reverses a previous mount, erasing the results from the database and filebase.

Parameters:
register - a register service corresponding to this ready directory
Returns:
true if the list was unmounted, false if it was not mounted to begin with, either in whole or part
Throws:
IOException
SQLException
See Also:
isMounted(), mount(Register)