org.tranche.flatfile
Class DataDirectoryConfiguration

java.lang.Object
  extended by org.tranche.flatfile.DataDirectoryConfiguration
All Implemented Interfaces:
java.lang.Comparable

public class DataDirectoryConfiguration
extends java.lang.Object
implements java.lang.Comparable

A simple cap on the directories to use and the amount of data to put in them. Size is noted in bytes.

Author:
Jayson, Bryan E. Smith - bryanesmith@gmail.com

Field Summary
static long MAX_SIZE
          Deprecated.  
 
Constructor Summary
DataDirectoryConfiguration(java.lang.String directory, long sizeLimit)
           
 
Method Summary
 void adjustUsedSpace(long adjustment)
          Adjust disk space used both actual bytes and estimated real disk space based on the filesystem's minimum block size.
 boolean canStoreData(long size)
          Returns true if there is enough space to store file.
 DataDirectoryConfiguration clone()
           
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 long getActualSize()
          Get the size, in bytes, of actual data stored in this directory.
 java.lang.String getDirectory()
          Get the path to the directory represented by this DataDirectoryConfiguration object.
 java.io.File getDirectoryFile()
          Get the file for the directory represented by this DataDirectoryConfiguration object.
 long getSizeLimit()
          Get the administrator-defined size limit for the DataDirectoryConfiguration.
 int hashCode()
           
 boolean isOverflowBeenDetected()
          True if the variable keeping track of the actual bytes used has overflowed.
 void setDirectory(java.lang.String directory)
          Set the directory represented by this DataDirectoryConfiguration object.
 void setSizeLimit(long sizeLimit)
          Set the size limit for the DataDirectoryConfiguration.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SIZE

public static final long MAX_SIZE
Deprecated. 

Represents the maximum size of a data directory.

Note this value is ignored, as the maximum size is whether the administrator sets in the DataDirectoryConfiguration.

See Also:
Constant Field Values
Constructor Detail

DataDirectoryConfiguration

public DataDirectoryConfiguration(java.lang.String directory,
                                  long sizeLimit)
Parameters:
directory -
sizeLimit -
Method Detail

getDirectory

public java.lang.String getDirectory()

Get the path to the directory represented by this DataDirectoryConfiguration object.

Returns:

getDirectoryFile

public java.io.File getDirectoryFile()

Get the file for the directory represented by this DataDirectoryConfiguration object.

Returns:

setDirectory

public void setDirectory(java.lang.String directory)

Set the directory represented by this DataDirectoryConfiguration object.

Parameters:
directory -

getSizeLimit

public long getSizeLimit()

Get the administrator-defined size limit for the DataDirectoryConfiguration.

Returns:

setSizeLimit

public void setSizeLimit(long sizeLimit)

Set the size limit for the DataDirectoryConfiguration.

Parameters:
sizeLimit -

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

adjustUsedSpace

public void adjustUsedSpace(long adjustment)

Adjust disk space used both actual bytes and estimated real disk space based on the filesystem's minimum block size.

Parameters:
adjustment - Positive or negative value. E.g., if a KB was deleted, adjustment would be -1024

canStoreData

public boolean canStoreData(long size)

Returns true if there is enough space to store file.

Parameters:
size - The size of the file being added.

getActualSize

public long getActualSize()

Get the size, in bytes, of actual data stored in this directory.

Returns:

clone

public DataDirectoryConfiguration clone()
Overrides:
clone in class java.lang.Object

isOverflowBeenDetected

public boolean isOverflowBeenDetected()

True if the variable keeping track of the actual bytes used has overflowed.

Returns:


This code is free for use both commercially and non-commercially as stated in the project's license