org.apache.jdo.impl.enhancer
Class ClassArgMain

java.lang.Object
  extended byorg.apache.jdo.impl.enhancer.util.Assertion
      extended byorg.apache.jdo.impl.enhancer.util.Support
          extended byorg.apache.jdo.impl.enhancer.LogSupport
              extended byorg.apache.jdo.impl.enhancer.GenericMain
                  extended byorg.apache.jdo.impl.enhancer.ClassArgMain
Direct Known Subclasses:
Disassembler, JdoMetaMain

public class ClassArgMain
extends GenericMain

Base class for JDO command line enhancer and tests.

Author:
Martin Zaun

Field Summary
protected  PathResourceLocator classes
          The locator for classes.
protected  ClassArgOptions options
          The options and arguments.
 
Fields inherited from class org.apache.jdo.impl.enhancer.GenericMain
err, INTERNAL_ERROR, OK, out, USAGE_ERROR, USER_EXCEPTION
 
Fields inherited from class org.apache.jdo.impl.enhancer.util.Support
timer
 
Constructor Summary
ClassArgMain(java.io.PrintWriter out, java.io.PrintWriter err)
          Creates an instance.
ClassArgMain(java.io.PrintWriter out, java.io.PrintWriter err, ClassArgOptions options)
          Creates an instance.
 
Method Summary
protected  void closeInputStream(java.io.InputStream in)
          Closes an input stream.
protected static java.lang.String getClassFileName(java.lang.String className)
          Returns the file name for a class name.
protected  void init()
          Initializes all components.
protected  void initClassLocator()
          Initializes the class locator.
static void main(java.lang.String[] args)
          Runs this class
protected  java.io.InputStream openClassInputStream(java.lang.String className)
          Opens an input stream for the given classname.
protected  java.io.InputStream openFileInputStream(java.lang.String fileName)
          Opens an input stream for the given filename
 
Methods inherited from class org.apache.jdo.impl.enhancer.GenericMain
flush, print, println, println, printlnErr, printlnErr, printlnErr, printlnErr, process, run
 
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

options

protected ClassArgOptions options
The options and arguments.


classes

protected PathResourceLocator classes
The locator for classes.

Constructor Detail

ClassArgMain

public ClassArgMain(java.io.PrintWriter out,
                    java.io.PrintWriter err)
Creates an instance.


ClassArgMain

public ClassArgMain(java.io.PrintWriter out,
                    java.io.PrintWriter err,
                    ClassArgOptions options)
Creates an instance.

Method Detail

initClassLocator

protected void initClassLocator()
                         throws java.io.IOException
Initializes the class locator.

Throws:
java.io.IOException

init

protected void init()
             throws EnhancerFatalError,
                    EnhancerUserException
Initializes all components.

Overrides:
init in class GenericMain
Throws:
EnhancerFatalError
EnhancerUserException

getClassFileName

protected static java.lang.String getClassFileName(java.lang.String className)
Returns the file name for a class name. This is done by replacing '.' by '/'.

Parameters:
className - the classname
Returns:
the filename

openFileInputStream

protected java.io.InputStream openFileInputStream(java.lang.String fileName)
                                           throws java.io.FileNotFoundException
Opens an input stream for the given filename

Parameters:
fileName - the name of the file
Returns:
the input stream
Throws:
java.io.FileNotFoundException - if the file could not be found

openClassInputStream

protected java.io.InputStream openClassInputStream(java.lang.String className)
                                            throws java.io.IOException
Opens an input stream for the given classname. The input stream is created via an URL that is obtained by the value of the sourcepath option and zip/jar file arguments.

Parameters:
className - the name of the class (dot-notation)
Returns:
the input stream
Throws:
java.io.IOException - if an I/O error occured

closeInputStream

protected void closeInputStream(java.io.InputStream in)
Closes an input stream.

Parameters:
in - the input stream

main

public static void main(java.lang.String[] args)
Runs this class