From jdo-commits-return-169-apmail-db-jdo-commits-archive=www.apache.org@db.apache.org Sat Mar 19 05:00:01 2005 Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 81583 invoked from network); 19 Mar 2005 05:00:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Mar 2005 05:00:01 -0000 Received: (qmail 82147 invoked by uid 500); 19 Mar 2005 05:00:01 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Delivered-To: moderator for jdo-commits@db.apache.org Received: (qmail 82588 invoked by uid 99); 19 Mar 2005 01:06:01 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Message-ID: <20050319010557.28010.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Sat, 19 Mar 2005 01:05:56 -0000 Subject: svn commit: r158176 [2/79] - in incubator/jdo/trunk/ri11: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/ejb/ 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/ src/java/org/apache/jdo/impl/fostore/ src/java/org/apache/jdo/impl/jdoql/ src/java/org/apache/jdo/impl/jdoql/jdoqlc/ src/java/org/apache/jdo/impl/jdoql/scope/ src/java/org/apache/jdo/impl/jdoql/tree/ src/java/org/apache/jdo/impl/model/ src/java/org/apache/jdo/impl/model/java/ src/java/org/apache/jdo/impl/model/java/runtime/ src/java/org/apache/jdo/impl/model/jdo/ src/java/org/apache/jdo/impl/model/jdo/caching/ src/java/org/apache/jdo/impl/model/jdo/util/ src/java/org/apache/jdo/impl/model/jdo/xml/ src/java/org/apache/jdo/impl/pm/ src/java/org/apache/jdo/impl/sco/ src/java/org/apache/jdo/impl/state/ src/java/org/apache/jdo/jdoql/ src/java/org/apache/jdo/jdoql/tree/ src/java/org/apache/jdo/model/ src/java/org/apache/jdo/model/java/ src/java/org/apache/jdo/model/jdo/ src/java/org/apache/jdo/pm/ src/java/org/apache/jdo/sco/ src/java/org/apache/jdo/state/ src/java/org/apache/jdo/store/ src/java/org/apache/jdo/util/ test/ test/conf/ test/enhancer/ test/enhancer/sempdept/ test/enhancer/sempdept/src/ test/enhancer/sempdept/src/empdept/ test/fsuid2/ test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/ test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/ test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/ test/java/org/apache/jdo/pc/empdept/ test/java/org/apache/jdo/pc/serializable/ test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/ test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/ test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/ test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/ test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/ test/jdo/org/apache/jdo/pc/xempdept/ xdocs/ To: jdo-commits@db.apache.org From: mbo@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/jdo/trunk/ri11/maven.xml URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/maven.xml?view= =3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/maven.xml (added) +++ incubator/jdo/trunk/ri11/maven.xml Fri Mar 18 17:02:29 2005 @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + =20 + + + + =20 + + + + =20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Check existence of XML metadata for pc classes + + + + + + + + + + + Enhance persistence-capable and persistence-aware classes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + =20 + + + + + + + + + + + + + + Added: incubator/jdo/trunk/ri11/project.properties URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/project.propert= ies?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/project.properties (added) +++ incubator/jdo/trunk/ri11/project.properties Fri Mar 18 17:02:29 2005 @@ -0,0 +1,204 @@ +# +# Copyright 2005 The Apache Software Foundation. +#=20 +# 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=20 +#=20 +# http://www.apache.org/licenses/LICENSE-2.0 +#=20 +# Unless required by applicable law or agreed to in writing, software=20 +# distributed under the License is distributed on an "AS IS" BASIS,=20 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.=20 +# See the License for the specific language governing permissions and=20 +# limitations under the License. + +# Start new JVM for junit tests +maven.junit.fork =3D yes +maven.junit.dir =3D ${jdo.testdir} + +# checkstyle settings +maven.checkstyle.properties =3D ${basedir}/../jdo_checks.xml +maven.checkstyle.excludes =3D \ +org/apache/jdo/impl/jdoql/jdoqlc/*TokenTypes.java,\ +org/apache/jdo/impl/jdoql/jdoqlc/JDOQLParser.java, \ +org/apache/jdo/impl/jdoql/jdoqlc/JDOQLLexer.java, \ +org/apache/jdo/impl/jdoql/jdoqlc/Semantic.java, \ +org/apache/jdo/impl/jdoql/jdoqlc/Optimizer.java + +# dependencies +jdo.jdoapi.jarfile =3D ${pom.getDependencyPath('jdo:jdo-api')} +jdo.jdobtree.jarfile =3D ${pom.getDependencyPath('jdo:jdo-btree')} +junit.jarfile =3D ${pom.getDependencyPath('junit:junit')} +antlr.jarfile =3D ${pom.getDependencyPath('antlr:antlr')} +jta.jarfile =3D ${pom.getDependencyPath('geronimo-spec:geronimo-spec-jta')} +logging.jarfile =3D ${pom.getDependencyPath('commons-logging')} +# JNDI implementation +jndi =3D ${basedir}/fscontext.jar${path.separator}${basedir}/providerutil.= jar +xmlparser =3D + +jdo.antlr.src.dir =3D ${basedir}/src/java/org/apache/jdo/impl/jdoql/jdoqlc +jdo.testclasses.dir =3D ${maven.build.dir}/test-classes +jdo.pcclasses.jarfile =3D ${maven.build.dir}/test-classes/pcclasses.jar +jdo.testclasses.jarfile =3D ${maven.build.dir}/test-classes/jdo-ri-tests.j= ar +jdo.fsuid.jarfile =3D ${maven.build.dir}/test-classes/fsuid2.jar +jdo.testlist =3D ${basedir}/test/conf/tests.list +jdo.testdir =3D ${maven.build.dir}/database +jdo.security.policy =3D ${basedir}/test/conf/JDO11Policy + +# enhancer=20 +jdo.enhancer.enhanced.dir =3D ${maven.build.dir}/test-classes +jdo.enhancer.main =3D org.apache.jdo.enhancer.Main +jdo.enhancer.options =3D -f -d "${jdo.enhancer.enhanced.dir}" -s "${jdo.en= hancer.sourcepath}" +jdo.enhancer.sourcepath =3D ${maven.build.dir}/test-classes${path.separato= r}${jdo.jdoapi.jarfile} +jdo.enhancer.classpath =3D ${maven.build.dest}${path.separator}${jdo.jdoap= i=2Ejarfile}${path.separator}${logging.jarfile} +jdo.annotationtest.main =3D org.apache.jdo.impl.enhancer.util.AnnotationTe= st +jdo.annotationtest.options =3D -s "${jdo.enhancer.enhanced.dir}${path.sepa= rator}${jdo.enhancer.sourcepath}" +jdo.augmentationtest.main =3D org.apache.jdo.impl.enhancer.util.Augmentati= onTest +jdo.augmentationtest.options =3D -s "${jdo.enhancer.enhanced.dir}${path.se= parator}${jdo.enhancer.sourcepath}" +jdo.xmlexists.main =3D org.apache.jdo.impl.model.jdo.xml.XMLExists +jdo.xmlexists.classpath =3D ${maven.build.dir}/test-classes${path.separato= r}${jdo.enhancer.classpath} + +jdo.pcclasses.pc.classes=3D \ + org.apache.jdo.pc.PCArrays \ + org.apache.jdo.pc.PCCollections \ + org.apache.jdo.pc.PCCycle \ + org.apache.jdo.pc.PCCycle2 \ + org.apache.jdo.pc.PCDepartment \ + org.apache.jdo.pc.PCDepartment1 \ + org.apache.jdo.pc.PCEmployee \ + org.apache.jdo.pc.PCEmployee1 \ + org.apache.jdo.pc.PCFullTimeEmployee1 \ + org.apache.jdo.pc.PCInsurance \ + org.apache.jdo.pc.PCInsurance1 \ + org.apache.jdo.pc.PCInterfaces \ + org.apache.jdo.pc.PCLargeObj \ + org.apache.jdo.pc.PCPoint \ + org.apache.jdo.pc.PCPoint1 \ + org.apache.jdo.pc.PCPrimitive \ + org.apache.jdo.pc.PCProject \ + org.apache.jdo.pc.PCProject1 \ + org.apache.jdo.pc.PCRect \ + org.apache.jdo.pc.PCRefArrays \ + org.apache.jdo.pc.PCSCO \ + org.apache.jdo.pc.PCStroke \ + org.apache.jdo.pc.PCBase \ + org.apache.jdo.pc.PCDerived \ + org.apache.jdo.pc.PCId \ + org.apache.jdo.pc.PCCollection + +jdo.pcclasses.pc.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCArrays.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCCollections.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCCycle.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCCycle2.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCDepartment.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCDepartment1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCEmployee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCEmployee1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCFullTimeEmployee1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCInsurance.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCInsurance1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCInterfaces.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCLargeObj.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCPoint.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCPoint1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCPrimitive.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCProject.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCProject1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCRect.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCRefArrays.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCSCO.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCStroke.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCBase.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCDerived.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCId.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/PCCollection.class + +jdo.pcclasses.empdept.classes=3D \ + org.apache.jdo.pc.empdept.PCPerson \ + org.apache.jdo.pc.empdept.PCEmployee \ + org.apache.jdo.pc.empdept.PCFullTimeEmployee \ + org.apache.jdo.pc.empdept.PCPartTimeEmployee \ + org.apache.jdo.pc.empdept.PCInsurance \ + org.apache.jdo.pc.empdept.PCDepartment \ + org.apache.jdo.pc.empdept.PCProject + +jdo.pcclasses.empdept.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCPerson.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCEmployee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCFullTimeEmployee.clas= s \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCPartTimeEmployee.clas= s \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCInsurance.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCDepartment.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/empdept/PCProject.class + +jdo.pcclasses.xempdept.classes=3D \ + org.apache.jdo.pc.xempdept.Company \ + org.apache.jdo.pc.xempdept.Department \ + org.apache.jdo.pc.xempdept.Person \ + org.apache.jdo.pc.xempdept.Employee \ + org.apache.jdo.pc.xempdept.FullTimeEmployee \ + org.apache.jdo.pc.xempdept.PartTimeEmployee \ + org.apache.jdo.pc.xempdept.Insurance \ + org.apache.jdo.pc.xempdept.Project \ + org.apache.jdo.pc.xempdept.PrimitiveTypes + +jdo.pcclasses.xempdept.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Company.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Department.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Person.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Employee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/FullTimeEmployee.class= \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/PartTimeEmployee.class= \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Insurance.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/Project.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/xempdept/PrimitiveTypes.class + +jdo.pcclasses.appid.classes=3D \ + org.apache.jdo.pc.appid.PCPoint \ + org.apache.jdo.pc.appid.PCRect \ + org.apache.jdo.pc.appid.PCPerson \ + org.apache.jdo.pc.appid.PCEmployee \ + org.apache.jdo.pc.appid.PCFullTimeEmployee \ + org.apache.jdo.pc.appid.PCPartTimeEmployee \ + org.apache.jdo.pc.appid.PCInsurance \ + org.apache.jdo.pc.appid.PCDepartment \ + org.apache.jdo.pc.appid.PCProject \ + org.apache.jdo.pc.appid.PCObjectKey + +jdo.pcclasses.appid.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCPoint.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCRect.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCPerson.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCEmployee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCFullTimeEmployee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCPartTimeEmployee.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCInsurance.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCDepartment.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCProject.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/appid/PCObjectKey.class + +jdo.pcclasses.serializable.classes=3D \ + org.apache.jdo.pc.serializable.PCClass1 \ + org.apache.jdo.pc.serializable.PCClass2A \ + org.apache.jdo.pc.serializable.PCClass2B \ + org.apache.jdo.pc.serializable.PCSuper \ + org.apache.jdo.pc.serializable.PCSub3 \ + org.apache.jdo.pc.serializable.PCSub4A \ + org.apache.jdo.pc.serializable.PCSub4B + +jdo.pcclasses.serializable.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCClass1.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCClass2A.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCClass2B.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCSuper.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCSub3.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCSub4A.class \ + ${jdo.testclasses.dir}/org/apache/jdo/pc/serializable/PCSub4B.class + +jdo.pawareclasses.test.classes=3D \ + org.apache.jdo.test.Test_PCDerived + +jdo.pawareclasses.test.files=3D \ + ${jdo.testclasses.dir}/org/apache/jdo/test/Test_PCDerived.class Added: incubator/jdo/trunk/ri11/project.xml URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/project.xml?vie= w=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/project.xml (added) +++ incubator/jdo/trunk/ri11/project.xml Fri Mar 18 17:02:29 2005 @@ -0,0 +1,117 @@ + + + + + 3 + ../project.xml + + + + JDO Reference Implementation 1.1 + jdo-ri + jdo-ri + 1.1 + org.apache.jdo + Java Data Object (JDO) RI + The Java Data Objects (JDO) API is a standard interface-b= ased=20 +Java model abstraction of persistence, developed as Java Specification=20 +Request 12 JSR 12 under the auspices of the Java Community Process. + + + + + + + antlr + antlr + 2.7.3 + http://www.antlr.org/download.html + + + junit + junit + 3.8.1 + + + geronimo-spec + geronimo-spec-jta + 1.0.1B-rc2 + + + commons-logging + 1.0.4 + + + jdo + jdo-api + 1.1 + + + jdo + jdo-btree + 1.1 + + + + + + + src/java + test/java + + + + org/**/Test_*.java + + + org/**/util/*.java + org/**/Test_ClassRegistration.java + org/**/Test_FSUID2.java + org/**/Test_FetchInserted.java + org/**/Test_GetObjectById2.java + org/**/Test_NonExistent.java + org/**/Test_EmpDeptAppIdInsert.java + org/**/Test_EmpDeptAppIdUpdate.java + org/**/Test_EmpDeptAppIdDelete.java + + + + ${basedir}/test/conf + + PMF.properties + jndi.properties + commons-logging.properties + simplelog.properties + logging.properties + + + + + + + + + ${basedir}/src/java + + **/*.properties + + + + + + Added: incubator/jdo/trunk/ri11/src/conf/commons-logging.properties URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/conf/common= s-logging.properties?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/conf/commons-logging.properties (added) +++ incubator/jdo/trunk/ri11/src/conf/commons-logging.properties Fri Mar 18= 17:02:29 2005 @@ -0,0 +1,44 @@ +# +# Copyright 2005 The Apache Software Foundation. +#=20 +# 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=20 +#=20 +# http://www.apache.org/licenses/LICENSE-2.0 +#=20 +# Unless required by applicable law or agreed to in writing, software=20 +# distributed under the License is distributed on an "AS IS" BASIS,=20 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.=20 +# See the License for the specific language governing permissions and=20 +# limitations under the License. + +# +# This is a sample apache commons logging configuration file defining logg= ing=20 +# properties for the JDO RI sources. It defines what logging implementatio= n=20 +# the apache commons logging API should use by specifying the property +# org.apache.commons.logging.Log (see below). Please note, that there are=20 +# separate property files for each logging implementation to set the log +# level of the loggers: +# - SimpleLog: simplelog.properties=20 +# - JDK1.4 logging: logging.properties +# +# The JDO RI sources use the following logger instances: +# org.apache.jdo.impl.fostore File Object Store implementation +# org.apache.jdo.impl.jdoql JDOQL query runtime +# org.apache.jdo.impl.jdoql.jdoqlc JDOQL query compiler +# org.apache.jdo.impl.model.jdo JDOModel implementation +# org.apache.jdo.impl.model.jdo.xml XML parser for JDO metadata files +# org.apache.jdo.impl.pm PM and PMF implementation +# org.apache.jdo.impl.sco SCO implementation +# org.apache.jdo.impl.state StateManager implementation +# org.apache.jdo.store Generic StoreManager implementation +# org.apache.jdo.util Utility classes +# + +# Uncomment the next line if you want to use the apache simple logger +#org.apache.commons.logging.Log =3D org.apache.commons.logging.impl.Simple= Log + +# Uncomment the next two lines if you want to use JDK 1.4 logging +#org.apache.commons.logging.Log =3D org.apache.jdo.util.JDOJdk14Logger + Added: incubator/jdo/trunk/ri11/src/conf/logging.properties URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/conf/loggin= g=2Eproperties?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/conf/logging.properties (added) +++ incubator/jdo/trunk/ri11/src/conf/logging.properties Fri Mar 18 17:02:2= 9 2005 @@ -0,0 +1,62 @@ +# +# Copyright 2005 The Apache Software Foundation. +#=20 +# 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=20 +#=20 +# http://www.apache.org/licenses/LICENSE-2.0 +#=20 +# Unless required by applicable law or agreed to in writing, software=20 +# distributed under the License is distributed on an "AS IS" BASIS,=20 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.=20 +# See the License for the specific language governing permissions and=20 +# limitations under the License. + +# +# This is a sample properties file to configure standard JDK 1.4 logging f= or=20 +# the JDO RI sources. Below you find an entry for each of the JDO RI sourc= e=20 +# logger instances. Please uncomment the line and adapt the log level to y= our +# needs, in case to want to enable a particular logger. +# +# The following describes the mapping between the log level of JDK 1.4 log= ging +# and apache commns logging: +# JDK 1.4 Apache=20 +# FINEST trace=20 +# FINE, FINER debug=20 +# INFO, CONFIG info +# WARNING warn +# SEVERE error, fatal +# + +###################### +# JDORI sources +###################### + +# FOStore logger +#org.apache.jdo.impl.fostore.level =3D FINE +# JDOQL query logger +#org.apache.jdo.impl.jdoql.level =3D FINE +# JDOQL query compiler logger +#org.apache.jdo.impl.jdoql.jdoqlc.level =3D FINE +# JDOModel logger +#org.apache.jdo.impl.model.jdo.level =3D FINE +# XML parser logger +#org.apache.jdo.impl.model.jdo.xml.level =3D FINE +# PM and PMF logger +#org.apache.jdo.impl.pm.level =3D FINE +# SCO logger +#org.apache.jdo.impl.sco.level =3D FINE +# StateManager logger +#org.apache.jdo.impl.state.level =3D FINE +# Generic StoreManager logger +#org.apache.jdo.store.level =3D FINE +# Utility class logger +#org.apache.jdo.util.level =3D FINE + +###################### +# JDK 1.4 logging properties +###################### + +handlers =3D java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level =3D FINEST Added: incubator/jdo/trunk/ri11/src/conf/simplelog.properties URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/conf/simple= log.properties?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/conf/simplelog.properties (added) +++ incubator/jdo/trunk/ri11/src/conf/simplelog.properties Fri Mar 18 17:02= :29 2005 @@ -0,0 +1,52 @@ +# +# Copyright 2005 The Apache Software Foundation. +#=20 +# 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=20 +#=20 +# http://www.apache.org/licenses/LICENSE-2.0 +#=20 +# Unless required by applicable law or agreed to in writing, software=20 +# distributed under the License is distributed on an "AS IS" BASIS,=20 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.=20 +# See the License for the specific language governing permissions and=20 +# limitations under the License. + +# +# This is a sample properties file to configure apache commons logging Sim= pleLog +# implementation for the JDO RI sources. Below you find an entry for each = of the=20 +# JDO RI source logger instances. Please uncomment the line and adapt the = log=20 +# level to your needs, in case to want to enable a particular logger. +# + +###################### +# JDORI source logger +###################### + +# FOStore logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.fostore =3D = debug +# JDOQL query logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.jdoql =3D de= bug +# JDOQL query compiler logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.jdoql.jdoqlc= =3D debug +# JDOModel logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo = =3D debug +# XML parser logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo.xm= l =3D debug +# PM and PMF logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.pm =3D debug +# SCO logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.sco =3D debug +# StateManager logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.state =3D de= bug +# Generic StoreManager logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.store =3D debug +# Utility class logger +#org.apache.commons.logging.simplelog.log.org.apache.jdo.util =3D debug + +###################### +# default logging level +###################### + +org.apache.commons.logging.simplelog.defaultlog =3D error Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBHelper.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/ejb/EJBHelper.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBHelper.java (ad= ded) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBHelper.java Fri= Mar 18 17:02:29 2005 @@ -0,0 +1,130 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +/* + * EJBHelper.java + * + * Created on December 15, 2000, 10:06 AM + */ + +package org.apache.jdo.ejb; + +import javax.transaction.Transaction; +import javax.transaction.UserTransaction; + +import javax.jdo.PersistenceManagerFactory; + +/** Provide a Forte for Java implementation with information about the dis= tributed + * transaction environment. This is an interface that a helper class + * implements that is specific to a managed environment. + *

This interface is specific to Forte for Java, version 3.0, + * and is subject to change without notice. In particular, as additional + * experience is gained with specific application servers, this interface + * may have methods added and removed, even with patch releases. =20 + * Therefore, this interface should be considered very volatile, and=20 + * any class that implements it might have to be reimplemented whenever=20 + * an upgrade to either the application server or Forte for Java occurs.

+ * The class that implements this interface must register itself + * by a static method at class initialization time. For example, + *
+ * import org.apache.jdo.*;
+ * class blackHerringEJBImplHelper implements EJBHelper {
+ *    static EJBHelper.register(new blackHerringEJBImplHelper());
+ *    ...
+ * }
+ * 
+ * + * @author Marina Vatkina + */ =20 +public interface EJBHelper { + + /** Returns the UserTransaction associated with the calling thread. I= f there + * is no transaction currently in progress, this method returns null. + * @return the UserTransaction instance for the calling thread + */ =20 + UserTransaction getUserTransaction(); + + /** Identify the Transaction context for the calling thread, and retur= n a + * Transaction instance that can be used to register synchronizations, + * and used as the key for HashMaps. The returned Transaction must imp= lement + * equals() and hashCode() based on the glob= al transaction id. + *

All Transaction instances returned by this method called in the = same + * Transaction context must compare equal and return the same hashCode. + * The Transaction instance returned will be held as the key to an + * internal HashMap until the Transaction completes. If there is no tr= ansaction=20 + * associated with the current thread, this method returns null. + * @return the Transaction instance for the calling thread + */ =20 + Transaction getTransaction(); + + /** Translate local representation of the Transaction Status to + * javax.transaction.Status value if necessary. Otherwise this method + * should return the value passed to it as an argument. + *

This method is used during afterCompletion callbacks to translate + * the parameter value passed by the application server to the=20 + * afterCompletion method. The return value must be one of: + * javax.transaction.Status.STATUS_COMMITTED or + * javax.transaction.Status.STATUS_ROLLED_BACK. + * @param st local Status value + * @return the javax.transaction.Status value of the status + */ + int translateStatus(int st); + + /** Replace newly created instance of internal PersistenceManagerFacto= ry + * with the hashed one if it exists. The replacement is necessary only= if=20 + * the JNDI lookup always returns a new instance. Otherwise this metho= d=20 + * returns the object passed to it as an argument. + * + * PersistenceManagerFactory is uniquely identified by=20 + * ConnectionFactory.hashCode() if ConnectionFactory is=20 + * not null; otherwise by ConnectionFactoryName.hashCode() if=20 + * ConnectionFactoryName is not null; otherwise=20 + * by the combination of URL.hashCode() + userName.hashCode() +=20 + * password.hashCode() + driverName.hashCode(); + * + * @param pmf PersistenceManagerFactory instance to be replaced + * @return the PersistenceManagerFactory known to the runtime + */ + PersistenceManagerFactory replacePersistenceManagerFactory( + PersistenceManagerFactory pmf) ; + + /** Called at the beginning of the Transaction.beforeCompletion() to + * register the component with the app server if necessary. + * The component argument is an array of Objects.=20 + * The first element is javax.jdo.Transaction object responsible for=20 + * transaction completion. + * The second element is javax.jdo.PersistenceManager object that has=20 + * been associated with the Transaction context for the calling thread. + * The third element is javax.transaction.Transaction object that has = been=20 + * associated with the given instance of PersistenceManager. + * The return value is passed unchanged to the postInvoke method. + * + * @param component an array of Objects + * @return implementation-specific Object + */ + Object enlistBeforeCompletion(Object component) ; + + /** Called at the end of the Transaction.beforeCompletion() to + * de-register the component with the app server if necessary. + * The parameter is the return value from preInvoke, and can be any + * Object. + * + * @param im implementation-specific Object + */ + void delistBeforeCompletion(Object im) ; + +} + Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBImplHelper.j= ava URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/ejb/EJBImplHelper.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBImplHelper.java= (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/EJBImplHelper.java= Fri Mar 18 17:02:29 2005 @@ -0,0 +1,138 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * limitations under the License. + */ + +/* + * EJBImplHelper.java + * + * Created on December 15, 2000, 10:15 AM + */ +package org.apache.jdo.ejb; + +import javax.transaction.*; + +import javax.jdo.PersistenceManagerFactory; + +/** Provides helper methods for a Forte for Java implementation with the + * application server specific information in the distributed transaction + * environment. Calls corresponding methods on the registered class which + * implements EJBHelper interface. + *=20 + * @author Marina Vatkina + */ +public class EJBImplHelper { + =20 + /** Reference to a class that implements EJBHelper interface for this + * particular application server + */ + static EJBHelper myHelper; +=20 + /** Register class that implements EJBHelper interface + * Should be called by a static method at class initialization time. + * + * @param h application server specific implemetation of the + * EJBHelper interface. + */ + public static void registerEJBHelper (EJBHelper h) { + myHelper =3D h; + } + + /** Returns Transaction instance that can be used to register + * synchronizations. In a non-managed environment or if there is no + * transaction associated with the current thread, this method + * returns null. + * + * @see EJBHelper#getTransaction() + * @return the Transaction instance for the calling thread + */ + public static Transaction getTransaction() { + return myHelper =3D=3D null ? null : myHelper.getTransaction(); + } + + /** Returns the UserTransaction associated with the calling thread. + * In a non-managed environment or if there is no transaction + * currently in progress, this method returns null. + * + * @see EJBHelper#getUserTransaction() + * @return the UserTransaction instance for the calling thread + */ + public static UserTransaction getUserTransaction() { + return myHelper =3D=3D null ? null : myHelper.getUserTransaction(); + } + + /** Identifies the managed environment behavior. + * @return true if there is a helper class registered.=20 + */ + public static boolean isManaged() { + return myHelper !=3D null; + } + + /** Translates local representation of the Transaction Status to=20 + * javax.transaction.Status value. In a non-managed environment + * returns the value passed to it as an argument. + * + * @see EJBHelper#translateStatus(int st) + * @param st Status value + * @return the javax.transaction.Status value of the status=20 + */=20 + public static int translateStatus(int st) { + return myHelper =3D=3D null ? st : myHelper.translateStatus(st); + } + + /** Returns the hashed instance of internal PersistenceManagerFactory=20 + * that compares equal to the newly created instance or the instance=20 + * itself if it is not found. In a non-managed environment returns + * the value passed to it as an argument. + * + * @see EJBHelper#replacePersistenceManagerFactory( + * PersistenceManagerFactory pmf) + * @param pmf PersistenceManagerFactory instance to be replaced + * @return the PersistenceManagerFactory known to the runtime + */ + public static PersistenceManagerFactory replacePersistenceManagerFacto= ry( + PersistenceManagerFactory pmf) { + return myHelper =3D=3D null ? pmf :=20 + myHelper.replacePersistenceManagerFactory(pmf); + } + + /** Called at the beginning of the Transaction.beforeCompletion() + * to register the component with the app server if necessary. In a + * non-managed environment or if the delistBeforeCompletion method + * does not use the value, this method returns null.=20 + * + * @see EJBHelper#enlistBeforeCompletion(Object component) + * @param component an array of Objects + * @return implementation-specific Object + */ + public static Object enlistBeforeCompletion(Object component) { + return myHelper =3D=3D null ? null :=20 + myHelper.enlistBeforeCompletion(component); + } + + /** Called a non-managed environment at the end of the + * Transaction.beforeCompletion() to de-register the component with + * the app server if necessary. + * + * @see EJBHelper#delistBeforeCompletion(Object im) + * @param im implementation-specific Object + */ + public static void delistBeforeCompletion(Object im) { + if (myHelper !=3D null) { + myHelper.delistBeforeCompletion(im); + } + } + +} + Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/package.html URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/ejb/package.html?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/package.html (adde= d) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/ejb/package.html Fri M= ar 18 17:02:29 2005 @@ -0,0 +1,26 @@ + + + + +Package org.apache.jdo.ejb + + + + +

This package contains classes and interfaces for EJB support.

+ + Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/enhancer/EnhancerMa= in.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/ap= ache/jdo/enhancer/EnhancerMain.java?view=3Dauto&rev=3D158176 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/enhancer/EnhancerMain.= java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/enhancer/EnhancerMain.= java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,387 @@ +/* + * Copyright 2005 The Apache Software Foundation. + *=20 + * 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=20 + *=20 + * http://www.apache.org/licenses/LICENSE-2.0 + *=20 + * Unless required by applicable law or agreed to in writing, software=20 + * distributed under the License is distributed on an "AS IS" BASIS,=20 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied= .=20 + * See the License for the specific language governing permissions and=20 + * 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 =3D 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 =3D 0; + try { + String name =3D null; + for (Iterator i =3D archiveFileNames.iterator(); i.hasNext();)= { + try { + name =3D (String)i.next(); + enhanceArchiveFile(name); + } catch (EnhancerUserException ex) { + printlnErr("Error while enhancing " + name, ex,=20 + options.verbose.value); + res++; + continue; + } + } + for (Iterator i =3D classFileNames.iterator(); i.hasNext();) { + try { + name =3D (String)i.next(); + enhanceClassFile(openFileInputStream(name)); + } catch (EnhancerUserException ex) { + printlnErr("Error while enhancing " + name, ex,=20 + options.verbose.value); + res++; + continue; + } + } + for (Iterator i =3D classNames.iterator(); i.hasNext();) { + try { + name =3D (String)i.next(); + enhanceClassFile(openClassInputStream(name)); + } catch (EnhancerUserException ex) { + printlnErr("Error while enhancing " + name, ex,=20 + options.verbose.value); + res++; + continue; + } + } + } catch (IOException ex) { + printlnErr("IO Error while enhancing", ex, options.verbose.val= ue); + return ++res; + } catch (EnhancerFatalError ex) { + // enhancer is not anymore guaranteed to be consistent + printlnErr("Fatal error while enhancing", ex, options.verbose.= value); + enhancer =3D 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 =3D null; + try { + final File temp =3D File.createTempFile("enhancer", ".class"); + out =3D new BufferedOutputStream(new FileOutputStream(temp)); + + //enhance + final OutputStreamWrapper wrapper =3D new OutputStreamWrapper(= out); + final boolean enhanced =3D enhancer.enhanceClassFile(in, wrapp= er); + + closeOutputStream(out); + out =3D null; + createOutputFile(enhanced, + getClassFileName(wrapper.getClassName()), tem= p); + } 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 =3D null; + ZipOutputStream out =3D null; + try { + final File temp =3D File.createTempFile("enhancer", ".zip"); + in =3D new ZipInputStream(new BufferedInputStream( + new FileInputStream(new File(fileName)))); + out =3D new ZipOutputStream(new BufferedOutputStream( + new FileOutputStream(temp))); + + // enhance the archive file + final boolean enhanced + =3D ClassFileEnhancerHelper.enhanceZipFile(enhancer, in, o= ut); + + // create the output file + closeOutputStream(out); + out =3D 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 =3D new File(options.destDir.value, fileName); + final File dir =3D 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 =3D 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 =3D null; + OutputStream out =3D null; + try { + in =3D new FileInputStream(temp); + out =3D new FileOutputStream(file); + int PAGESIZE =3D 4096; // Suggest a better size? + byte data[] =3D new byte[PAGESIZE]; + while (in.available() > 0) { + int numRead =3D in.read(data, 0, PAGESIZE); + out.write(data, 0, numRead); + } + renamed =3D 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 !=3D 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 =3D new Properties(); + if (options.verbose.value) { + props.put(EnhancerFilter.VERBOSE_LEVEL, + EnhancerFilter.VERBOSE_LEVEL_VERBOSE); + } + =20 + 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 =3D new EnhancerFilter(jdoMeta, props, out, err); + if (options.doTiming.value) { + // wrap with timing byte-code enhancer + enhancer =3D new ClassFileEnhancerTimer(enhancer); + } + } catch (EnhancerUserException ex) { + printlnErr("Error while creating the enhancer", ex,=20 + options.verbose.value); + throw ex; + } catch (EnhancerFatalError ex) { + // enhancer is not anymore guaranteed to be consistent + printlnErr("Fatal error while creating the enhancer", ex,=20 + options.verbose.value); + enhancer =3D null; + throw ex; + } catch (RuntimeException ex) { + // enhancer is not anymore guaranteed to be consistent + printlnErr("Internal error while creating the enhancer", ex,=20 + options.verbose.value); + enhancer =3D 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 =3D new PrintWriter(System.out, true); + out.println("--> EnhancerMain.main()"); + //out.println("JDO RI Class-File Enhancer"); + final EnhancerMain main =3D new EnhancerMain(out, out); + int res =3D main.run(args); + //out.println("done."); + out.println("<-- EnhancerMain.main(): exit =3D " + res); + System.exit(res); + } +}