org.eclipse.actf.util.jar
Class InstallJars

java.lang.Object
  extended by org.eclipse.actf.util.jar.InstallJars

public class InstallJars
extends Object

* InstallJars - a utility to download and install files, Jars and Zips. * *

Author:
Barry Feigenbaum, Ph.D. *

Field Summary
static int BLOCK_COUNT
           
static int BLOCK_SIZE
           
static int bufferSize
           
protected  boolean expand
           
protected  String javaParams
           
protected static String MAGIC
           
protected static int OFFSET_CHKSUM
           
protected static int OFFSET_DEVMAJOR
           
protected static int OFFSET_DEVMINOR
           
protected static int OFFSET_END
           
protected static int OFFSET_GID
           
protected static int OFFSET_GNAME
           
protected static int OFFSET_LINKNAME
           
protected static int OFFSET_MAGIC
           
protected static int OFFSET_MODE
           
protected static int OFFSET_MTIME
           
protected static int OFFSET_NAME
           
protected static int OFFSET_PREFIX
           
protected static int OFFSET_SIZE
           
protected static int OFFSET_TYPE
           
protected static int OFFSET_UID
           
protected static int OFFSET_UNAME
           
protected static int OFFSET_VERSION
           
protected  String propFilename
           
protected  boolean run
           
protected  boolean verbose
           
 
Constructor Summary
InstallJars()
          Constructor.
InstallJars(boolean expand, boolean verbose, boolean run, String propName, String javaParams)
          Contstructor.
 
Method Summary
protected  void copyEntry(String target, ZipInputStream zis, ZipEntry ze)
          Copy a zip entry.
 void copyStream(URLConnection conn, String target)
           
protected  String extraceFile(String name)
           
protected  char extractChar(byte[] buf, int index)
           
protected  int extractInt(byte[] buf, int index, int length)
           
protected  long extractLong(byte[] buf, int index, int length)
           
protected  String extractString(byte[] buf, int index, int length)
           
 boolean getExpand()
          Get the expand mode state.
protected  String getExtension(String name)
           
protected  String getFile(String name)
           
 String getJavaParams()
          Get the JavaParams mode state.
 String getPropFilename()
          Get the propFilename mode state.
 boolean getRunMode()
          Get the run mode state.
 boolean getVerbose()
          Get the verbose mode state.
 String install()
          Install based on a properties file
 void installClass(URLConnection conn, String target, boolean doExpand, boolean doRun)
           
 void installFile(String fileUrl, String targetPath, boolean doExpand, boolean doRun)
          Install a Zip/Jar file.
 void installGZip(URLConnection conn, String target, boolean doExpand, boolean doRun)
           
 void installJar(URLConnection conn, String target, boolean doExpand, boolean doRun)
           
 void installZip(URLConnection conn, String target, boolean doExpand, boolean doRun)
           
protected  boolean isEmptyBlock(byte[] buf, int index)
           
protected  int loadBytes(byte[] buf, GZIPInputStream zis)
           
static void main(String[] args)
          Main command line entry point.
protected  void prepDirs(String name)
           
protected  void prepDirs(String name, boolean includeLast)
           
protected  void print(String s)
           
protected static void printHelp()
          Print command help text.
protected  void println()
           
protected  void println(String s)
           
protected  void printUsage()
           
protected  void pumpGZip(String target, GZIPInputStream zis)
           
protected  String removeExtension(String name)
           
protected  String removeFile(String name)
           
protected  void runTarget(String target, boolean isJar)
           
 void setExpand(boolean f)
          Set the expand mode state.
 void setJavaParams(String p)
          Set the JavaParams mode state.
 void setPropFilename(String name)
          Set the propFilename mode state.
 void setRunMode(boolean f)
          Set the run mode state.
 void setVerbose(boolean f)
          Set the verbose mode state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_SIZE

public static final int BLOCK_SIZE
See Also:
Constant Field Values

BLOCK_COUNT

public static final int BLOCK_COUNT
See Also:
Constant Field Values

bufferSize

public static int bufferSize

verbose

protected boolean verbose

run

protected boolean run

expand

protected boolean expand

propFilename

protected String propFilename

javaParams

protected String javaParams

OFFSET_NAME

protected static final int OFFSET_NAME
See Also:
Constant Field Values

OFFSET_MODE

protected static final int OFFSET_MODE
See Also:
Constant Field Values

OFFSET_UID

protected static final int OFFSET_UID
See Also:
Constant Field Values

OFFSET_GID

protected static final int OFFSET_GID
See Also:
Constant Field Values

OFFSET_SIZE

protected static final int OFFSET_SIZE
See Also:
Constant Field Values

OFFSET_MTIME

protected static final int OFFSET_MTIME
See Also:
Constant Field Values

OFFSET_CHKSUM

protected static final int OFFSET_CHKSUM
See Also:
Constant Field Values

OFFSET_TYPE

protected static final int OFFSET_TYPE
See Also:
Constant Field Values

OFFSET_LINKNAME

protected static final int OFFSET_LINKNAME
See Also:
Constant Field Values

OFFSET_MAGIC

protected static final int OFFSET_MAGIC
See Also:
Constant Field Values

OFFSET_VERSION

protected static final int OFFSET_VERSION
See Also:
Constant Field Values

OFFSET_UNAME

protected static final int OFFSET_UNAME
See Also:
Constant Field Values

OFFSET_GNAME

protected static final int OFFSET_GNAME
See Also:
Constant Field Values

OFFSET_DEVMAJOR

protected static final int OFFSET_DEVMAJOR
See Also:
Constant Field Values

OFFSET_DEVMINOR

protected static final int OFFSET_DEVMINOR
See Also:
Constant Field Values

OFFSET_PREFIX

protected static final int OFFSET_PREFIX
See Also:
Constant Field Values

OFFSET_END

protected static final int OFFSET_END
See Also:
Constant Field Values

MAGIC

protected static final String MAGIC
See Also:
Constant Field Values
Constructor Detail

InstallJars

public InstallJars()
Constructor. Expand, run and verbose output requested.


InstallJars

public InstallJars(boolean expand,
                   boolean verbose,
                   boolean run,
                   String propName,
                   String javaParams)
Contstructor.

Parameters:
expand - true if the archive is t be expanded in the target
verbose - true if messages are to be generated
run - true if file is to be executed
propName - properties file with items to install
javaParams - java parameters
Method Detail

getVerbose

public boolean getVerbose()
Get the verbose mode state.

Returns:
is in verbose mode

setVerbose

public void setVerbose(boolean f)
Set the verbose mode state.

Parameters:
f - value

getRunMode

public boolean getRunMode()
Get the run mode state.

Returns:
is in run mode

setRunMode

public void setRunMode(boolean f)
Set the run mode state.

Parameters:
f - value

getExpand

public boolean getExpand()
Get the expand mode state.

Returns:
is expanded

setExpand

public void setExpand(boolean f)
Set the expand mode state.

Parameters:
f - value

getPropFilename

public String getPropFilename()
Get the propFilename mode state.

Returns:
prooperty file name

setPropFilename

public void setPropFilename(String name)
Set the propFilename mode state.

Parameters:
name -

getJavaParams

public String getJavaParams()
Get the JavaParams mode state.

Returns:
java parameters

setJavaParams

public void setJavaParams(String p)
Set the JavaParams mode state.

Parameters:
p - value

print

protected void print(String s)

println

protected void println(String s)

println

protected void println()

install

public String install()
               throws IOException
Install based on a properties file

Returns:
recommended classpath
Throws:
IOException - Thrown if a JAR file access error occurs

installFile

public void installFile(String fileUrl,
                        String targetPath,
                        boolean doExpand,
                        boolean doRun)
                 throws IOException
Install a Zip/Jar file.

Parameters:
fileUrl - The file/zip/jar file
targetPath - root of directory or file to install into
doExpand -
doRun -
Throws:
IOException - Thrown if a JAR file access error occurs

installClass

public void installClass(URLConnection conn,
                         String target,
                         boolean doExpand,
                         boolean doRun)
                  throws IOException
Throws:
IOException

runTarget

protected void runTarget(String target,
                         boolean isJar)
                  throws IOException
Throws:
IOException

installJar

public void installJar(URLConnection conn,
                       String target,
                       boolean doExpand,
                       boolean doRun)
                throws IOException
Throws:
IOException

installZip

public void installZip(URLConnection conn,
                       String target,
                       boolean doExpand,
                       boolean doRun)
                throws IOException
Throws:
IOException

installGZip

public void installGZip(URLConnection conn,
                        String target,
                        boolean doExpand,
                        boolean doRun)
                 throws IOException
Throws:
IOException

copyEntry

protected void copyEntry(String target,
                         ZipInputStream zis,
                         ZipEntry ze)
                  throws IOException
Copy a zip entry.

Throws:
IOException

copyStream

public void copyStream(URLConnection conn,
                       String target)
                throws IOException
Throws:
IOException

pumpGZip

protected void pumpGZip(String target,
                        GZIPInputStream zis)
                 throws IOException
Throws:
IOException

loadBytes

protected int loadBytes(byte[] buf,
                        GZIPInputStream zis)
                 throws IOException
Throws:
IOException

isEmptyBlock

protected boolean isEmptyBlock(byte[] buf,
                               int index)

extractChar

protected char extractChar(byte[] buf,
                           int index)
                    throws IOException
Throws:
IOException

extractInt

protected int extractInt(byte[] buf,
                         int index,
                         int length)
                  throws IOException
Throws:
IOException

extractLong

protected long extractLong(byte[] buf,
                           int index,
                           int length)
                    throws IOException
Throws:
IOException

extractString

protected String extractString(byte[] buf,
                               int index,
                               int length)
                        throws IOException
Throws:
IOException

getFile

protected String getFile(String name)

removeFile

protected String removeFile(String name)

removeExtension

protected String removeExtension(String name)

extraceFile

protected String extraceFile(String name)

getExtension

protected String getExtension(String name)

prepDirs

protected void prepDirs(String name)

prepDirs

protected void prepDirs(String name,
                        boolean includeLast)

printUsage

protected void printUsage()

printHelp

protected static void printHelp()
Print command help text.


main

public static void main(String[] args)
Main command line entry point.

Parameters:
args -