com.triactive.jdo.enhance
Class Enhancer

java.lang.Object
  extended bycom.triactive.jdo.enhance.Enhancer
Direct Known Subclasses:
ReferenceEnhancer

public abstract class Enhancer
extends java.lang.Object

Abstract class for JDO bytecode enhancement utility. The expected command-line syntax is:

java com.triactive.jdo.enhance.Enhancer JDO-metadata-filename ...
Every class listed in the given metadata file(s) should be made persistence capable via bytecode enhancement. This class must be subclassed with an implementation that uses a working bytecode enhancer. The key method that needs to be overridden and implemented is callExternalEnhancer(String[]).


Constructor Summary
protected Enhancer()
          Protected constructor to prevent outside instantiation.
 
Method Summary
protected abstract  int callExternalEnhancer(java.lang.String[] classNames)
          Called by enhance() to enhance a list of classes.
protected  int enhance(java.util.List classNames)
           
protected static java.util.List getOrderedClassNames(java.lang.String[] metaDataFileNames)
          Returns a list of all classes declared in the given metadata files, ordered such that all superclasses occur before their subclasses.
static void main(java.lang.String[] args)
          Called when Enhancer is invoked from the command line.
protected static void printList(java.io.File file, java.util.List list)
          Prints a list of objects to a file, one per line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Enhancer

protected Enhancer()
Protected constructor to prevent outside instantiation.

Method Detail

enhance

protected int enhance(java.util.List classNames)
               throws java.lang.Exception
Throws:
java.lang.Exception

callExternalEnhancer

protected abstract int callExternalEnhancer(java.lang.String[] classNames)
                                     throws java.lang.Exception
Called by enhance() to enhance a list of classes. Subclasses implement this method to invoke the 3rd-party class enhancer.

Parameters:
classNames - The list of class names to be enhanced
Throws:
java.lang.Exception

getOrderedClassNames

protected static java.util.List getOrderedClassNames(java.lang.String[] metaDataFileNames)
                                              throws java.io.IOException,
                                                     javax.xml.parsers.ParserConfigurationException,
                                                     org.xml.sax.SAXException
Returns a list of all classes declared in the given metadata files, ordered such that all superclasses occur before their subclasses.

Parameters:
metaDataFileNames - The list of JDO metadata file names.
Returns:
An ordered list of class name strings.
Throws:
java.io.IOException - If any I/O error occurs.
ParserConfigurationXException - If an XML document builder cannot be created.
org.xml.sax.SAXException - If any parse error occurs.
javax.xml.parsers.ParserConfigurationException

printList

protected static void printList(java.io.File file,
                                java.util.List list)
                         throws java.io.IOException
Prints a list of objects to a file, one per line.

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Called when Enhancer is invoked from the command line. This is intended to provide useful enhancement-related functions that are common no matter which underlying enhancer is being used.

The argument list consists of options and a list of JDO metadata files (*.jdo files).

Options

-l filename
Produce a list of all classes declared in the given metadata files, ordered such that all superclasses occur before their subclasses. If filename is - the list is written to System.out.

Parameters:
args - A list of options and JDO metadata files (*.jdo files).
Throws:
java.lang.Exception


Copyright 2001-2007 The TJDO Project All Rights Reserved.