org.apache.jdo.impl.enhancer
Class ClassArgMain

java.lang.Object
  extended by org.apache.jdo.impl.enhancer.util.Assertion
      extended by org.apache.jdo.impl.enhancer.util.Support
          extended by org.apache.jdo.impl.enhancer.GenericMain
              extended by org.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  java.io.PrintWriter err
          The stream to write error messages to.
protected  ClassArgOptions options
          The options and arguments.
protected  java.io.PrintWriter out
          The stream to write messages to.
 
Fields inherited from class org.apache.jdo.impl.enhancer.GenericMain
INTERNAL_ERROR, OK, 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  void flush()
          Flushes streams.
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
protected  void print(java.lang.String msg)
          Prints out a message.
protected  void println()
          Prints out a message.
protected  void println(java.lang.String msg)
          Prints out a message.
protected  void printlnErr()
          Prints out an error message.
protected  void printlnErr(java.lang.String msg)
          Prints out an error message.
protected  void printlnErr(java.lang.String msg, java.lang.Throwable ex)
          Prints out an error message.
protected  void printlnErr(java.lang.String msg, java.lang.Throwable ex, boolean verbose)
          Prints out an error message.
 
Methods inherited from class org.apache.jdo.impl.enhancer.GenericMain
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.


out

protected final java.io.PrintWriter out
The stream to write messages to.


err

protected final java.io.PrintWriter err
The stream to write error messages to.

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


printlnErr

protected void printlnErr(java.lang.String msg,
                          java.lang.Throwable ex,
                          boolean verbose)
Prints out an error message.


printlnErr

protected void printlnErr(java.lang.String msg,
                          java.lang.Throwable ex)
Prints out an error message.


printlnErr

protected void printlnErr(java.lang.String msg)
Prints out an error message.


printlnErr

protected void printlnErr()
Prints out an error message.


print

protected void print(java.lang.String msg)
Prints out a message.


println

protected void println(java.lang.String msg)
Prints out a message.


println

protected void println()
Prints out a message.


flush

protected void flush()
Flushes streams.



Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.