upl
Class upl_JarCreator

java.lang.Object
  extended by upl.upl_JarCreator

public class upl_JarCreator
extends java.lang.Object

Handles the creation of a JAR file. It generates a temporary MANIFEST file if needed, and invokes the JAR command.

Author:
Chir

Nested Class Summary
 class upl_JarCreator.JarCreatorException
          Exception subclass thrown by the createJar function.
 
Field Summary
private  java.util.Vector<java.lang.String> m_extNames
           
private  java.util.HashSet<java.lang.String> m_fileNames
           
 
Constructor Summary
upl_JarCreator()
           
 
Method Summary
 void addExtension(java.lang.String extName)
          Declares a file extension to be included in the final JAR file.
 void addFile(java.lang.String fileName)
          Declares a specific file to be included in the final JAR file.
 java.lang.String createJar(java.lang.String dirName, java.lang.String jarName, java.lang.String mainName, boolean isBean, java.lang.String classpathName, int zipLevel)
          Launches the execution of the JAR command, using the specified filenames.
private  java.lang.String generateCommandString(java.io.File f, boolean useWildcard, java.util.jar.JarOutputStream zip_out)
           
private  java.lang.String generateCommandString(java.io.File f0, java.io.File baseDirF, boolean useWildcard, java.util.jar.JarOutputStream zip_out)
           
private  java.lang.String getRelativePath(java.io.File dirF, java.io.File baseDirF)
           
private  void putNextJarEntry(java.util.jar.JarOutputStream zip_out, java.io.File f, java.lang.String zipName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_extNames

private java.util.Vector<java.lang.String> m_extNames

m_fileNames

private java.util.HashSet<java.lang.String> m_fileNames
Constructor Detail

upl_JarCreator

public upl_JarCreator()
Method Detail

addExtension

public void addExtension(java.lang.String extName)
Declares a file extension to be included in the final JAR file. All files with the given extension will later be included when generating the JAR file.

Parameters:
extName - The extension to look for (not including the dot separator).

addFile

public void addFile(java.lang.String fileName)
Declares a specific file to be included in the final JAR file.

Parameters:
fileName - The file name (not including the path).

createJar

public java.lang.String createJar(java.lang.String dirName,
                                  java.lang.String jarName,
                                  java.lang.String mainName,
                                  boolean isBean,
                                  java.lang.String classpathName,
                                  int zipLevel)
                           throws upl_JarCreator.JarCreatorException
Launches the execution of the JAR command, using the specified filenames.

Parameters:
dirName - The path where all the classes are located (root classpath of the Application to pack).
jarName - The path to the new JAR file to create.
mainName - The path to the main class (for application or beans) or NULL if none (for applets or libraries).
isBean - True if packing a Bean instead of an Application.
classpathName -
zipLevel -
Returns:
The full command-line, equivalent to the operation performed.
Throws:
upl_JarCreator.JarCreatorException

getRelativePath

private java.lang.String getRelativePath(java.io.File dirF,
                                         java.io.File baseDirF)

putNextJarEntry

private void putNextJarEntry(java.util.jar.JarOutputStream zip_out,
                             java.io.File f,
                             java.lang.String zipName)

generateCommandString

private java.lang.String generateCommandString(java.io.File f0,
                                               java.io.File baseDirF,
                                               boolean useWildcard,
                                               java.util.jar.JarOutputStream zip_out)

generateCommandString

private java.lang.String generateCommandString(java.io.File f,
                                               boolean useWildcard,
                                               java.util.jar.JarOutputStream zip_out)