com.bigzip.plugin
Class ArchiveModel

java.lang.Object
  |
  +--com.bigzip.plugin.ArchiveModel

public abstract class ArchiveModel
extends java.lang.Object

Plugins provide BiGZiP will an subclass of Archive when a new archive is created or an existing archive is opened. The class is used to provide the user will access to details of the archive.


Field Summary
static java.lang.String ACTIONS_PROPERTY
           
static java.lang.String ARCHIVE_TITLE_PROPERTY
           
static java.lang.String COLUMN_INFO_PROPERTY
           
static java.lang.String ENTRIES_PROPERTY
           
static java.lang.String ENTRY_COUNT_PROPERTY
           
static java.lang.String TOTAL_COMPRESSED_SIZE_PROPERTY
           
static java.lang.String TOTAL_UNCOMPRESSED_SIZE_PROPERTY
           
 
Constructor Summary
ArchiveModel()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to this list of listeners notified of changes in this Archive's properties.
abstract  void close()
          Close the archive represented by this model and free any resources allocated.
static void closeAllTemporaryFiles()
           
static boolean closeTemporaryFile(java.io.File temporaryFile)
           
static java.io.File createNewTemporaryFile()
           
protected  void firePropertyChangeEvent(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a PropertyChangeEvent at the listeners registered with this Archive.
 ArchiveAction getAction(int index)
           
 ArchiveAction[] getActions()
           
 java.lang.String getArchiveTitle()
          Returns the title of the archive.
 ColumnInfo[] getColumnInfo()
           
 ArchiveEntry[] getEntries()
          Returns the list of entries in the archive.
 int getEntryCount()
           
 java.lang.String getFileName()
           
 javax.swing.JDialog getPropertiesDialog()
          Returns a dialog box that allows the user to view and optionally modify properties of the archive.
 long getTotalCompressedSize()
          Returns the sum of the sizes of the files compressed in the archive.
 long getTotalUncompressedSize()
          Returns the total size of the files in the archive if the archive was completly uncompressed.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a previously added PropertyChangeListener object from the list of listeners notified of changes in this object.
 void saveRegistrationSettings()
          Saves the user registration settings.
 void setActions(ArchiveAction[] actions)
          Sets the actions available for this plugin.
 void setArchiveTitle(java.lang.String archiveTitle)
          Sets the archive's title.
 void setColumnInfo(ColumnInfo[] columnInfo)
          Sets the list of ColumnInfo objects that describes each of the extra table columns.
 void setEntries(ArchiveEntry[] entries)
          Sets the list of entries in the archive.
 void setEntryCount(int entryCount)
          Sets the number of entries for the archive.
 void setFilename(java.lang.String filename)
          Sets the name of the file that this archive model represents.
 void setPropertiesDialog(javax.swing.JDialog propertiesDialog)
          Sets the dialog that provides access to the archive's properties.
static void setSettings(Settings settings)
           
 void setTotalCompressedSize(long totalCompressedSize)
          Sets the total compressed size.
 void setTotalUncompressedSize(long totalUncompressedSize)
          Sets the total uncompressed size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTIONS_PROPERTY

public static final java.lang.String ACTIONS_PROPERTY

ARCHIVE_TITLE_PROPERTY

public static final java.lang.String ARCHIVE_TITLE_PROPERTY

COLUMN_INFO_PROPERTY

public static final java.lang.String COLUMN_INFO_PROPERTY

ENTRIES_PROPERTY

public static final java.lang.String ENTRIES_PROPERTY

ENTRY_COUNT_PROPERTY

public static final java.lang.String ENTRY_COUNT_PROPERTY

TOTAL_COMPRESSED_SIZE_PROPERTY

public static final java.lang.String TOTAL_COMPRESSED_SIZE_PROPERTY

TOTAL_UNCOMPRESSED_SIZE_PROPERTY

public static final java.lang.String TOTAL_UNCOMPRESSED_SIZE_PROPERTY
Constructor Detail

ArchiveModel

public ArchiveModel()
Method Detail

createNewTemporaryFile

public static java.io.File createNewTemporaryFile()

closeAllTemporaryFiles

public static void closeAllTemporaryFiles()

closeTemporaryFile

public static boolean closeTemporaryFile(java.io.File temporaryFile)

setSettings

public static void setSettings(Settings settings)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to this list of listeners notified of changes in this Archive's properties.
Parameters:
listener - PropertyChangeListener to be notified.

close

public abstract void close()
                    throws java.io.IOException
Close the archive represented by this model and free any resources allocated. The archive model is garenteed not to be used after this method completes.
Throws:
java.io.IOException - An error occurs while closing the archive.

firePropertyChangeEvent

protected void firePropertyChangeEvent(java.lang.String propertyName,
                                       java.lang.Object oldValue,
                                       java.lang.Object newValue)
Fires a PropertyChangeEvent at the listeners registered with this Archive.

getAction

public ArchiveAction getAction(int index)
Parameters:
index - the specific action required with in the ArchiveAction array.
Returns:
action a specific action denoted by the index.

getActions

public ArchiveAction[] getActions()
Returns:
The list of actions that can be performed on the archive.

getArchiveTitle

public java.lang.String getArchiveTitle()
Returns the title of the archive. If an archive format can store a title for the archive that is different from its filename, then this methods returns that title. Otherwise it returns null to indicate that the archive has no specific title.
Returns:
The title of the archive.

getColumnInfo

public ColumnInfo[] getColumnInfo()
Returns:
a list of ColumnInfo objects that describes each of the extra table columns.

getEntries

public ArchiveEntry[] getEntries()
Returns the list of entries in the archive. This will usually come from the directory structure inside the archive file format. Note that although the program will cache this information, it is strongly recommended that the implementation does not access the file each time this method is called. It should construct this information when the archive is openned and stored in memory.
Returns:
The list of entries that represents the files stored in the archive file.

getEntryCount

public int getEntryCount()
Returns:
The number of file entries in the archive file.

getFileName

public java.lang.String getFileName()
Returns:
the name of the file that this model represents.

getPropertiesDialog

public javax.swing.JDialog getPropertiesDialog()
Returns a dialog box that allows the user to view and optionally modify properties of the archive. Archive properties could include things such as an archive title, the compression ratio across the whole archive. If the archive file format does not include archive properties, the this method returns null, which it does by default.
Returns:
A dialog box that allows access to the archive properties, or null if the archive doesn't support archive properties.

getTotalCompressedSize

public long getTotalCompressedSize()
Returns the sum of the sizes of the files compressed in the archive. Note that this is different from the archive file size as it doesn't include overheads intorduced by the archive file format.
Returns:
The compressed size of files in the archive in bytes.

getTotalUncompressedSize

public long getTotalUncompressedSize()
Returns the total size of the files in the archive if the archive was completly uncompressed.
Returns:
The uncompressed size of files in the archive in bytes.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a previously added PropertyChangeListener object from the list of listeners notified of changes in this object.

saveRegistrationSettings

public void saveRegistrationSettings()
Saves the user registration settings.

setActions

public void setActions(ArchiveAction[] actions)
Sets the actions available for this plugin.
Parameters:
actions - List of available BiGZiPAction objects.

setArchiveTitle

public void setArchiveTitle(java.lang.String archiveTitle)
Sets the archive's title.
Parameters:
The - archive's title.

setColumnInfo

public void setColumnInfo(ColumnInfo[] columnInfo)
Sets the list of ColumnInfo objects that describes each of the extra table columns.
Parameters:
columnInfo - The list of ColumnInfo objects.

setEntries

public void setEntries(ArchiveEntry[] entries)
Sets the list of entries in the archive.
Parameters:
The - list of entries representing the files in the archive.

setEntryCount

public void setEntryCount(int entryCount)
Sets the number of entries for the archive.
Parameters:
entryCount - Number of entries.

setFilename

public void setFilename(java.lang.String filename)
Sets the name of the file that this archive model represents.
Parameters:
filename - The name of the file.

setPropertiesDialog

public void setPropertiesDialog(javax.swing.JDialog propertiesDialog)
Sets the dialog that provides access to the archive's properties.

setTotalCompressedSize

public void setTotalCompressedSize(long totalCompressedSize)
Sets the total compressed size.
Parameters:
totalCompressedSize - The total compressed size.

setTotalUncompressedSize

public void setTotalUncompressedSize(long totalUncompressedSize)
Sets the total uncompressed size.
Parameters:
totalUncompressedSize - The total uncompressed size.