org.ceryle.ui.xnode.archive
Class ZipWriter

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.ui.xnode.archive.ZipWriter
All Implemented Interfaces:
Runnable

public class ZipWriter
extends Thread

A utility extending Thread used to archive XNode database collections.

Separate Distribution

Note that the org.ceryle.xnode.archive package is not part of the standard distribution of the XNode API or implementation, as it includes too many UI ties.

Copyright 2001-2007 Murray Altheim. All Rights Reserved.
See LICENSE included with distribution.

Since:
JDK1.3
Version:
$Id: ZipWriter.java,v 1.2 2007-06-20 01:27:36 altheim Exp $
Author:
Murray Altheim

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int compressionLevel
          An enumerated int setting the compression level used for the zip file.
static String manifestFileName
          The file name of manifest file written as the zip archive.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ZipWriter(Collection cids, File file, String basepath, JProgressBar progress)
          Constructor provided a list of database Collection IDs, and the base of the zip file name basepath (eg., "archive-20020801", which should not include the ".zip" file extension, as it will be added here.
 
Method Summary
 Collection getManifestList(Collection cids)
          This establishes the DOM Document containing the manifest of this archive.
 void run()
          Begins the archiving process.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

manifestFileName

public static final String manifestFileName
The file name of manifest file written as the zip archive.

See Also:
Constant Field Values

compressionLevel

public static int compressionLevel
An enumerated int setting the compression level used for the zip file. The default is Deflater.BEST_COMPRESSION. Alternately, this may be set as an int to '0' (no compression), or between '1' (best speed, lowest compression) and 9 (best compression, lowest speed).

See Also:
Deflater.NO_COMPRESSION, Deflater.BEST_SPEED, Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION
Constructor Detail

ZipWriter

public ZipWriter(Collection cids,
                 File file,
                 String basepath,
                 JProgressBar progress)
Constructor provided a list of database Collection IDs, and the base of the zip file name basepath (eg., "archive-20020801", which should not include the ".zip" file extension, as it will be added here. The basepath is also used in creating the zip file). The optional JProgressBar progress will be kept up to date as things proceed if non-null.

Method Detail

run

public void run()
Begins the archiving process.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

getManifestList

public Collection getManifestList(Collection cids)
                           throws ZipException
This establishes the DOM Document containing the manifest of this archive.

Returns a Collection containing the XNodeIDs of all XNodes in the Collection cids, itself containing the IDs of the database XNodeCollections as Strings. Order will be as the Collection and Node-within-Collection iterators return their contents. If empty, returns an empty Vector.

Parameters:
cids - contains the Collection ID of the query.
Throws:
ZipException
See Also:
XNodeID


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.