sam.core
Class Unstorer

java.lang.Object
  |
  +--sam.rules.ModusOperandi.Opus
        |
        +--sam.core.Unstorer

public abstract class Unstorer
extends ModusOperandi.Opus

General-purpose class implementing the unstoring procedure.


Field Summary
 
Fields inherited from class sam.rules.ModusOperandi.Opus
name
 
Constructor Summary
protected Unstorer(java.lang.String name)
           
 
Method Summary
protected  void checkUserAndGroup(java.lang.String creatorUser, java.lang.String creatorGroup, java.lang.String currentUser, java.lang.String currentGroup)
          Checks user and group information.
protected  java.io.InputStream open(sam.rules.ModusOperandi modusOperandi, java.io.InputStream input)
          Opens the encoded data and turns it to a plain data stream
protected  java.io.InputStream openArchive(java.io.File archive, java.io.File temporaryDirectory)
          Opens the encoded data from the archive.
protected  void printComment(java.lang.String comment)
          Prints the comment, if any.
protected  java.util.jar.JarOutputStream process(sam.rules.ModusOperandi modusOperandi)
           
protected  void unstore(sam.entry.Enumerator files, sam.entry.List wildcards, java.io.File actualDirectory, java.io.InputStream input, sam.event.EventNotifier eventNotifier)
          Unstores specified entries.
protected abstract  void unstoreEntry(java.io.InputStream data, sam.entry.Entry entry, java.io.File actualDirectory, sam.event.FileEventNotifier fileEventNotifier)
          Unstores an entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Unstorer

protected Unstorer(java.lang.String name)
Method Detail

process

protected java.util.jar.JarOutputStream process(sam.rules.ModusOperandi modusOperandi)
Specified by:
process in class ModusOperandi.Opus

printComment

protected void printComment(java.lang.String comment)
Prints the comment, if any.

Parameters:
comment - the non-null comment

checkUserAndGroup

protected void checkUserAndGroup(java.lang.String creatorUser,
                                 java.lang.String creatorGroup,
                                 java.lang.String currentUser,
                                 java.lang.String currentGroup)
Checks user and group information.

Parameters:
creatorUser - the system-dependent user who created the archive
creatorGroup - the system-dependent group of the user who created the archive
currentUser - the system-dependent user who is currently running the application
currentGroup - the system-dependent group of the user who is currently running the application

openArchive

protected java.io.InputStream openArchive(java.io.File archive,
                                          java.io.File temporaryDirectory)
Opens the encoded data from the archive.

Parameters:
archive - the archive
temporaryDirectory - a writable temporary directory in case of data pre-extraction

open

protected java.io.InputStream open(sam.rules.ModusOperandi modusOperandi,
                                   java.io.InputStream input)
                            throws java.io.IOException
Opens the encoded data and turns it to a plain data stream

Parameters:
modusOperandi - the modus operandi containing the application settings
input - the encoded data
java.io.IOException

unstore

protected void unstore(sam.entry.Enumerator files,
                       sam.entry.List wildcards,
                       java.io.File actualDirectory,
                       java.io.InputStream input,
                       sam.event.EventNotifier eventNotifier)
                throws java.io.IOException
Unstores specified entries.

Parameters:
files - the catalog of all entries contained in the archive
wildcards - the filename filter specifying which entries to extract
actualDirectory - the base directory to extract files into
input - the decoded data stream
eventNotifier - the event notifier to handle events
java.io.IOException

unstoreEntry

protected abstract void unstoreEntry(java.io.InputStream data,
                                     sam.entry.Entry entry,
                                     java.io.File actualDirectory,
                                     sam.event.FileEventNotifier fileEventNotifier)
                              throws java.io.IOException
Unstores an entry.

Parameters:
data - the decoded data stream
entry - the entry to be processed
actualDirectory - the base directory to extract files into
java.io.IOException