org.ceryle.ui.xnode.archive
Class ZipReader

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

public class ZipReader
extends Thread

A utility extending Thread used to restore XNode database collections from previously created (zip) archives.

Once reparsed, the manifest.xml file becomes a Hashtable of Hashtables, one for each Collection. Each key in the m_collections Hashtable is a collection ID (cid) mapped to a Hashtable containing document ID (nid), which is mapped to a 4 element string array created from the DOM <entry> Element taken from the original XML manifest file. The order of the String array is: { cid, nid, created, modified }. Note that the modified attribute is optional; all others are required.

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.4
Version:
$Id: ZipReader.java,v 1.2 2007-06-20 01:27:35 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 m_error_limit
          The maximum number of read errors prior to aborting the read process.
static int m_errors
          The number of read errors that have occurred during the current thread.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ZipReader(File file, JProgressBar progress, ActionListener finishedListener)
          Constructor provided a list of database Collection IDs, and the base of the zip file name filebase (eg., "archive-20020801", which should not include the ".zip" file extension, as it will be added here.
 
Method Summary
protected  Document readManifest(ZipFile zipfile, ZipEntry manifest)
          Processes the manifest from its ZipEntry source, returning a DOM Document.
 void run()
          Begins the restoration 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

m_error_limit

public static int m_error_limit
The maximum number of read errors prior to aborting the read process.


m_errors

public static int m_errors
The number of read errors that have occurred during the current thread.

Constructor Detail

ZipReader

public ZipReader(File file,
                 JProgressBar progress,
                 ActionListener finishedListener)
Constructor provided a list of database Collection IDs, and the base of the zip file name filebase (eg., "archive-20020801", which should not include the ".zip" file extension, as it will be added here. The filebase 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 restoration process.

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

readManifest

protected Document readManifest(ZipFile zipfile,
                                ZipEntry manifest)
                         throws ZipException
Processes the manifest from its ZipEntry source, returning a DOM Document.

Throws:
ZipException - if any errors occur during processing of the ZipEntry


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