Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.file
Class ArchiveUpdater

java.lang.Object
  extended by org.hyperic.util.file.ArchiveUpdater
Direct Known Subclasses:
TgzUpdater, ZipUpdater

public abstract class ArchiveUpdater
extends java.lang.Object

Common superclass for TgzUpdater and ZipUpdater


Field Summary
static TgzUpdater tgzUpdater
           
static ZipUpdater zipUpdater
           
 
Constructor Summary
ArchiveUpdater()
           
 
Method Summary
protected  void doClose(java.io.InputStream is)
           
protected  void doClose(java.io.OutputStream os)
           
static java.io.File getDestFile(java.lang.String arg)
           
static ArchiveUpdater getUpdater(java.io.File f)
           
static void main(java.lang.String[] args)
          Update an archive.
protected  boolean matches(java.lang.String archPath, java.lang.String match)
           
 void update(java.io.File arch, java.io.File out, java.lang.String pathToReplace, java.io.File replacementFile)
          Update an archive.
abstract  void update(java.io.File arch, java.io.File out, java.lang.String pathToReplace, java.io.InputStream replacement, long rsize)
          Same as the other update method, but this accepts an InputStream as the replacement file instead of a File object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

zipUpdater

public static ZipUpdater zipUpdater

tgzUpdater

public static TgzUpdater tgzUpdater
Constructor Detail

ArchiveUpdater

public ArchiveUpdater()
Method Detail

getUpdater

public static ArchiveUpdater getUpdater(java.io.File f)
                                 throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

main

public static void main(java.lang.String[] args)
Update an archive. args array is interpreted as: args[0] - the archive to update args[1] - destination file, or "SAME" to update the original file in place args[2] - the path within the archive to update args[3] - the file to use to update the archive


update

public void update(java.io.File arch,
                   java.io.File out,
                   java.lang.String pathToReplace,
                   java.io.File replacementFile)
            throws java.io.IOException
Update an archive. If the pathToReplace does not exist, the file will be added to the archive.

Parameters:
arch - The archive to update
out - The destination file. If null or equal to arch, then the original archive will be overwritten.
pathToReplace - The path within the archive that will be replaced. This may optionally begin with the String "**", in which case the first file whose name matches the filename after the ** will be updated.
replacementFile - The new file whose contents will be used to populate the replacement path.
Throws:
java.io.IOException

update

public abstract void update(java.io.File arch,
                            java.io.File out,
                            java.lang.String pathToReplace,
                            java.io.InputStream replacement,
                            long rsize)
                     throws java.io.IOException
Same as the other update method, but this accepts an InputStream as the replacement file instead of a File object.

Parameters:
rsize - The size of the replacement stream, in bytes.
Throws:
java.io.IOException

matches

protected boolean matches(java.lang.String archPath,
                          java.lang.String match)

doClose

protected void doClose(java.io.InputStream is)

doClose

protected void doClose(java.io.OutputStream os)

getDestFile

public static java.io.File getDestFile(java.lang.String arg)

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.