db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r171351 [1/16] - in /incubator/jdo/trunk/enhancer20: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/enhancer/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/enhancer/ src/java/org/apache/jdo/impl/enhancer/classfile/ src/java/org/apache/jdo/impl/enhancer/core/ src/java/org/apache/jdo/impl/enhancer/generator/ src/java/org/apache/jdo/impl/enhancer/meta/ src/java/org/apache/jdo/impl/enhancer/meta/model/ src/java/org/apache/jdo/impl/enhancer/meta/prop/ src/java/org/apache/jdo/impl/enhancer/meta/util/ src/java/org/apache/jdo/impl/enhancer/util/ test/ test/sempdept/ test/sempdept/src/ test/sempdept/src/empdept/
Date Sun, 22 May 2005 17:55:54 GMT
Author: mbo
Date: Sun May 22 10:55:51 2005
New Revision: 171351

URL: http://svn.apache.org/viewcvs?rev=171351&view=rev
Log:
First version of JDO2 implementation (Enhancere). It includes the implementation of the byte code enhancer.

Added:
    incubator/jdo/trunk/enhancer20/
    incubator/jdo/trunk/enhancer20/maven.xml
    incubator/jdo/trunk/enhancer20/project.properties
    incubator/jdo/trunk/enhancer20/project.xml
    incubator/jdo/trunk/enhancer20/src/
    incubator/jdo/trunk/enhancer20/src/conf/
    incubator/jdo/trunk/enhancer20/src/conf/commons-logging.properties
    incubator/jdo/trunk/enhancer20/src/conf/logging.properties
    incubator/jdo/trunk/enhancer20/src/conf/simplelog.properties
    incubator/jdo/trunk/enhancer20/src/java/
    incubator/jdo/trunk/enhancer20/src/java/org/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/EnhancerMain.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/Main.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/package.html
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/Bundle.properties
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/ClassArgMain.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/ClassArgOptions.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/ClassFileEnhancer.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/ClassFileEnhancerHelper.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/ClassFileEnhancerTimer.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/EnhancerClassLoader.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/EnhancerFatalError.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/EnhancerOptions.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/EnhancerUserException.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/GenericMain.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/GenericOptions.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/JdoMetaMain.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/JdoMetaOptions.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/LogSupport.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/OptionSet.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/OutputStreamWrapper.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/PersistenceLauncher.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/AnnotatedClassAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/AnnotatedMethodAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/AttributeVector.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassField.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassFile.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassMember.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassMethod.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ClassPrint.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/CodeAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/CodeEnv.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstBasic.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstBasicMemberRef.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstClass.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstDouble.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstFieldRef.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstFloat.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstInteger.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstInterfaceMethodRef.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstLong.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstMethodRef.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstNameAndType.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstString.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstUnicode.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstUtf8.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstValue.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstantPool.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ConstantValueAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/Descriptor.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ExceptionRange.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ExceptionTable.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/ExceptionsAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/GenericAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/Insn.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnConstOp.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnError.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnIInc.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnIntOp.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnInterfaceInvoke.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnLookupSwitch.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnMultiDimArrayNew.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnReadEnv.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnSingle.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnTableSwitch.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnTarget.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnTargetOp.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/InsnUtils.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/LineNumberTableAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/LocalVariable.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/LocalVariableTableAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/SourceFileAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/SyntheticAttribute.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMConstants.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMOp.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Analyzer.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Annotater.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Augmenter.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Builder.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Controller.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/EnhancerConstants.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/EnhancerFilter.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/core/Environment.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/generator/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/generator/CodeWriter.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/generator/ImplHelper.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/generator/Main.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/generator/NameHelper.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/EnhancerMetaData.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/EnhancerMetaDataFatalError.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/EnhancerMetaDataUserException.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/ExtendedMetaData.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/model/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerJavaModel.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerJavaType.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/model/EnhancerMetaDataJDOModelImpl.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/EnhancerMetaDataPropertyImpl.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/JDOClass.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/JDOField.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/MetaDataProperties.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/prop/NameHelper.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/util/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/util/EnhancerMetaDataBaseModel.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/meta/util/EnhancerMetaDataTimer.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/AnnotationTest.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/Assertion.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/AugmentationDiffTest.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/AugmentationTest.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/CombinedResourceLocator.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/Disassembler.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/InternalError.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/ListResourceLocator.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/PathResourceLocator.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/ResourceLocator.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/ResourceLocatorBase.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/ResourceLocatorTimer.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/Support.java
    incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/util/Timer.java
    incubator/jdo/trunk/enhancer20/test/
    incubator/jdo/trunk/enhancer20/test/common.xml
    incubator/jdo/trunk/enhancer20/test/sempdept/
    incubator/jdo/trunk/enhancer20/test/sempdept/build.xml
    incubator/jdo/trunk/enhancer20/test/sempdept/src/
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept.jdoproperties
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/Department.java
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/Employee.java
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/FullTimeEmployee.java
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/PartTimeEmployee.java
    incubator/jdo/trunk/enhancer20/test/sempdept/src/empdept/package.jdo

Added: incubator/jdo/trunk/enhancer20/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/maven.xml?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/maven.xml (added)
+++ incubator/jdo/trunk/enhancer20/maven.xml Sun May 22 10:55:51 2005
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2005 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project default="default"
+    xmlns:j="jelly:core"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven"
+    >
+
+    <!-- ==================== -->
+    <!-- Default Global Goals -->
+    <!-- ==================== -->
+
+    <goal name="default">
+        <attainGoal name="jar:install-snapshot"/>
+    </goal>
+
+    <goal name="build">
+        <attainGoal name="default"/>
+    </goal>
+
+    <goal name="rebuild">
+        <attainGoal name="clean"/>
+        <attainGoal name="build"/>
+    </goal>
+
+    <postGoal name="clean:clean">
+        <ant dir="${basedir}/test/sempdept" target="clean" inheritAll="false"/>
+    </postGoal>
+
+    <goal name="clobber" prereqs="clean">
+        <delete>
+            <fileset dir="." defaultexcludes="no" includes="**/*~"/>
+        </delete>
+        <ant dir="${basedir}/test/sempdept" target="mrproper" inheritAll="false"/>
+    </goal>
+
+    <!-- ================== -->
+    <!-- Running test cases -->
+    <!-- ================== -->
+
+    <goal name="runtest">
+        <attainGoal name="Generator"/>
+        <attainGoal name="Enhancer"/>
+    </goal>
+
+    <!-- Generator tests 
+    -->
+    
+    <goal name="Generator">
+      <ant dir="${basedir}/test/sempdept" antfile="build.xml" target="all_gen" inheritAll="false">
+        <property name="jdoapi" value="${jdo.jdoapi.jarfile}"/>
+        <property name="jdocore" value="${jdo.jdocore.jarfile}"/>
+        <property name="jdoenhancer" value="${maven.build.dir}/classes"/>
+        <property name="logging" value="${logging.jarfile}"/>
+        <property name="xmlparser" value="${xmlparser}"/>
+        <property name="verbose" value="${verbose}"/>
+      </ant>
+    </goal>
+    
+    <!-- Enhancer tests 
+    -->
+    
+    <goal name="Enhancer">
+      <ant dir="${basedir}/test/sempdept" antfile="build.xml" target="compile" inheritAll="false">
+        <property name="jdoapi" value="${jdo.jdoapi.jarfile}"/>
+        <property name="jdocore" value="${jdo.jdocore.jarfile}"/>
+        <property name="jdoenhancer" value="${maven.build.dir}/classes"/>
+        <property name="logging" value="${logging.jarfile}"/>
+        <property name="xmlparser" value="${xmlparser}"/>
+        <property name="verbose" value="${verbose}"/>
+      </ant>
+      <ant dir="${basedir}/test/sempdept" antfile="build.xml" target="all_enh" inheritAll="false">
+        <property name="jdoapi" value="${jdo.jdoapi.jarfile}"/>
+        <property name="jdocore" value="${jdo.jdocore.jarfile}"/>
+        <property name="jdoenhancer" value="${maven.build.dir}/classes"/>
+        <property name="logging" value="${logging.jarfile}"/>
+        <property name="xmlparser" value="${xmlparser}"/>
+        <property name="verbose" value="${verbose}"/>
+      </ant>
+    </goal>
+    
+</project>

Added: incubator/jdo/trunk/enhancer20/project.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/project.properties?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/project.properties (added)
+++ incubator/jdo/trunk/enhancer20/project.properties Sun May 22 10:55:51 2005
@@ -0,0 +1,37 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at 
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+
+# checkstyle settings
+maven.checkstyle.properties = ${basedir}/../jdo_checks.xml
+
+# dependencies
+jdo.jdoapi.jarfile = ${pom.getDependencyPath('apache-jdo:jdo1-api')}
+jdo.jdocore.jarfile = ${pom.getDependencyPath('apache-jdo:jdo2-core')}
+logging.jarfile = ${pom.getDependencyPath('commons-logging')}
+xmlparser = 
+
+# enhancer 
+jdo.enhancer.enhanced.dir = ${maven.build.dir}/test-classes
+jdo.enhancer.main = org.apache.jdo.enhancer.Main
+jdo.enhancer.options = -f -d "${jdo.enhancer.enhanced.dir}" -s "${jdo.enhancer.sourcepath}"
+jdo.enhancer.sourcepath = ${maven.build.dir}/test-classes${path.separator}${jdo.jdoapi.jarfile}
+jdo.enhancer.classpath = ${maven.build.dir}/classes${path.separator}${jdo.jdocore.jarfile}${path.separator}${jdo.jdoapi.jarfile}${path.separator}${logging.jarfile}
+jdo.annotationtest.main = org.apache.jdo.impl.enhancer.util.AnnotationTest
+jdo.annotationtest.options = -s "${jdo.enhancer.enhanced.dir}${path.separator}${jdo.enhancer.sourcepath}"
+jdo.augmentationtest.main = org.apache.jdo.impl.enhancer.util.AugmentationTest
+jdo.augmentationtest.options = -s "${jdo.enhancer.enhanced.dir}${path.separator}${jdo.enhancer.sourcepath}"
+jdo.xmlexists.main = org.apache.jdo.impl.model.jdo.xml.XMLExists
+jdo.xmlexists.classpath = ${maven.build.dir}/test-classes${path.separator}${path.separator}${jdo.jdocore.jarfile}${path.separator}${jdo.jdoapi.jarfile}${path.separator}${logging.jarfile}
+

Added: incubator/jdo/trunk/enhancer20/project.xml
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/project.xml?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/project.xml (added)
+++ incubator/jdo/trunk/enhancer20/project.xml Sun May 22 10:55:51 2005
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2005 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../project.xml</extend>
+    <!-- ============== -->
+    <!-- Identification -->
+    <!-- ============== -->
+    <name>JDO2 Implementation (Enhancer)</name>
+    <artifactId>jdo2-enhancer</artifactId>
+    <currentVersion>2.0</currentVersion>
+    <package>org.apache.jdo</package>
+    <shortDescription>Java Data Object 2.0 (JDO) Enhancer</shortDescription>
+    <description>The Java Data Objects 2.0 (JDO) API is a standard interface-based 
+Java model abstraction of persistence, developed as Java Specification 
+Request JSR 243 under the auspices of the Java Community Process.</description>
+    <repository />
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+    <dependencies>
+        <dependency>
+            <groupId>apache-jdo</groupId>
+            <artifactId>jdo1-api</artifactId>
+            <version>SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>apache-jdo</groupId>
+            <artifactId>jdo2-core</artifactId>
+            <version>SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <id>commons-logging</id>
+            <version>1.0.4</version>
+        </dependency>
+    </dependencies>
+    <!-- =================== -->
+    <!-- Build Specification -->
+    <!-- =================== -->
+    <build>
+        <sourceDirectory>src/java</sourceDirectory>
+        <!-- J A R  R E S O U R C E S -->
+        <!-- Resources that are packaged up inside the JAR file -->
+        <resources>
+            <resource>
+                <directory>${basedir}/src/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+</project>
+

Added: incubator/jdo/trunk/enhancer20/src/conf/commons-logging.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/conf/commons-logging.properties?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/conf/commons-logging.properties (added)
+++ incubator/jdo/trunk/enhancer20/src/conf/commons-logging.properties Sun May 22 10:55:51 2005
@@ -0,0 +1,38 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at 
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+
+#
+# This is a sample apache commons logging configuration file defining logging
+# properties for the JDO2 Implementation (Enhancer) sources. It defines what
+# logging implementation the apache commons logging API should use by specifying
+# the property org.apache.commons.logging.Log (see below). Please note, that
+# there are separate property files for each logging implementation to set the
+# log level of the loggers:
+# - SimpleLog:      simplelog.properties 
+# - JDK1.4 logging: logging.properties
+#
+# The JDO2 Implementation (Enhancer) sources use the following logger instances:
+# Dependent projects:
+# org.apache.jdo.util                 Utility classes
+# org.apache.jdo.impl.model.jdo       JDOModel implementation
+# org.apache.jdo.impl.model.jdo.xml   XML parser for JDO metadata files
+#
+
+# Uncomment the next line if you want to use the apache simple logger
+#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
+
+# Uncomment the next two lines if you want to use JDK 1.4 logging
+#org.apache.commons.logging.Log = org.apache.jdo.util.JDOJdk14Logger
+

Added: incubator/jdo/trunk/enhancer20/src/conf/logging.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/conf/logging.properties?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/conf/logging.properties (added)
+++ incubator/jdo/trunk/enhancer20/src/conf/logging.properties Sun May 22 10:55:51 2005
@@ -0,0 +1,53 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at 
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+
+#
+# This is a sample properties file to configure standard JDK 1.4 logging for 
+# the JDO2 Implementation (Enhancer) sources. 
+# Below you find an entry for each of the source logger instances. 
+# Please uncomment the line and adapt the log level to your needs, 
+# in case to want to enable a particular logger.
+#
+# The following describes the mapping between the log level of JDK 1.4 logging
+# and apache commns logging:
+#   JDK 1.4        Apache 
+#   FINEST         trace 
+#   FINE, FINER    debug 
+#   INFO, CONFIG   info
+#   WARNING        warn
+#   SEVERE         error, fatal
+#
+
+######################
+# Enhancer source logger
+######################
+
+######################
+# Dependent projects
+######################
+
+# Utility class logger
+#org.apache.jdo.util.level = FINE
+# JDOModel logger
+#org.apache.jdo.impl.model.jdo.level = FINE
+# XML parser logger
+#org.apache.jdo.impl.model.jdo.xml.level = FINE
+
+######################
+# JDK 1.4 logging properties
+######################
+
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = FINEST

Added: incubator/jdo/trunk/enhancer20/src/conf/simplelog.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/conf/simplelog.properties?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/conf/simplelog.properties (added)
+++ incubator/jdo/trunk/enhancer20/src/conf/simplelog.properties Sun May 22 10:55:51 2005
@@ -0,0 +1,43 @@
+#
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at 
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software 
+# distributed under the License is distributed on an "AS IS" BASIS, 
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+# See the License for the specific language governing permissions and 
+# limitations under the License.
+
+#
+# This is a sample properties file to configure apache commons logging SimpleLog
+# implementation for the JDO2 Implementation (Enhancer) sources. 
+# Below you find an entry for each of the source logger instances. 
+# Please uncomment the line and adapt the log level to your needs, 
+# in case to want to enable a particular logger.
+#
+
+######################
+# Enhancer source logger
+######################
+
+######################
+# Dependent projects
+######################
+
+# Utility class logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.util = debug
+# JDOModel logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo = debug
+# XML parser logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo.xml = debug
+
+######################
+# Default logging level
+######################
+
+org.apache.commons.logging.simplelog.defaultlog = error

Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/EnhancerMain.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/EnhancerMain.java?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/EnhancerMain.java (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/EnhancerMain.java Sun May 22 10:55:51 2005
@@ -0,0 +1,387 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.enhancer;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.PrintWriter;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.Properties;
+
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.jdo.impl.enhancer.ClassFileEnhancer;
+import org.apache.jdo.impl.enhancer.ClassFileEnhancerHelper;
+import org.apache.jdo.impl.enhancer.ClassFileEnhancerTimer;
+import org.apache.jdo.impl.enhancer.EnhancerFatalError;
+import org.apache.jdo.impl.enhancer.EnhancerOptions;
+import org.apache.jdo.impl.enhancer.EnhancerUserException;
+import org.apache.jdo.impl.enhancer.JdoMetaMain;
+import org.apache.jdo.impl.enhancer.OutputStreamWrapper;
+import org.apache.jdo.impl.enhancer.core.EnhancerFilter;
+
+
+
+/**
+ * JDO command line enhancer.
+ *
+ * @author Martin Zaun
+ */
+public class EnhancerMain
+    extends JdoMetaMain
+{
+    /**
+     *  The options and arguments.
+     */
+    protected EnhancerOptions options;
+
+    /**
+     *  The byte code enhancer.
+     */
+    protected ClassFileEnhancer enhancer;
+
+    /**
+     * Creates an instance.
+     */
+    public EnhancerMain(PrintWriter out,
+                        PrintWriter err)
+    {
+        this(out, err, new EnhancerOptions(out, err));
+    }
+
+    /**
+     * Creates an instance.
+     */
+    public EnhancerMain(PrintWriter out,
+                        PrintWriter err,
+                        EnhancerOptions options)
+    {
+        super(out, err, options);
+        this.options = options;
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     * Enhances all files entered in the command line.
+     *
+     * @param  classNames  List of class names.
+     * @param  classFileNames  List of class file names.
+     * @param  archiveFileNames  List of archive file names.
+     */
+    private int enhanceInputFiles(List classNames,
+                                  List classFileNames,
+                                  List archiveFileNames)
+    {
+        int res = 0;
+        try {
+            String name = null;
+            for (Iterator i = archiveFileNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceArchiveFile(name);
+                } catch (EnhancerUserException ex) {
+                    printlnErr("Error while enhancing " + name, ex, 
+                               options.verbose.value);
+                    res++;
+                    continue;
+                }
+            }
+            for (Iterator i = classFileNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceClassFile(openFileInputStream(name));
+                } catch (EnhancerUserException ex) {
+                    printlnErr("Error while enhancing " + name, ex, 
+                               options.verbose.value);
+                    res++;
+                    continue;
+                }
+            }
+            for (Iterator i = classNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceClassFile(openClassInputStream(name));
+                } catch (EnhancerUserException ex) {
+                    printlnErr("Error while enhancing " + name, ex, 
+                               options.verbose.value);
+                    res++;
+                    continue;
+                }
+            }
+        } catch (IOException ex) {
+            printlnErr("IO Error while enhancing", ex, options.verbose.value);
+            return ++res;
+        } catch (EnhancerFatalError ex) {
+            // enhancer is not anymore guaranteed to be consistent
+            printlnErr("Fatal error while enhancing", ex, options.verbose.value);
+            enhancer = null;
+            return ++res;
+        }
+        return res;
+    }
+
+    /**
+     * Enhances a classfile.
+     *
+     * @param  in  The input stream of the classfile.
+     */
+    private void enhanceClassFile(InputStream in)
+        throws IOException, EnhancerUserException, EnhancerFatalError
+    {
+        OutputStream out = null;
+        try {
+            final File temp = File.createTempFile("enhancer", ".class");
+            out = new BufferedOutputStream(new FileOutputStream(temp));
+
+            //enhance
+            final OutputStreamWrapper wrapper = new OutputStreamWrapper(out);
+            final boolean enhanced = enhancer.enhanceClassFile(in, wrapper);
+
+            closeOutputStream(out);
+            out = null;
+            createOutputFile(enhanced,
+                             getClassFileName(wrapper.getClassName()), temp);
+        } finally {
+            closeInputStream(in);
+            closeOutputStream(out);
+        }
+    }
+
+    /**
+     * Enhances a archive file.
+     *
+     * @param  fileName  The filename of the archive file.
+     */
+    private void enhanceArchiveFile(String fileName)
+        throws IOException, EnhancerUserException, EnhancerFatalError
+    {
+        ZipInputStream in = null;
+        ZipOutputStream out = null;
+        try {
+            final File temp = File.createTempFile("enhancer", ".zip");
+            in = new ZipInputStream(new BufferedInputStream(
+                new FileInputStream(new File(fileName))));
+            out = new ZipOutputStream(new BufferedOutputStream(
+                new FileOutputStream(temp)));
+
+            // enhance the archive file
+            final boolean enhanced
+                = ClassFileEnhancerHelper.enhanceZipFile(enhancer, in, out);
+
+            // create the output file
+            closeOutputStream(out);
+            out = null;
+            createOutputFile(enhanced, new File(fileName).getName(), temp);
+        } finally {
+            closeOutputStream(out);
+            closeInputStream(in);
+        }
+    }
+
+    /**
+     * Creates a file object that represents the output archive file for
+     * a given archive file to enhance.
+     *
+     * @param  archiveFileName  the input archive file name
+     * @return  the output archive file
+     */
+    private File createArchiveOutputFile(String archiveFileName)
+    {
+        return new File(options.destDir.value,
+                        new File(archiveFileName).getName());
+    }
+
+    /**
+     * Creates the output file for an enhanced class- or archive file. If the
+     * enhanced file is written back depends on the command line options.
+     *
+     * @param  enhanced  Has the input file been enhanced?
+     * @param  fileName  The name of the output file.
+     * @param  temp      The temp file, the output is written to.
+     * @exception  IOException  If the file could not be created.
+     */
+    private void createOutputFile(boolean enhanced,
+                                  String fileName,
+                                  File temp)
+        throws IOException
+    {
+        //noWrite or (not enhanced and not forceWrite)
+        if (options.noWrite.value
+            || (!enhanced && !options.forceWrite.value)) {
+            temp.deleteOnExit();
+            return;
+        }
+
+        // create file and its parent directory
+        final File file = new File(options.destDir.value, fileName);
+        final File dir = file.getAbsoluteFile().getParentFile();
+        if (!dir.exists() && !dir.mkdirs()) {
+            throw new IOException("Error creating directory '"
+                                  + dir.getAbsolutePath() + "'.");
+        }
+
+        file.delete();  //delete old file if exists
+        boolean renamed = temp.renameTo(file);
+        if (!renamed) {
+            //@dave: empirical evidence shows that renameTo does not allow for
+            // crossing filesystem boundaries.  If it fails, try "by hand".
+            InputStream in = null;
+            OutputStream out = null;
+            try {
+                in = new FileInputStream(temp);
+                out = new FileOutputStream(file);
+                int PAGESIZE = 4096; // Suggest a better size?
+                byte data[] = new byte[PAGESIZE];
+                while (in.available() > 0) {
+                    int numRead = in.read(data, 0, PAGESIZE);
+                    out.write(data, 0, numRead);
+                }
+                renamed = true;
+            } catch (IOException ex) {
+                throw new IOException("Could not rename temp file '" +
+                                      temp.getAbsolutePath() +
+                                      "' to '" + file.getAbsolutePath()
+                                      + "': " + ex);
+            } finally {
+                closeInputStream(in);
+                closeOutputStream(out);
+            }
+            if (renamed) {
+                temp.delete();  //delete temporary file
+            }
+            else {
+                throw new IOException("Could not rename temp file '" +
+                                      temp.getAbsolutePath() +
+                                      "' to '" + file.getAbsolutePath() + "'.");
+            }
+        }
+    }
+
+    /**
+     * Closes an output stream.
+     *
+     * @param  out  the output stream
+     */
+    private void closeOutputStream(OutputStream out)
+    {
+        if (out != null) {
+            try {
+                out.close();
+            } catch (IOException ex) {
+                printlnErr("", ex, options.verbose.value);
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     * Initializes all components.
+     */
+    protected void init()
+        throws EnhancerFatalError, EnhancerUserException
+    {
+        super.init();
+
+        final Properties props = new Properties();
+        if (options.verbose.value) {
+            props.put(EnhancerFilter.VERBOSE_LEVEL,
+                      EnhancerFilter.VERBOSE_LEVEL_VERBOSE);
+        }
+        
+        if (options.doTiming.value) {
+            props.put(EnhancerFilter.DO_TIMING_STATISTICS,
+                      Boolean.TRUE.toString());
+        }
+
+        if (options.dumpClass.value) {
+            props.put(EnhancerFilter.DUMP_CLASS,
+                      Boolean.TRUE.toString());
+        }
+
+        if (options.noAugment.value) {
+            props.put(EnhancerFilter.NO_AUGMENT,
+                      Boolean.TRUE.toString());
+        }
+
+        if (options.noAnnotate.value) {
+            props.put(EnhancerFilter.NO_ANNOTATE,
+                      Boolean.TRUE.toString());
+        }
+
+        try {
+            enhancer = new EnhancerFilter(jdoMeta, props, out, err);
+            if (options.doTiming.value) {
+                // wrap with timing byte-code enhancer
+                enhancer = new ClassFileEnhancerTimer(enhancer);
+            }
+        } catch (EnhancerUserException ex) {
+            printlnErr("Error while creating the enhancer", ex, 
+                       options.verbose.value);
+            throw ex;
+        } catch (EnhancerFatalError ex) {
+            // enhancer is not anymore guaranteed to be consistent
+            printlnErr("Fatal error while creating the enhancer", ex, 
+                       options.verbose.value);
+            enhancer = null;
+            throw ex;
+        } catch (RuntimeException ex) {
+            // enhancer is not anymore guaranteed to be consistent
+            printlnErr("Internal error while creating the enhancer", ex, 
+                       options.verbose.value);
+            enhancer = null;
+            throw new EnhancerFatalError(ex);
+        }
+    }
+
+    /**
+     * Run the enhancer.
+     */
+    protected int process()
+    {
+        return enhanceInputFiles(options.classNames,
+                                 options.classFileNames,
+                                 options.archiveFileNames);
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     * Runs this class
+     */
+    static public void main(String[] args)
+    {
+        final PrintWriter out = new PrintWriter(System.out, true);
+        out.println("--> EnhancerMain.main()");
+        //out.println("JDO RI Class-File Enhancer");
+        final EnhancerMain main = new EnhancerMain(out, out);
+        int res = main.run(args);
+        //out.println("done.");
+        out.println("<-- EnhancerMain.main(): exit = " + res);
+        System.exit(res);
+    }
+}

Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/Main.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/Main.java?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/Main.java (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/Main.java Sun May 22 10:55:51 2005
@@ -0,0 +1,957 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.enhancer;
+
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.PrintWriter;
+import java.io.FileReader;
+import java.io.BufferedReader;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import java.util.zip.ZipFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+import java.util.zip.ZipException;
+
+import java.net.URL;
+
+import org.apache.jdo.impl.enhancer.ClassFileEnhancer;
+import org.apache.jdo.impl.enhancer.ClassFileEnhancerHelper;
+import org.apache.jdo.impl.enhancer.ClassFileEnhancerTimer;
+import org.apache.jdo.impl.enhancer.EnhancerFatalError;
+import org.apache.jdo.impl.enhancer.EnhancerUserException;
+import org.apache.jdo.impl.enhancer.OutputStreamWrapper;
+import org.apache.jdo.impl.enhancer.core.EnhancerFilter;
+import org.apache.jdo.impl.enhancer.meta.EnhancerMetaData;
+import org.apache.jdo.impl.enhancer.meta.EnhancerMetaDataFatalError;
+import org.apache.jdo.impl.enhancer.meta.model.EnhancerMetaDataJDOModelImpl;
+import org.apache.jdo.impl.enhancer.meta.prop.EnhancerMetaDataPropertyImpl;
+import org.apache.jdo.impl.enhancer.meta.util.EnhancerMetaDataBaseModel;
+import org.apache.jdo.impl.enhancer.meta.util.EnhancerMetaDataTimer;
+import org.apache.jdo.impl.enhancer.util.CombinedResourceLocator;
+import org.apache.jdo.impl.enhancer.util.ListResourceLocator;
+import org.apache.jdo.impl.enhancer.util.PathResourceLocator;
+import org.apache.jdo.impl.enhancer.util.ResourceLocator;
+import org.apache.jdo.impl.enhancer.util.ResourceLocatorTimer;
+import org.apache.jdo.impl.enhancer.util.Support;
+
+
+
+
+
+/**
+ * Main is the starting point for the persistent filter tool.
+ */
+public class Main
+    extends Support
+{
+    // return values of main()
+    static public final int OK = 0;
+    static public final int USAGE_ERROR = -1;
+    static public final int METADATA_ERROR = -2;
+    static public final int CLASS_LOCATOR_ERROR = -3;
+    static public final int INTERNAL_ERROR = -4;
+
+    /**
+     *  The stream to write messages to.
+     */
+    private final PrintWriter out = new PrintWriter(System.out, true);
+
+    /**
+     *  The stream to write error messages to.
+     */
+    private final PrintWriter err = new PrintWriter(System.err, true);
+
+    /**
+     *  The command line options.
+     */
+    private final CmdLineOptions opts = new CmdLineOptions();
+
+    /**
+     *  The byte code enhancer.
+     */
+    private ClassFileEnhancer enhancer;
+
+    /**
+     *  The locator for classes.
+     */
+    protected ResourceLocator classLocator;
+
+    /**
+     *  The metadata for the enhancer.
+     */
+    private EnhancerMetaData jdoMetaData;
+
+    /**
+     * Construct a filter tool instance
+     */
+    public Main()
+    {}
+
+    // ----------------------------------------------------------------------
+
+    /**
+     * This is where it all starts.
+     */
+    public static void main(String[] argv)
+    {
+        int res;
+        final Main main = new Main();
+
+        //@olsen: added support for timing statistics
+        try {
+            res = main.process(argv);
+        } catch (RuntimeException ex) {
+            main.out.flush();
+            main.err.println("Internal error while postprocessing: "
+                             + ex.getMessage());
+            ex.printStackTrace(main.err);
+            main.err.flush();
+            res = INTERNAL_ERROR;
+        } finally {
+            //@olsen: added support for timing statistics
+            if (main.opts.doTiming) {
+                Support.timer.print();
+            }
+        }
+        System.exit(res);
+    }
+
+    /**
+     * Process command line options and run enhancer.
+     */
+    public int process(String[] argv)
+    {
+        int res;
+
+        if ((res = opts.processArgs(argv)) != OK) {
+            printMessage("aborted with errors.");
+            return res;
+        }
+
+        //@olsen: added support for timing statistics
+        try {
+            if (opts.doTiming) {
+                timer.push("Main.process(String[])");
+            }
+
+            if ((res = createEnhancer()) != OK) {
+                printMessage("aborted with errors.");
+                return res;
+            }
+
+            if ((res = enhanceInputFiles(opts.classNames,
+                                         opts.classFileNames,
+                                         opts.zipFileNames,
+                                         opts.jdoFileNames)) != OK) {
+                printMessage("aborted with errors.");
+                return res;
+            }
+
+            printMessage("done.");
+            return 0;
+        } finally {
+            if (opts.doTiming) {
+                timer.pop();
+            }
+        }
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     *  A class for holding the command line options.
+     */
+    private class CmdLineOptions
+    {
+        final List classNames = new ArrayList();        
+        final List classFileNames = new ArrayList();        
+        final List zipFileNames = new ArrayList();        
+        final List jdoFileNames = new ArrayList();        
+        String sourcePath = null;
+        String destinationDirectory = null;
+        String propertiesFileName = null;
+        boolean doTiming = false;
+        boolean verbose = false;
+        boolean quiet = false;
+        boolean forceWrite = false;
+        boolean noWrite = false;
+        boolean dumpClass = false;
+        boolean noAugment = false;
+        boolean noAnnotate = false;
+
+        /**
+         * Print a usage message to System.err.
+         */
+        public void usage() {
+            err.println("Usage: main <options> <arguments>...");
+            err.println("Options:");
+            err.println("  -h, --help               print usage message and exit gently");
+            err.println("  -v, --verbose            print verbose messages");
+            err.println("  -q, --quiet              supress warnings");
+            err.println("  -s, --sourcepath <path>  source path for jdo and classfiles");
+            err.println("  -d, --destdir <dir>      destination directory for output files");
+            err.println("  -f, --force              overwrite output files");
+            err.println("  -n, --nowrite            never write output files");
+            err.println("  -t, --timing             do timing messures");
+            err.println();
+            err.println("Debugging Options:");
+            err.println("      --properties <file>  use property file for meta data");
+            err.println("      --dumpclass          print out disassembled code of classes");
+            err.println("      --noaugment          do not enhance for persistence-capability");
+            err.println("      --noannotate         do not enhance for persistence-awareness");
+            err.println();
+            err.println("Arguments:");
+            //err.println("  <class>      the fully qualified name of a Java class");
+            err.println("  <jdofile>    the name of a .jdo file");
+            err.println("  <classfile>  the name of a .class file");
+            //err.println("  <zipfile>    the name of a .zip or .jar file");
+            err.println();
+            err.println("Returns a non-zero value in case of errors.");
+        }
+
+        /**
+         * Process command line options.
+         */
+        protected int processArgs(String[] argv)
+        {
+            final Collection inputNames = new ArrayList();
+            for (int i = 0; i < argv.length; i++) {
+                final String arg = argv[i];
+                if (arg.equals("-h")
+                    || arg.equals("--help")) {
+                    usage();
+                    return OK;
+                }
+                if (arg.equals("-v")
+                    || arg.equals("--verbose")) {
+                    verbose = true;
+                    quiet = false;
+                    continue;
+                }
+                if (arg.equals("-q")
+                    || arg.equals("--quiet")) {
+                    quiet = true;
+                    verbose = false;
+                    continue;
+                }
+                if (arg.equals("-t") ||
+                    arg.equals("--timing")) {
+                    doTiming = true;
+                    continue;
+                }
+                if (arg.equals("-f")
+                    || arg.equals("--force")) {
+                    forceWrite = true;
+                    noWrite = false;
+                    continue;
+                }
+                if (arg.equals("-n")
+                    || arg.equals("--nowrite")) {
+                    noWrite = true;
+                    forceWrite = false;
+                    continue;
+                }
+                if (arg.equals("--dumpclass")) {
+                    dumpClass = true;
+                    continue;
+                }
+                if (arg.equals("--noaugment")) {
+                    noAugment = true;
+                    continue;
+                }
+                if (arg.equals("--noannotate")) {
+                    noAnnotate = true;
+                    continue;
+                }
+                if (arg.equals("-s")
+                    || arg.equals("--sourcepath")) {
+                    if (argv.length - i < 2) {
+                        printError("Missing argument to the -s/--sourcepath option", null);
+                        usage();
+                        return USAGE_ERROR;
+                    }
+                    sourcePath = argv[++i];
+                    continue;
+                }
+                if (arg.equals("-d")
+                    || arg.equals("--destdir")) {
+                    if (argv.length - i < 2) {
+                        printError("Missing argument to the -d/-destdir option", null);
+                        usage();
+                        return USAGE_ERROR;
+                    }
+                    destinationDirectory = argv[++i];
+                    continue;
+                }
+                if (arg.equals("--properties")) {
+                    if (argv.length - i < 2) {
+                        printError("Missing argument to the --properties option", null);
+                        usage();
+                        return USAGE_ERROR;
+                    }
+                    propertiesFileName = argv[++i];
+                    continue;
+                }
+                if (arg.length() > 0 && arg.charAt(0) == '-') {
+                    printError("Unrecognized option:" + arg, null);
+                    usage();
+                    return USAGE_ERROR;
+                }
+                if (arg.length() == 0) {
+                    printMessage("Ignoring empty command line argument.");
+                    continue;
+                }
+
+                inputNames.add(arg);
+            }
+
+            // group input file arguments
+            for (Iterator names = inputNames.iterator(); names.hasNext();) {
+                final String name = (String)names.next();
+                if (isJdoFileName(name)) {
+                    jdoFileNames.add(name);
+                } else if (isClassFileName(name)) {
+                    classFileNames.add(name);
+                } else if (isZipFileName(name)) {
+                    zipFileNames.add(name);
+                } else {
+                    classNames.add(name);
+                }
+            }
+
+            if (verbose) {
+                printArgs();
+            }
+            return checkArgs();
+        }
+
+        /**
+         * Check command line options.
+         */
+        protected int checkArgs()
+        {
+            // at least one class must be specified
+            if (classNames.isEmpty()
+                && classFileNames.isEmpty()
+                && zipFileNames.isEmpty()) {
+                final String msg
+                    = "No classes specified";
+                printError(msg, null);
+                usage();
+                return USAGE_ERROR;
+            }
+
+            // at least one meta-data source must be specified for classfiles
+            if (classFileNames.size() > 0
+                && (jdoFileNames.isEmpty()
+                    && propertiesFileName == null
+                    && sourcePath == null)) {
+                final String msg
+                    = "No JDO meta-data source specified for class files";
+                printError(msg, null);
+                usage();
+                return USAGE_ERROR;
+            }
+
+            // either jdo files or jdo properties specified
+            if (!jdoFileNames.isEmpty() && propertiesFileName != null) {
+                final String msg
+                    = "Cannot have both jdo files and properties specified";
+                printError(msg, null);
+                usage();
+                return USAGE_ERROR;
+            }
+
+            return OK;
+        }
+
+        /**
+         * Print command line options.
+         */
+        protected void printArgs()
+        {
+            out.println("Enhancer: options:");
+            out.println("    verbose = " + verbose);
+            out.println("    quiet = " + quiet);
+            out.println("    forceWrite = " + forceWrite);
+            out.println("    noWrite = " + noWrite);
+            out.println("    sourcePath = " + sourcePath);
+            out.println("    destinationDirectory = " + destinationDirectory);
+            out.println("    propertiesFileName = " + propertiesFileName);
+            out.println("    doTiming = " + doTiming);
+            out.println("    classNames = {");
+            for (Iterator i = classNames.iterator(); i.hasNext();) {
+                out.println("        " + i.next());
+            }
+            out.println("    }");
+            out.println("    jdoFileNames = {");
+            for (Iterator i = jdoFileNames.iterator(); i.hasNext();) {
+                out.println("        " + i.next());
+            }
+            out.println("    }");
+            out.println("    classFileNames = {");
+            for (Iterator i = classFileNames.iterator(); i.hasNext();) {
+                out.println("        " + i.next());
+            }
+            out.println("    }");
+            out.println("    zipFileNames = {");
+            for (Iterator i = zipFileNames.iterator(); i.hasNext();) {
+                out.println("        " + i.next());
+            }
+            out.println("    }");
+            out.println("    dumpClass = " + dumpClass);
+            out.println("    noAugment = " + noAugment);
+            out.println("    noAnnotate = " + noAnnotate);
+        }
+    }
+
+    private int initClassLocator()
+    {
+        final boolean verbose = opts.verbose;
+        final List classFileNames = opts.classFileNames;
+        final List zipFileNames = opts.zipFileNames;
+        final String sourcePath = opts.sourcePath;
+        try {
+            final List locators = new ArrayList();
+
+            // create resource locator for specified class files
+            if (classFileNames != null && !classFileNames.isEmpty()) {
+                final ResourceLocator classes
+                    = new ListResourceLocator(out, verbose, classFileNames);
+                if (verbose) {
+                    out.println("Class Locator: using class files: {");
+                    for (Iterator i = classFileNames.iterator(); i.hasNext();) {
+                        out.println("    " + i.next());
+                    }
+                    out.println("}");
+                }
+                locators.add(classes);
+            }
+
+            // create resource locator for specified zip files
+            if (zipFileNames != null && !zipFileNames.isEmpty()) {
+                final StringBuffer s = new StringBuffer();
+                final Iterator i = zipFileNames.iterator();
+                s.append(i.next());
+                while (i.hasNext()) {
+                    s.append(File.pathSeparator + i.next());
+                }
+                final ResourceLocator zips
+                    = new PathResourceLocator(out, verbose, s.toString());
+                if (verbose)
+                    out.println("Class Locator: using jar/zip files: "
+                                + s.toString());
+                locators.add(zips);
+            }
+
+            // create resource locator for specified source path
+            if (sourcePath != null && sourcePath.length() > 0) {
+                final ResourceLocator path
+                    = new PathResourceLocator(out, verbose, sourcePath);
+                if (verbose)
+                    out.println("Class Locator: using source path: "
+                                + sourcePath);
+                locators.add(path);
+            }
+
+            // print warning if no classes specified
+            affirm(!locators.isEmpty());
+            //if (locators.isEmpty()) {
+            //    printWarning(getI18N("enhancer.using_no_classes"));
+            //}
+
+            // init class locators
+            classLocator
+                = new CombinedResourceLocator(out, verbose, locators);
+
+            // wrap with timing class locator
+            if (opts.doTiming) {
+                classLocator = new ResourceLocatorTimer(classLocator);
+            }
+        } catch (IOException ex) {
+            printError("Cannot initialize resource locator for classes", ex);
+            return CLASS_LOCATOR_ERROR;
+        }
+        return OK;
+    }
+
+    private int initEnhancerMetaData()
+    {
+        final boolean verbose = opts.verbose;
+        final String propertiesFileName = opts.propertiesFileName;
+        final List jdoFileNames = opts.jdoFileNames;
+        final List zipFileNames = opts.zipFileNames;
+        final String sourcePath = opts.sourcePath;
+        try {
+            if (propertiesFileName != null) {
+                jdoMetaData
+                    = new EnhancerMetaDataPropertyImpl(out, verbose,
+                                                       propertiesFileName);
+            } else {
+                jdoMetaData
+                    = new EnhancerMetaDataJDOModelImpl(out, verbose,
+                                                       jdoFileNames,
+                                                       zipFileNames,
+                                                       sourcePath);
+            }
+
+            // wrap with timing meta data object
+            if (opts.doTiming) {
+                jdoMetaData = new EnhancerMetaDataTimer(jdoMetaData);
+            }
+        } catch (EnhancerMetaDataFatalError ex) {
+            printError("Cannot initialize JDO meta-data source", ex);
+            return METADATA_ERROR;
+        }
+        return OK;
+    }
+    
+    private int createEnhancer()
+    {
+        int res0 = initClassLocator();
+        if (res0 < 0) {
+            return res0;
+        }
+        affirm(classLocator != null);
+
+        int res = initEnhancerMetaData();
+        if (res < 0) {
+            return res;
+        }
+        affirm(jdoMetaData != null);
+
+        final Properties props = new Properties();
+        if (opts.verbose) {
+            props.put(EnhancerFilter.VERBOSE_LEVEL,
+                      EnhancerFilter.VERBOSE_LEVEL_VERBOSE);
+        }
+        
+        if (opts.doTiming) {
+            props.put(EnhancerFilter.DO_TIMING_STATISTICS,
+                      Boolean.TRUE.toString());
+        }
+
+        if (opts.dumpClass) {
+            props.put(EnhancerFilter.DUMP_CLASS,
+                      Boolean.TRUE.toString());
+        }
+
+        if (opts.noAugment) {
+            props.put(EnhancerFilter.NO_AUGMENT,
+                      Boolean.TRUE.toString());
+        }
+
+        if (opts.noAnnotate) {
+            props.put(EnhancerFilter.NO_ANNOTATE,
+                      Boolean.TRUE.toString());
+        }
+
+        try {            
+            enhancer = new EnhancerFilter(jdoMetaData, props, out, err);
+            if (opts.doTiming) {
+                // wrap with timing byte-code enhancer
+                enhancer = new ClassFileEnhancerTimer(enhancer);
+            }
+            return 0;
+        } catch (EnhancerUserException ex) {
+            printError("Error while creating the enhancer", ex);
+            return -1;
+        } catch (EnhancerFatalError ex) {
+            // enhancer is not anymore guaranteed to be consistent
+            printError("Fatal error while creating the enhancer", ex);
+            enhancer = null;
+            return -1;
+        }
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     *  Enhances all files entered in the command line.
+     *
+     *  @param  classNames  List of class names.
+     *  @param  classFileNames  List of class file names.
+     *  @param  zipFileNames  List of zip file names.
+     *  @param  jdoFileNames  List of jdo file names.
+     */
+    private int enhanceInputFiles(List classNames,
+                                  List classFileNames,
+                                  List zipFileNames,
+                                  List jdoFileNames)
+    {
+        int res = 0;
+        try {
+            String name = null;
+            for (Iterator i = zipFileNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceZipFile(name);
+                } catch (EnhancerUserException ex) {
+                    printError("Error while enhancing " + name, ex);
+                    res++;
+                    continue;
+                }
+            }
+            for (Iterator i = classFileNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceClassFile(openFileInputStream(name));
+                } catch (EnhancerUserException ex) {
+                    printError("Error while enhancing " + name, ex);
+                    res++;
+                    continue;
+                }
+            }
+            for (Iterator i = classNames.iterator(); i.hasNext();) {
+                try {
+                    name = (String)i.next();
+                    enhanceClassFile(openClassInputStream(name));
+                } catch (EnhancerUserException ex) {
+                    printError("Error while enhancing " + name, ex);
+                    res++;
+                    continue;
+                }
+            }
+        } catch (IOException ex) {
+            printError("IO Error while enhancing", ex);
+            return ++res;
+        } catch (EnhancerFatalError ex) {
+            // enhancer is not anymore guaranteed to be consistent
+            printError("Fatal error while enhancing", ex);
+            enhancer = null;
+            return ++res;
+        }
+        return res;
+    }
+
+    /**
+     *  Enhances a classfile.
+     *
+     *  @param  in  The input stream of the classfile.
+     */
+    private void enhanceClassFile(InputStream in)
+        throws IOException, EnhancerUserException, EnhancerFatalError
+    {
+        OutputStream out = null;
+        try {
+            final File temp = File.createTempFile("enhancer", ".class");
+            out = new BufferedOutputStream(new FileOutputStream(temp));
+
+            //enhance
+            final OutputStreamWrapper wrapper = new OutputStreamWrapper(out);
+            final boolean enhanced = enhancer.enhanceClassFile(in, wrapper);
+
+            closeOutputStream(out);
+            out = null;
+            createOutputFile(enhanced,
+                             createClassFileName(wrapper.getClassName()),
+                             temp);
+        } finally {
+            closeInputStream(in);
+            closeOutputStream(out);
+        }
+    }
+
+    /**
+     *  Enhances a zipfile.
+     *
+     *  @param  filename  The filename of the zipfile.
+     */
+    private void enhanceZipFile(String filename)
+        throws IOException, EnhancerUserException, EnhancerFatalError
+    {
+        ZipInputStream in = null;
+        ZipOutputStream out = null;
+        try {
+            final File temp = File.createTempFile("enhancer", ".zip");
+            in = new ZipInputStream(new BufferedInputStream(
+                new FileInputStream(new File(filename))));
+            out = new ZipOutputStream(new BufferedOutputStream(
+                new FileOutputStream(temp)));
+
+            //enhance the zipfile
+            final boolean enhanced
+                = ClassFileEnhancerHelper.enhanceZipFile(enhancer, in, out);
+
+            //create the output file
+            closeOutputStream(out);
+            out = null;
+            createOutputFile(enhanced, new File(filename).getName(), temp);
+        } finally {
+            closeOutputStream(out);
+            closeInputStream(in);
+        }
+    }
+
+    /**
+     *  Opens an input stream for the given filename
+     *
+     *  @param  filename  The name of the file.
+     *  @return  The input stream.
+     *  @exception  FileNotFoundException  If the file could not be found.
+     */
+    static private InputStream openFileInputStream(String filename)
+        throws FileNotFoundException
+    {
+     	return new BufferedInputStream(new FileInputStream(new File(filename)));
+    }
+
+    /**
+     * 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.
+     * 
+     * @param  classname  The name of the class (dot-notation).
+     * @return  The input stream.
+     * @exception IOException If an I/O error occured.
+     */
+    private InputStream openClassInputStream(String classname)
+        throws IOException
+    {
+        final String resourcename = createClassFileName(classname);
+        return classLocator.getInputStreamForResource(resourcename);
+    }
+
+    /**
+     *  Creates a file object that represents the output zipfile for a given
+     *  zipfile to enhance.
+     *
+     *  @param  zipfilename  The input zipfile name.
+     *  @return  The output zipfile name.
+     */
+    private File createZipOutputFile(String zipfilename)
+    {
+        return new File(opts.destinationDirectory,
+                        new File(zipfilename).getName());
+    }
+
+    /**
+     *  Creates the output file for an enhaced class- or zipfile. If the
+     *  enhanced file is written back depends on the command line options.
+     *
+     *  @param  enhanced  Has the input file been enhanced?
+     *  @param  filename  The name of the output file.
+     *  @param  temp      The temp file, the output is written to.
+     *  @exception  IOException  If the file could not be created.
+     */
+    private void createOutputFile(boolean  enhanced,
+                                  String   filename,
+                                  File     temp)
+        throws IOException
+    {
+        //noWrite or (not enhanced and not forceWrite)
+        if (opts.noWrite || (!enhanced && !opts.forceWrite)) {
+            temp.deleteOnExit();
+            return;
+        }
+
+        File file = new File(opts.destinationDirectory, filename);
+        createPathOfFile(file);
+        file.delete();  //delete old file if exists
+        boolean renamed = temp.renameTo(file);
+        if (!renamed) {
+            //@dave: empirical evidence shows that renameTo does not allow for
+            // crossing filesystem boundaries.  If it fails, try "by hand".
+            InputStream in = null;
+            OutputStream out = null;
+            try {
+                in = new FileInputStream(temp);
+                out = new FileOutputStream(file);
+                int PAGESIZE = 4096; // Suggest a better size?
+                byte data[] = new byte[PAGESIZE];
+                while (in.available() > 0) {
+                    int numRead = in.read(data, 0, PAGESIZE);
+                    out.write(data, 0, numRead);
+                }
+                renamed = true;
+            } catch (IOException ex) {
+                throw new IOException("Could not rename temp file '" +
+                                      temp.getAbsolutePath() +
+                                      "' to '" + file.getAbsolutePath()
+                                      + "': " + ex);
+            } finally {
+                closeInputStream(in);
+                closeOutputStream(out);
+            }
+            if (renamed) {
+                temp.delete();  //delete temporary file
+            }
+            else {
+                throw new IOException("Could not rename temp file '" +
+                                      temp.getAbsolutePath() +
+                                      "' to '" + file.getAbsolutePath() + "'.");
+            }
+        }
+    }
+
+    /**
+     *  Closes an input stream.
+     *
+     *  @param  in  The input stream.
+     */
+    private void closeInputStream(InputStream in)
+    {
+        if (in != null) {
+            try {
+                in.close();
+            } catch (IOException ex) {
+                printError(null, ex);
+            }
+        }
+    }
+
+    /**
+     *  Closes an output stream.
+     *
+     *  @param  out  The output stream.
+     */
+    private void closeOutputStream(OutputStream out)
+    {
+        if (out != null) {
+            try {
+                out.close();
+            } catch (IOException ex) {
+                printError(null, ex);
+            }
+        }
+    }
+
+    /**
+     *  Tests if a filename is a classfile name (by testing if the filename
+     *  ends with <code>".class"</code>).
+     *
+     *  @param  filename  The name of the file.
+     *  @return  Do we have a potential classfile?
+     */
+    static private boolean isClassFileName(String filename)
+    {
+        return filename.toLowerCase().endsWith(".class");
+    }
+
+    /**
+     *  Tests if a filename is a zipfile (by testing if the filename
+     *  ends with <code>".zip"</code> or <code>".jar"</code>).
+     *
+     *  @param  filename  The name of the file.
+     */
+    static private boolean isZipFileName(String filename)
+    {
+        final int n = filename.length();
+        if (n < 5) {
+            return false;
+        }
+        final String ext = filename.substring(n - 4);
+        return ext.equalsIgnoreCase(".zip") || ext.equalsIgnoreCase(".jar");
+    }
+
+    /**
+     *  Tests if a filename is a jdo file name (by testing if the filename
+     *  ends with <code>".jdo"</code>).
+     *
+     *  @param  filename  The name of the file.
+     *  @return  Do we have a potential jdo file?
+     */
+    static private boolean isJdoFileName(String filename)
+    {
+        return filename.toLowerCase().endsWith(".jdo");
+    }
+
+    /**
+     *  Creates a filename from a classname.
+     *  This is done by replacing <code>'.'</code> by <code>'/'</code>.
+     *
+     *  @param  classname  The classname.
+     *  @return  The filename.
+     */
+    static private String createClassFileName(String classname)
+    {
+        return classname.replace('.', '/') + ".class";
+    }
+
+    /**
+     *  Creates only the path of the given file.
+     *
+     *  @param  file  The file.
+     *  @exception  IOException  If an error occured.
+     */
+    static private void createPathOfFile(File file)
+        throws IOException
+    {
+        File dir = file.getAbsoluteFile().getParentFile();
+        if (!dir.exists() && !dir.mkdirs()) {
+            throw new IOException("Error creating directory '"
+                                  + dir.getAbsolutePath() + "'.");
+        }
+    }
+
+    // ----------------------------------------------------------------------
+
+    /**
+     *  Prints out an error.
+     *
+     *  @param  msg  The error message (can be <code>null</code>).
+     *  @param  ex   An optional exception (can be <code>null</code>).
+     */
+    private void printError(String msg,
+                            Throwable ex)
+    {
+        out.flush();
+        if (msg != null) {
+            err.println(msg);
+        }
+        if (ex != null) {
+            if (opts.verbose) {
+                ex.printStackTrace(err);
+            }
+            else {
+                err.println(ex.toString());
+            }
+        }
+    }
+
+    /**
+     *  Prints out a message.
+     *
+     *  @param  msg  The message.
+     */
+    private void printMessage(String msg)
+    {
+        out.println(msg);
+    }
+}

Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/package.html?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/package.html (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/enhancer/package.html Sun May 22 10:55:51 2005
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>Package org.apache.jdo.enhancer</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains th eenhancer interface.</p>
+</body>
+</html>

Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/Bundle.properties?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/Bundle.properties (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/Bundle.properties Sun May 22 10:55:51 2005
@@ -0,0 +1,220 @@
+
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+
+
+# ResourceBundle properties file for model messages
+# key consists of: enhancer.<subpackage>.<description>
+# <subpackage> - is optional, package under model
+# <description> - short description (use _ to represent space)
+# all keys should be in lowercase
+
+#
+# Global Enhancer Metadata messages
+#
+
+# {0}=detail message
+enhancer.metadata.message=JDO ENHANCER: Metadata: {0}
+
+# {0}=error message
+enhancer.metadata.error=JDO ENHANCER: Metadata Error: {0}
+
+# {0}=warning message
+enhancer.metadata.warning=JDO ENHANCER: Metadata Warning: {0}
+
+# {0}=missing resource file
+enhancer.metadata.cannot_read_resource=Cannot read directory or jar file: {0}
+
+#
+# Detail Enhancer Metadata messages
+#
+
+# {0}=exception message
+enhancer.metadata.jdomodel_error=A JDO model exception has occurred: {0}
+
+# {0}=exception message
+enhancer.metadata.io_error=An I/O exception has occurred: {0}
+
+# {0}=filename
+enhancer.metadata.using_properties=using properties file: {0}
+
+# {0}=filenames
+enhancer.metadata.using_jdo_files=using jdo files: {0}
+
+# {0}=path
+enhancer.metadata.using_jar_files=using jar/zip files: {0}
+
+# {0}=path
+enhancer.metadata.using_source_path=using source path: {0}
+
+# {0}=
+enhancer.metadata.using_no_metadata=no JDO metadata source was specified
+
+
+#
+# Global enhancer messages
+#
+
+# {0}=detailed message
+enhancer.message=JDO ENHANCER: {0}
+
+# {0}=detailed message
+enhancer.error=JDO ENHANCER: At least one error occurred while enhancing input class for Transparent Persistence; detailed message(s): {0}
+
+# {0}=error number, {1}=detailed message
+enhancer.enumerated_error=JDO ENHANCER: Error ({0}): {1}
+
+# {0}=detailed message
+enhancer.internal_error=JDO ENHANCER: An internal error occurred while enhancing input class; detailed message: {0}
+
+# {0}=detailed message
+enhancer.warning=JDO ENHANCER: Warning: {0}
+
+#
+# Enhancer core messages
+#
+
+#
+enhancer.class_format_error=I/O error while reading input stream or input stream does not denote a valid Java class.
+
+#
+enhancer.io_error_while_writing_stream=I/O error while writing output stream.
+
+# {0}=dir name
+enhancer.unable_to_create_dir=Unable to create the directory named {0}.
+
+# {0}=class name
+enhancer.class_previously_annotated=The class {0} was previously annotated.
+
+# {0}=boolean
+enhancer.class_implements_jdo_pc=implements the JDO PersistenceCapable interface: {0}.
+
+#
+enhancer.class_has_default_constructor=has default constructor.
+enhancer.class_has_not_default_constructor=has not default constructor.
+
+#
+enhancer.class_has_static_initializer=has static initializer.
+enhancer.class_has_not_static_initializer=has not static initializer.
+
+#
+enhancer.class_has_clone_method=has clone method.
+enhancer.class_has_not_clone_method=has not clone method.
+
+#
+enhancer.class_has_writeObject_method=has writeObject method.
+enhancer.class_has_not_writeObject_method=has not writeObject method.
+
+#
+enhancer.class_has_writeReplace_method=has writeReplace method.
+enhancer.class_has_not_writeReplace_method=has not writeReplace method.
+
+#
+enhancer.class_has_readObject_method=has readObject method.
+enhancer.class_has_not_readObject_method=has not readObject method.
+
+# {0}=class name
+enhancer.class_missing_default_constructor=The persistence-capable class {0} does not provide a default (no-argument) constructor.
+
+# {0}=boolean
+enhancer.class_has_generic_jdo_fields=has the generic JDO fields: {0}.
+
+# {0}=boolean
+enhancer.class_has_generic_jdo_methods=has the generic JDO methods: {0}.
+
+# {0}=boolean
+enhancer.class_has_generic_jdo_members=has the generic JDO fields and methods: {0}.
+
+# {0}=boolean
+enhancer.class_has_specific_jdo_fields=has the specific JDO fields: {0}.
+
+# {0}=boolean
+enhancer.class_has_specific_jdo_methods=has the specific JDO methods: {0}.
+
+# {0}=boolean
+enhancer.class_has_specific_jdo_members=has the specific JDO fields and methods: {0}.
+
+# {0}=boolean
+enhancer.class_has_oid_handling_jdo_methods=has the ObjectId-handling JDO methods: {0}.
+
+# {0}=boolean
+enhancer.class_has_callback_jdo_methods=has the instance-callback JDO methods: {0}.
+
+# {0}=class name, {1}=method name
+enhancer.class_defines_jdo_method=The persistence-capable class {0} defines a JDO method called {1}.
+
+# {0}=class name, {1}=field name
+enhancer.class_defines_jdo_field=The persistence-capable class {0} defines a JDO field called {1}.
+
+# {0}=class name, {1}=member name
+enhancer.class_has_jdo_like_member=The persistence-capable class {0} defines a member {1} whose name starts with the reserved jdo prefix.
+
+# {0}=class name, {1}=method name,
+# {2}=expected signature, {3}=found signature
+# {4}=expected modifiers, {5}=found modifiers
+enhancer.class_has_illegally_declared_jdo_member=The persistence-capable class {0} has an illegally declared JDO member: {1}; expected signature: ''{2}''; found signature: ''{3}''; expected access modifier flags: {4}; found access modifier flags: {5}.
+
+# {0}=class name, {1}=found method names, {2}=missing method names
+enhancer.class_has_inconsistently_declared_jdo_members=The persistence-capable class {0} has an incosistent set of declared JDO members; found: {1}; missing: {2}.
+
+#
+# Other Enhancer messages
+#
+
+# {0}=filenames
+enhancer.using_jdo_files=using jdo files: {0}
+
+# {0}=path
+enhancer.using_archive_files=using jar/zip files: {0}
+
+# {0}=path
+enhancer.using_source_path=using source path: {0}
+
+# {0}=resource file name
+enhancer.using_file=using file: {0}
+
+# {0}=resource path element
+enhancer.using_path_element=using path element: {0}
+
+# {0}=class name, {1}=file name, {2}=file name
+enhancer.class_already_entered=The class {0} from {1} is already entered from {2}.
+
+# {0}=dir name, {1}=dir name
+enhancer.destination_directory_already_set=Attempt to set the destination directory to {0}, but it has already been set to {1}.
+
+# {0}=dir name
+enhancer.destination_directory_not_exist=The destination directory {0} does not exist.
+
+# {0}=resource name
+enhancer.found_resource=found resource: {0}
+enhancer.not_found_resource=not found resource: {0}
+
+# {0}=resource name
+enhancer.cannot_read_resource=resource does not exist or cannot be read: {0}
+
+# {0}=resource name {1}=exception message
+enhancer.io_error_while_reading_resource=An I/O exception has occurred while reading resource: {0}, exception: {1}
+
+# {0}=resource name
+enhancer.io_error_while_reading_resource=An I/O exception has occurred: {0}
+
+# {0}=resource name
+enhancer.illegal_path_element=illegal element source path: {0}
+
+#
+# Enhancer exception messages
+#
+
+MSG_CauseThrowable=CauseThrowable:
+MSG_CauseThrowableStackTrace=CauseThrowableStackTrace:



Mime
View raw message