|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.enhancer.util.Assertion
org.apache.jdo.impl.enhancer.util.Support
org.apache.jdo.enhancer.Main
Main is the starting point for the persistent filter tool.
Nested Class Summary | |
private class |
Main.CmdLineOptions
A class for holding the command line options. |
Field Summary | |
static int |
CLASS_LOCATOR_ERROR
|
protected ResourceLocator |
classLocator
The locator for classes. |
private ClassFileEnhancer |
enhancer
The byte code enhancer. |
private java.io.PrintWriter |
err
The stream to write error messages to. |
static int |
INTERNAL_ERROR
|
private EnhancerMetaData |
jdoMetaData
The metadata for the enhancer. |
static int |
METADATA_ERROR
|
static int |
OK
|
private Main.CmdLineOptions |
opts
The command line options. |
private java.io.PrintWriter |
out
The stream to write messages to. |
static int |
USAGE_ERROR
|
Fields inherited from class org.apache.jdo.impl.enhancer.util.Support |
timer |
Constructor Summary | |
Main()
Construct a filter tool instance |
Method Summary | |
private void |
closeInputStream(java.io.InputStream in)
Closes an input stream. |
private void |
closeOutputStream(java.io.OutputStream out)
Closes an output stream. |
private static java.lang.String |
createClassFileName(java.lang.String classname)
Creates a filename from a classname. |
private int |
createEnhancer()
|
private void |
createOutputFile(boolean enhanced,
java.lang.String filename,
java.io.File temp)
Creates the output file for an enhaced class- or zipfile. |
private static void |
createPathOfFile(java.io.File file)
Creates only the path of the given file. |
private java.io.File |
createZipOutputFile(java.lang.String zipfilename)
Creates a file object that represents the output zipfile for a given zipfile to enhance. |
private void |
enhanceClassFile(java.io.InputStream in)
Enhances a classfile. |
private int |
enhanceInputFiles(java.util.List classNames,
java.util.List classFileNames,
java.util.List zipFileNames,
java.util.List jdoFileNames)
Enhances all files entered in the command line. |
private void |
enhanceZipFile(java.lang.String filename)
Enhances a zipfile. |
private int |
initClassLocator()
|
private int |
initEnhancerMetaData()
|
private static boolean |
isClassFileName(java.lang.String filename)
Tests if a filename is a classfile name (by testing if the filename ends with ".class" ). |
private static boolean |
isJdoFileName(java.lang.String filename)
Tests if a filename is a jdo file name (by testing if the filename ends with ".jdo" ). |
private static boolean |
isZipFileName(java.lang.String filename)
Tests if a filename is a zipfile (by testing if the filename ends with ".zip" or ".jar" ). |
static void |
main(java.lang.String[] argv)
This is where it all starts. |
private java.io.InputStream |
openClassInputStream(java.lang.String classname)
Opens an input stream for the given classname. |
private static java.io.InputStream |
openFileInputStream(java.lang.String filename)
Opens an input stream for the given filename |
private void |
printError(java.lang.String msg,
java.lang.Throwable ex)
Prints out an error. |
private void |
printMessage(java.lang.String msg)
Prints out a message. |
int |
process(java.lang.String[] argv)
Process command line options and run enhancer. |
Methods inherited from class org.apache.jdo.impl.enhancer.util.Support |
getI18N, getI18N, getI18N, getI18N, getI18N, getI18N |
Methods inherited from class org.apache.jdo.impl.enhancer.util.Assertion |
affirm, affirm, affirm, affirm |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OK
public static final int USAGE_ERROR
public static final int METADATA_ERROR
public static final int CLASS_LOCATOR_ERROR
public static final int INTERNAL_ERROR
private final java.io.PrintWriter out
private final java.io.PrintWriter err
private final Main.CmdLineOptions opts
private ClassFileEnhancer enhancer
protected ResourceLocator classLocator
private EnhancerMetaData jdoMetaData
Constructor Detail |
public Main()
Method Detail |
public static void main(java.lang.String[] argv)
public int process(java.lang.String[] argv)
private int initClassLocator()
private int initEnhancerMetaData()
private int createEnhancer()
private int enhanceInputFiles(java.util.List classNames, java.util.List classFileNames, java.util.List zipFileNames, java.util.List jdoFileNames)
classNames
- List of class names.classFileNames
- List of class file names.zipFileNames
- List of zip file names.jdoFileNames
- List of jdo file names.private void enhanceClassFile(java.io.InputStream in) throws java.io.IOException, EnhancerUserException, EnhancerFatalError
in
- The input stream of the classfile.
java.io.IOException
EnhancerUserException
EnhancerFatalError
private void enhanceZipFile(java.lang.String filename) throws java.io.IOException, EnhancerUserException, EnhancerFatalError
filename
- The filename of the zipfile.
java.io.IOException
EnhancerUserException
EnhancerFatalError
private static java.io.InputStream openFileInputStream(java.lang.String filename) throws java.io.FileNotFoundException
filename
- The name of the file.
java.io.FileNotFoundException
- If the file could not be found.private java.io.InputStream openClassInputStream(java.lang.String classname) throws java.io.IOException
classname
- The name of the class (dot-notation).
java.io.IOException
- If an I/O error occured.private java.io.File createZipOutputFile(java.lang.String zipfilename)
zipfilename
- The input zipfile name.
private void createOutputFile(boolean enhanced, java.lang.String filename, java.io.File temp) throws java.io.IOException
enhanced
- Has the input file been enhanced?filename
- The name of the output file.temp
- The temp file, the output is written to.
java.io.IOException
- If the file could not be created.private void closeInputStream(java.io.InputStream in)
in
- The input stream.private void closeOutputStream(java.io.OutputStream out)
out
- The output stream.private static boolean isClassFileName(java.lang.String filename)
".class"
).
filename
- The name of the file.
private static boolean isZipFileName(java.lang.String filename)
".zip"
or ".jar"
).
filename
- The name of the file.private static boolean isJdoFileName(java.lang.String filename)
".jdo"
).
filename
- The name of the file.
private static java.lang.String createClassFileName(java.lang.String classname)
'.'
by '/'
.
classname
- The classname.
private static void createPathOfFile(java.io.File file) throws java.io.IOException
file
- The file.
java.io.IOException
- If an error occured.private void printError(java.lang.String msg, java.lang.Throwable ex)
msg
- The error message (can be null
).ex
- An optional exception (can be null
).private void printMessage(java.lang.String msg)
msg
- The message.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |