You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2007/01/12 19:19:45 UTC
svn commit: r495677 [1/9] - in /db/ojb/trunk: ./ profile/
src/java/org/apache/ojb/broker/ src/java/org/apache/ojb/broker/accesslayer/
src/java/org/apache/ojb/broker/accesslayer/batch/
src/java/org/apache/ojb/broker/accesslayer/sql/ src/java/org/apache/...
Author: arminw
Date: Fri Jan 12 10:19:39 2007
New Revision: 495677
URL: http://svn.apache.org/viewvc?view=rev&rev=495677
Log:
- merge trunk with OJB 1.0.x branch
- continue work on caching
- continue work on batch handling
- introduce possibility to persist generic objects at runtime (used to populate the m:n indirection table)
Modified:
db/ojb/trunk/build.properties
db/ojb/trunk/build.xml
db/ojb/trunk/profile/hsqldb.profile
db/ojb/trunk/profile/maxdb.profile
db/ojb/trunk/profile/oracle.profile
db/ojb/trunk/profile/oracle9i.profile
db/ojb/trunk/src/java/org/apache/ojb/broker/ContainerHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java
db/ojb/trunk/src/java/org/apache/ojb/broker/OJB.java
db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBroker.java
db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java
db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceConfiguration.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryAbstractImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/QueryCustomizerDefaultImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ReferencePrefetcher.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RelationshipPrefetcherImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RowReader.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/StatementManagerImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchListener.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchManager.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchManagerImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchStrategy.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchStrategyBase.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/BatchStrategyDefaultImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/ReturnValueValidator.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/batch/ReturnValueValidatorImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/sql/SelectStatement.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/sql/SqlProcedureFKStatement.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/sql/SqlProcedureStatement.java
db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/AbstractObjectCache.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/CachingHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/CachingManager.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/InvalidationListener.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/MaterializationCache.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/ObjectCache.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/ObjectCacheEmptyImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/ObjectCacheJCSImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/ObjectCacheOSCacheImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/RuntimeCacheException.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/SessionCache.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/SessionCacheImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/cache/SessionEntry.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/DelegatingPersistenceBroker.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/IdentityFactoryImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/MtoNBroker.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/AbstractIndirectionHandler.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/ProxyFactory.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryCGLIBImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/proxy/ProxyFactoryJDKImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/locking/IsolationLevels.java
db/ojb/trunk/src/java/org/apache/ojb/broker/locking/LockManagerInMemoryImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ArgumentDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/AttributeContainer.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/AttributeDescriptorBase.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/BatchDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConnectionDescriptorXmlHandler.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ConnectionFactoryDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/DeleteProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/DescriptorBase.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldType.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/FieldTypes.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/IndexDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/InsertProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcType.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypes.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ObjectCacheDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByFKProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByPKProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SuperReferenceDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/UpdateProcedureDescriptor.java
db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/Platform.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDb2Impl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDerbyImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFactory.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformHsqldbImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformInformixImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMaxDBImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMckoiImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMsAccessImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMsSQLServerImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMySQLImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformOracleImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformPostgreSQLImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSapdbImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSybaseASAImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSybaseASEImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformSybaseImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/query/AbstractQueryImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/query/Query.java
db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByIdentityImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/UnwrapHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/dbhandling/DdlUtilslDatabaseHandling.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/HighLowSequence.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManager.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerException.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMSSQLGuidImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNativeImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
db/ojb/trunk/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerTransientImpl.java
db/ojb/trunk/src/java/org/apache/ojb/odmg/ObjectEnvelope.java
db/ojb/trunk/src/java/org/apache/ojb/odmg/collections/DListImpl.java
db/ojb/trunk/src/java/org/apache/ojb/odmg/collections/DSetImpl.java
Modified: db/ojb/trunk/build.properties
URL: http://svn.apache.org/viewvc/db/ojb/trunk/build.properties?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/build.properties (original)
+++ db/ojb/trunk/build.properties Fri Jan 12 10:19:39 2007
@@ -163,7 +163,7 @@
org.apache.ojb.junit,\
org.apache.ojb.performance
-copyright=(C) 2002 - 2006 Apache Software Foundation \
+copyright=(C) 2002 - 2007 Apache Software Foundation \
<br/>All rights reserved. Published under the Apache License 2.0. \
<br/><a href="http://db.apache.org/ojb">http://db.apache.org/ojb</a>
icon=<img src="../images/ojb-400-white.png" alt="ObJectRelationalBridge">
Modified: db/ojb/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/ojb/trunk/build.xml?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/build.xml (original)
+++ db/ojb/trunk/build.xml Fri Jan 12 10:19:39 2007
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-/* Copyright 2002-2004 Apache Software Foundation
+/* Copyright 2002-2007 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.
@@ -18,7 +18,7 @@
-->
<!-- @version $Id$ -->
-<project name="ObJectRelationalBridge" default="all" basedir=".">
+<project name="ObJectRelationalBridge" default="jar" basedir=".">
<description>
ObJectRelationalBridge ANT build configuration
@@ -94,6 +94,13 @@
</target>
<target name="environment-check" depends="detect-jdk">
+ <fail message="Please make JUnit available in the classpath, e.g. by copying the junit.jar from OJB's lib subdirectory into the lib subdirectory of your Ant installation (${env.ANT_HOME}/lib).">
+ <condition>
+ <not>
+ <available classname="junit.framework.TestCase"/>
+ </not>
+ </condition>
+ </fail>
<fail message="Please download the JDO 1.0.1 reference implementation from http://jcp.org/aboutJava/communityprocess/final/jsr012/index2.html and copy the jdo.jar, jdori.jar and jdori-enhancer.jar contained in the reference implementation binary archive, into OJB's lib directory.">
<condition>
<not>
@@ -221,7 +228,6 @@
<arg value="${JDBC}"/>
</java>
<replace dir="${build.src}" token="$$VERSION$$" value="${version}"/>
- <replace dir="${build.src}" token="$$VERSION$$" value="${version}"/>
<replace dir="${build.src}" token="$$MAJOR$$" value="${major}"/>
<replace dir="${build.src}" token="$$MINOR$$" value="${minor}"/>
<replace dir="${build.src}" token="$$BUILD$$" value="${build}"/>
@@ -343,9 +349,15 @@
<filter token="TEST_ON_BORROW" value="${testOnBorrow}" />
<filter token="TEST_ON_RETURN" value="${testOnReturn}" />
</filterset>
-
</copy>
- <copy file="${src.test}/org/apache/ojb/faraway-db/OJB_FarAway.properties" tofile="${build.test}/OJB_FarAway.properties"/>
+ <echo message="Preparing properties for database: ${dbmsName}"/>
+ <echo message=" --> jdbcLevel: ${jdbcLevel}"/>
+ <echo message=" --> jdbcRuntimeDriver: ${jdbcRuntimeDriver}"/>
+ <echo message=" --> urlProtocol: ${urlProtocol}"/>
+ <echo message=" --> urlSubprotocol: ${urlSubprotocol}"/>
+ <echo message=" --> urlDbalias: ${urlDbalias}"/>
+
+ <copy file="${src.test}/org/apache/ojb/faraway-db/OJB_FarAway.properties" tofile="${build.test}/OJB_FarAway.properties"/>
<copy file="${src.test}/org/apache/ojb/faraway-db/OJB_FarAway.script" tofile="${build.test}/OJB_FarAway.script"/>
</target>
@@ -836,6 +848,12 @@
<copy todir="${build.doc}">
<fileset dir="${src.forrest}"/>
</copy>
+
+ <!-- Prepare release-notes doc -->
+ <loadfile property="release-notes.content" srcfile="${basedir}/release-notes.txt"/>
+ <replace file="${build.doc}/src/documentation/content/xdocs/release-notes.xml" token="@@content@@" value="${release-notes.content}"/>
+
+
<!-- clean forrest build -->
<ant antfile="${env.FORREST_HOME}/main/forrest.build.xml"
dir="${build.doc}"
@@ -870,6 +888,7 @@
<param name="forrest-mode" value="site"/>
</antcall>
<!-- Finally we can copy the generated documentation to its designated place -->
+ <delete dir="${doc}"/>
<mkdir dir="${doc}"/>
<copy todir="${doc}">
<fileset dir="${forrest.output.dir}"/>
@@ -1416,8 +1435,8 @@
<ant target="copy-testdb"/>
</target>
- <!-- compile perf classes -->
<target name="perf-test-jar" depends="init">
+ <!-- compile perf classes -->
<javac srcdir="${build.srctest}"
includes="**/performance/*"
destdir="${build.desttest}"
@@ -1458,28 +1477,6 @@
</target>
<!-- ================================================================== -->
- <!-- start Florian's reverse db tool -->
- <!-- ================================================================== -->
- <target name="reverse-db"
- description="Starts the OJB RDBMS reverse engineering tool">
- <java fork="yes" classname="org.apache.ojb.tools.mapping.reversedb.Main"
- dir="${build.test}" taskname="reversedb" failonerror="false" >
- <classpath refid="runtime-classpath"/>
- </java>
- </target>
-
- <!-- ================================================================== -->
- <!-- start Florian's new reverse db tool -->
- <!-- ================================================================== -->
- <target name="reverse-db2"
- description="Starts the next generation OJB RDBMS reverse engineering tool">
- <java fork="yes" classname="org.apache.ojb.tools.mapping.reversedb2.Main"
- dir="${build.test}" taskname="reversedb2" failonerror="false" >
- <classpath refid="runtime-classpath"/>
- </java>
- </target>
-
- <!-- ================================================================== -->
<!-- Compiles the sample & tutorial classes -->
<!-- ================================================================== -->
<target name="compile-samples">
@@ -1612,6 +1609,28 @@
target="prepare-ejb-jar"/>
</target>
-->
+
+ <!-- ================================================================== -->
+ <!-- target for forward engineering from repository.xml -->
+ <!-- ================================================================== -->
+ <target name="forward" description="forward engineering from repository.xml" depends="">
+ <property name="input" value="repository.xml"/>
+ <property name="bean.output" value="forward/beans"/>
+ <property name="db.output" value="forward/xml"/>
+
+ <delete dir="${bean.output}" verbose="false"/>
+ <delete dir="${db.output}" verbose="false"/>
+ <mkdir dir="${bean.output}"/>
+ <mkdir dir="${db.output}"/>
+
+ <taskdef name="forward.repository"
+ classname="org.apache.ojb.tools.mapping.forward.ForwardRepositoryTask"
+ classpathref="runtime-classpath"/>
+ <forward.repository input="${input}"
+ beanOutput="${bean.output}"
+ dbOutput="${db.output}"/>
+ </target>
+
<!-- ================================================================== -->
<!-- sample target that demonstrates the ojb xdoclet module -->
<!-- ================================================================== -->
@@ -1750,5 +1769,27 @@
<!--</fileset>-->
<!--</jar>-->
<!--</target>-->
+
+ <!-- ================================================================== -->
+ <!-- start Florian's reverse db tool -->
+ <!-- ================================================================== -->
+ <!--<target name="reverse-db"-->
+ <!--description="Starts the OJB RDBMS reverse engineering tool">-->
+ <!--<java fork="yes" classname="org.apache.ojb.tools.mapping.reversedb.Main"-->
+ <!--dir="${build.test}" taskname="reversedb" failonerror="false" >-->
+ <!--<classpath refid="runtime-classpath"/>-->
+ <!--</java>-->
+ <!--</target>-->
+
+ <!-- ================================================================== -->
+ <!-- start Florian's new reverse db tool -->
+ <!-- ================================================================== -->
+ <!--<target name="reverse-db2"-->
+ <!--description="Starts the next generation OJB RDBMS reverse engineering tool">-->
+ <!--<java fork="yes" classname="org.apache.ojb.tools.mapping.reversedb2.Main"-->
+ <!--dir="${build.test}" taskname="reversedb2" failonerror="false" >-->
+ <!--<classpath refid="runtime-classpath"/>-->
+ <!--</java>-->
+ <!--</target>-->
</project>
Modified: db/ojb/trunk/profile/hsqldb.profile
URL: http://svn.apache.org/viewvc/db/ojb/trunk/profile/hsqldb.profile?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/profile/hsqldb.profile (original)
+++ db/ojb/trunk/profile/hsqldb.profile Fri Jan 12 10:19:39 2007
@@ -90,7 +90,7 @@
torque.database.user = sa
torque.database.password =
torque.database.host = 127.0.0.1
-
+ddlutils.shutdownDatabase = true
# Tells JDBC task that javaName attribute for the tables and columns
# should be made same as SQL name.
Modified: db/ojb/trunk/profile/maxdb.profile
URL: http://svn.apache.org/viewvc/db/ojb/trunk/profile/maxdb.profile?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/profile/maxdb.profile (original)
+++ db/ojb/trunk/profile/maxdb.profile Fri Jan 12 10:19:39 2007
@@ -90,8 +90,8 @@
torque.database.buildUrl = ${urlProtocol}:${urlSubprotocol}:${urlDbalias}
torque.database.url = ${urlProtocol}:${urlSubprotocol}:${urlDbalias}
torque.database.driver = com.sap.dbtech.jdbc.DriverSapDB
-torque.database.user = user
-torque.database.password = password
+torque.database.user = dba
+torque.database.password = dba
torque.database.host = 127.0.0.1
Modified: db/ojb/trunk/profile/oracle.profile
URL: http://svn.apache.org/viewvc/db/ojb/trunk/profile/oracle.profile?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/profile/oracle.profile (original)
+++ db/ojb/trunk/profile/oracle.profile Fri Jan 12 10:19:39 2007
@@ -79,11 +79,26 @@
# -------------------------------------------------------------------
dbmsName = Oracle
-jdbcLevel = 1.0
+jdbcLevel = 3.0
urlProtocol = jdbc
-urlSubprotocol = oracle
-urlDbalias = oci8:@(description=(address=(host=127.0.0.1)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))
-#urlDbalias = thin:@127.0.0.1:1521:orcl
+
+dbHost = 127.0.0.1
+dbPort = 1521
+#dbSID = ORACLE
+dbSID = XE
+
+# THIN
+urlSubprotocol = oracle:thin
+urlDbalias = @${dbHost}:${dbPort}:${dbSID}
+
+# OCI
+#urlSubprotocol = oracle:oci
+#urlDbalias = @MY_TNSNAME
+#urlDbalias = @(description=(address=(host=${dbHost})(protocol=tcp)(${dbPort}))(connect_data=(sid=${dbSID})))
+
+# validation query used to detect timed out connections
+# connection was checked when borrowed from pool
+#validationQuery=SELECT 1 FROM DUAL
#
# settings for torque 3.1.1
@@ -92,8 +107,8 @@
torque.database.buildUrl = ${urlProtocol}:${urlSubprotocol}:${urlDbalias}
torque.database.url = ${urlProtocol}:${urlSubprotocol}:${urlDbalias}
torque.database.driver = oracle.jdbc.driver.OracleDriver
-torque.database.user = scott
-torque.database.password = tiger
+torque.database.user = ojb
+torque.database.password = ojb
torque.database.host = 127.0.0.1
# Tells JDBC task that javaName attribute for the tables and columns
Modified: db/ojb/trunk/profile/oracle9i.profile
URL: http://svn.apache.org/viewvc/db/ojb/trunk/profile/oracle9i.profile?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
Binary files - no diff available.
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/ContainerHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/ContainerHelper.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/ContainerHelper.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/ContainerHelper.java Fri Jan 12 10:19:39 2007
@@ -51,6 +51,7 @@
import org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl;
import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
import org.apache.ojb.broker.core.PersistenceBrokerImpl;
+import org.apache.ojb.broker.core.CollectionTypes;
import org.apache.ojb.broker.core.configuration.ComponentContainer;
import org.apache.ojb.broker.core.factory.ObjectFactory;
import org.apache.ojb.broker.core.factory.ObjectFactoryDefaultImpl;
@@ -207,6 +208,8 @@
ImplementationExt.class.getName() + ".impliciteWriteLocks");
_translationMap.put("Ordering",
ImplementationExt.class.getName() + ".ordering");
+ _translationMap.put("OptimizedTransientObjectDetection",
+ ImplementationExt.class.getName() + ".optimizedTransientObjectDetection");
_translationMap.put("LockManagerOdmgClass",
org.apache.ojb.odmg.locking.LockManager.class.getName() + ".class");
_translationMap.put("DListClass",
@@ -225,6 +228,21 @@
_translationMap.put("JTATransactionManagerClass",
TransactionManagerFactory.class.getName() + ".class");
+
+ _translationMap.put("CollectionTypes.OneToManyArray", CollectionTypes.class.getName() + ".oneToManyArray");
+ _translationMap.put("CollectionTypes.OneToManyCollection", CollectionTypes.class.getName() + ".oneToManyCollection");
+ _translationMap.put("CollectionTypes.OneToManyList", CollectionTypes.class.getName() + ".oneToManyList");
+ _translationMap.put("CollectionTypes.OneToManyVector", CollectionTypes.class.getName() + ".oneToManyVector");
+ _translationMap.put("CollectionTypes.OneToManySet", CollectionTypes.class.getName() + ".oneToManySet");
+
+ _translationMap.put("CollectionTypes.ManyToManyArray", CollectionTypes.class.getName() + ".manyToManyArray");
+ _translationMap.put("CollectionTypes.ManyToManyCollection", CollectionTypes.class.getName() + ".manyToManyCollection");
+ _translationMap.put("CollectionTypes.ManyToManyList", CollectionTypes.class.getName() + ".manyToManyList");
+ _translationMap.put("CollectionTypes.ManyToManyVector", CollectionTypes.class.getName() + ".manyToManyVector");
+ _translationMap.put("CollectionTypes.ManyToManySet", CollectionTypes.class.getName() + ".manyToManySet");
+
+ _translationMap.put("CollectionTypes.Query", CollectionTypes.class.getName() + ".query");
+ _translationMap.put("CollectionTypes.OQLQuery", CollectionTypes.class.getName() + ".OQLQuery");
}
/**
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java Fri Jan 12 10:19:39 2007
@@ -15,24 +15,15 @@
* limitations under the License.
*/
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Map;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.SystemUtils;
-import org.apache.ojb.broker.core.ValueContainer;
-import org.apache.ojb.broker.core.proxy.IndirectionHandler;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException;
import org.apache.ojb.broker.metadata.FieldDescriptor;
-import org.apache.ojb.broker.util.BrokerHelper;
/**
* Represents the identity of an object.
@@ -95,7 +86,7 @@
*/
private Object[] m_pkValues;
- private final int isTransient;
+ private final int persistenceState;
/*
the hashcode of different objects has to be unique across different
@@ -113,7 +104,7 @@
*/
protected Identity()
{
- isTransient = IS_TRANSIENT;
+ persistenceState = IS_TRANSIENT;
}
/**
@@ -134,7 +125,7 @@
m_objectsTopLevelClass = topLevel;
m_objectsRealClass = realClass;
m_pkValues = pkValues;
- this.isTransient = isTransient ? IS_TRANSIENT : IS_PERMANENT;
+ this.persistenceState = isTransient ? IS_TRANSIENT : IS_PERMANENT;
checkForPrimaryKeys(null);
}
@@ -159,7 +150,7 @@
m_objectsTopLevelClass = topLevel;
m_objectsRealClass = targetClass.isMappedToTable() ? targetClass.getClassOfObject() : null;
m_pkValues = values;
- this.isTransient = IS_PERMANENT;
+ this.persistenceState = IS_PERMANENT;
checkForPrimaryKeys(null);
}
@@ -179,124 +170,18 @@
m_objectsTopLevelClass = topLevel;
m_objectsRealClass = realClass;
m_pkValues = pkValues;
- this.isTransient = IS_PERMANENT;
+ this.persistenceState = IS_PERMANENT;
checkForPrimaryKeys(null);
}
/**
- * Constructor for internal use. Use {@link IdentityFactory} to create an object identity.
- *
- * @param objectToIdentitify The object for which to create the identity
- * @param targetBroker The persistence broker
- */
- public Identity(final Object objectToIdentitify, final PersistenceBroker targetBroker)
- {
- this.isTransient = IS_PERMANENT;
- init(objectToIdentitify, targetBroker, null);
- }
-
- /**
- * Constructor for internal use. Use {@link IdentityFactory} to create an object identity.
- *
- * @param objectToIdentitify The object for which to create the identity
- * @param targetBroker The persistence broker
- * @param cld The class descriptor
- */
- public Identity(final Object objectToIdentitify, final PersistenceBroker targetBroker, final ClassDescriptor cld)
- {
- this.isTransient = IS_PERMANENT;
- init(objectToIdentitify, targetBroker, cld);
- }
-
- private void init(final Object objectToIdentify, final PersistenceBroker targetBroker, ClassDescriptor cld)
- {
- if(objectToIdentify == null) throw new OJBRuntimeException("Can't create Identity for 'null'-object");
- try
- {
- final IndirectionHandler handler = targetBroker.getConfiguration().getOjb().getProxyFactory().getIndirectionHandler(objectToIdentify);
-
- synchronized(objectToIdentify)
- {
- if (handler != null)
- {
- final Identity sourceOID = handler.getIdentity();
- m_objectsTopLevelClass = sourceOID.m_objectsTopLevelClass;
- m_objectsRealClass = sourceOID.m_objectsRealClass;
- m_pkValues = sourceOID.m_pkValues;
- }
- else
- {
- if (cld == null)
- {
- cld = targetBroker.getClassDescriptor(objectToIdentify.getClass());
- }
-
- // identities must be unique accross extents !
- m_objectsTopLevelClass = targetBroker.getTopLevelClass(objectToIdentify.getClass());
- m_objectsRealClass = objectToIdentify.getClass();
-
- // BRJ: definitely do NOT convertToSql
- // conversion is done when binding the sql-statement
- final BrokerHelper helper = targetBroker.serviceBrokerHelper();
- final ValueContainer[] pkValues = helper.getValuesForObject(cld.getPkFields(), objectToIdentify, false, true);
- if (pkValues == null || pkValues.length == 0)
- {
- throw createException("Can't extract PK value fields", objectToIdentify, null);
- }
- m_pkValues = helper.extractValueArray(pkValues);
- }
- }
-
- checkForPrimaryKeys(objectToIdentify);
- }
- catch (ClassNotPersistenceCapableException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw createException("Can not init Identity for given object.", objectToIdentify, e);
- }
- }
-
- /**
- * Factory method that returns an Identity object created from a serializated representation.
- *
- * @param anArray The serialized representation
- * @return The identity
- * @see {@link #serialize}.
- * @deprecated
- */
- public static Identity fromByteArray(final byte[] anArray) throws PersistenceBrokerException
- {
- // reverse of the serialize() algorithm:
- // read from byte[] with a ByteArrayInputStream, decompress with
- // a GZIPInputStream and then deserialize by reading from the ObjectInputStream
- try
- {
- final ByteArrayInputStream bais = new ByteArrayInputStream(anArray);
- final GZIPInputStream gis = new GZIPInputStream(bais);
- final ObjectInputStream ois = new ObjectInputStream(gis);
- final Identity result = (Identity) ois.readObject();
- ois.close();
- gis.close();
- bais.close();
- return result;
- }
- catch (Exception ex)
- {
- throw new PersistenceBrokerException(ex);
- }
- }
-
- /**
* Determines whether the identity is transient.
*
* @return <code>true</code> if the identity is transient
*/
public boolean isTransient()
{
- return isTransient == IS_TRANSIENT;
+ return persistenceState == IS_TRANSIENT;
}
/**
@@ -332,36 +217,6 @@
}
/**
- * Return the serialized form of this Identity.
- *
- * @return The serialized representation
- * @see #fromByteArray
- * @deprecated
- */
- public byte[] serialize() throws PersistenceBrokerException
- {
- // Identity is serialized and written to an ObjectOutputStream
- // This ObjectOutputstream is compressed by a GZIPOutputStream
- // and finally written to a ByteArrayOutputStream.
- // the resulting byte[] is returned
- try
- {
- final ByteArrayOutputStream bao = new ByteArrayOutputStream();
- final GZIPOutputStream gos = new GZIPOutputStream(bao);
- final ObjectOutputStream oos = new ObjectOutputStream(gos);
- oos.writeObject(this);
- oos.close();
- gos.close();
- bao.close();
- return bao.toByteArray();
- }
- catch (Exception ignored)
- {
- throw new PersistenceBrokerException(ignored);
- }
- }
-
- /**
* return a String representation.
* @return java.lang.String
*/
@@ -377,7 +232,7 @@
buf.append(m_pkValues[i]);
}
buf.append("}");
- if(isTransient == IS_TRANSIENT) buf.append("-transient");
+ if(persistenceState == IS_TRANSIENT) buf.append("-transient");
m_stringRepresentation = buf.toString();
}
return m_stringRepresentation;
@@ -398,9 +253,6 @@
{
throw createException("OJB needs at least one primary key attribute for class: ", realObject, null);
}
-// arminw: should never happen
-// if(m_pkValues[0] instanceof ValueContainer)
-// throw new OJBRuntimeException("Can't handle pk values of type "+ValueContainer.class.getName());
}
/**
@@ -424,7 +276,7 @@
if (obj instanceof Identity)
{
final Identity id = (Identity) obj;
- result = m_objectsTopLevelClass.equals(id.m_objectsTopLevelClass) && isTransient == id.isTransient;
+ result = m_objectsTopLevelClass.equals(id.m_objectsTopLevelClass) && persistenceState == id.persistenceState;
if(result)
{
final Object[] otherPkValues = id.m_pkValues;
@@ -460,7 +312,7 @@
*/
if(m_hashCode == null)
{
- int iTotal = isTransient;
+ int iTotal = persistenceState;
Object obj;
for (int i = 0; i < m_pkValues.length; i++)
{
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/OJB.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/OJB.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/OJB.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/OJB.java Fri Jan 12 10:19:39 2007
@@ -30,7 +30,6 @@
import org.apache.ojb.broker.core.proxy.SetProxy;
import org.apache.ojb.broker.locking.LockManager;
import org.apache.ojb.broker.metadata.MetadataManager;
-import org.apache.ojb.broker.metadata.ObjectCacheDescriptor;
import org.apache.ojb.broker.metadata.PersistenceConfigurationDescriptor;
import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
@@ -53,16 +52,6 @@
{
/** Default filename of the OJB properties file */
public static final String DEFAULT_PROPERTIES_FILE = "OJB.properties";
- /**
- * Force INSERT on {@link PersistenceBroker#store(Object, org.apache.ojb.broker.util.ObjectModification)}
- * method.
- */
- public static final ObjectModification INSERT = ObjectModification.INSERT;
- /**
- * Force UPDATE on {@link PersistenceBroker#store(Object, org.apache.ojb.broker.util.ObjectModification)}
- * method.
- */
- public static final ObjectModification UPDATE = ObjectModification.UPDATE;
private Logger log = LoggerFactory.getLogger(OJB.class);
@@ -91,7 +80,7 @@
/**
* Creates a new OJB runtime that uses the given container, or more
* precisely a child container of it.
- *
+ *
* @param container The container
* @param loadConf Whether to load the configuration properties from
* the OJB.properties file
@@ -104,8 +93,8 @@
/**
* Initializes the static part of the runtime system, e.g. sets default mappings
- * and loads the properties from an external file (if requested).
- *
+ * and loads the properties from an external file (if requested).
+ *
* @param loadConf Whether to load the configuration from an external file
*/
private void initStaticSystem(boolean loadConf)
@@ -166,7 +155,7 @@
* Returns the value of a configuration property. Note that using this method does not result in the
* initialization of the runtime. This means that the properties may not have been loaded yet from
* the OJB.properties file.
- *
+ *
* @param name The property name
* @return The property value
*/
@@ -178,7 +167,7 @@
/**
* Sets a configuration property. Note that this is only possible prior to using
* any OJB functionality, e.g. accessing the persistence configuration or broker.
- *
+ *
* @param name The property name
* @param value The property value
* @param force Whether to override an existing value
@@ -194,7 +183,7 @@
/**
* Returns the component container.
- *
+ *
* @return The container
*/
public ComponentContainer getComponentContainer()
@@ -210,7 +199,7 @@
/**
* Returns the proxy factory.
- *
+ *
* @return The proxy factory
*/
public ProxyFactory getProxyFactory()
@@ -299,7 +288,7 @@
* or <code>null</code> if a default configuration was set.
* @return The associated configuration
*/
- public PersistenceConfiguration getConfiguration(PBKey key) throws ConfigurationException
+ public synchronized PersistenceConfiguration getConfiguration(PBKey key) throws ConfigurationException
{
initDynamicSystem();
@@ -327,7 +316,7 @@
return conf;
}
- private synchronized PersistenceConfiguration createPersistenceConfiguration(PBKey key) throws ConfigurationException
+ private PersistenceConfiguration createPersistenceConfiguration(PBKey key) throws ConfigurationException
{
// check again, make sure that no other thread has created same PC
PersistenceConfiguration conf = (PersistenceConfiguration) configurationMap.get(key);
@@ -347,7 +336,7 @@
3. many models for the same JCD --> Different CachingManager for each model, but invalidation
of cached objects one another CachingManager#registerForObjectInvalidation)
*/
- CachingManager cm = new CachingManager(conf);
+ CachingManager cm = new CachingManager(conf.getJdbcConnectionDescriptor().getObjectCacheDescriptor());
conf.setCachingManager(cm);
return conf;
}
@@ -428,7 +417,7 @@
* @return A {@link PersistenceBroker} instance obtained from the
* {@link org.apache.ojb.broker.core.PersistenceBrokerFactoryIF}.
*/
- public PersistenceBroker lookupBroker()
+ public PersistenceBrokerInternal lookupBroker()
{
initDynamicSystem();
return lookupBroker(metadataManager.getDefaultPBKey());
@@ -440,7 +429,7 @@
* @param key The {@link PBKey} to determine the {@link org.apache.ojb.broker.PersistenceConfiguration}
* @return The broker instance for the specified configuration.
*/
- public PersistenceBroker lookupBroker(PBKey key)
+ public PersistenceBrokerInternal lookupBroker(PBKey key)
{
initDynamicSystem();
try
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBroker.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBroker.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBroker.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBroker.java Fri Jan 12 10:19:39 2007
@@ -23,15 +23,14 @@
import org.apache.ojb.broker.accesslayer.StatementManager;
import org.apache.ojb.broker.accesslayer.batch.BatchManager;
import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
-import org.apache.ojb.broker.cache.ObjectCache;
import org.apache.ojb.broker.cache.SessionCache;
+import org.apache.ojb.broker.lob.LobHelper;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.DescriptorRepository;
import org.apache.ojb.broker.query.Query;
import org.apache.ojb.broker.util.BrokerHelper;
import org.apache.ojb.broker.util.ObjectModification;
import org.apache.ojb.broker.util.sequence.SequenceManager;
-import org.apache.ojb.broker.lob.LobHelper;
import org.odbms.ObjectContainer;
/**
@@ -109,15 +108,6 @@
public BrokerHelper serviceBrokerHelper();
/**
- * Returns the {@link org.apache.ojb.broker.cache.ObjectCache} instance associated
- * with this broker.
- *
- * @return The object cache
- * @deprecated use {@link #serviceSessionCache()} instead.
- */
- public ObjectCache serviceObjectCache();
-
- /**
* Returns the used {@link org.apache.ojb.broker.cache.SessionCache} instance.
*
* @return The session cache object.
@@ -179,9 +169,9 @@
/**
- * Adds a temporary {@link org.apache.ojb.broker.PBListener}
- * to this PersistenceBroker instance - when PersistenceBroker.close() was
- * called the listener was removed.
+ * Adds a temporary {@link org.apache.ojb.broker.PBListener} to this broker.
+ * Note that temporary listeners will be removed upon closing a broker (returning
+ * it to the pool).
*
* @param listener The listener to add
* @see #addListener(org.apache.ojb.broker.PBListener listener, boolean permanent)
@@ -387,30 +377,30 @@
*/
public void delete(Object obj) throws PersistenceBrokerException;
- /**
- * Deletes an m:n implementor which defines the relationship between two persistent objects.
- * This is usually a row in an indirection table.<br/>
- * Note that OJB currently doesn't handle collection inheritance, so collections descriptors
- * are written per class. We try to match one of these collection descriptors, iterating from the left side
- * and looking for possible for classes on the right side using isAssignableFrom(rightClass).
- *
- * TODO: handle cache problems
- * TODO: delete more than one row if possible
- *
- * @param m2nImpl The m:n implementor to delete
- */
- public void deleteMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException;
-
- /**
- * Stores the given m:n implementor int the underlying persistence system.
- * This is usually done by inserting a row in an indirection table.<br/>
- * Note that OJB currently doesn't handle collection inheritance, so collections descriptors
- * are written per class. We try to match one of these collection descriptors, iterating from the left side
- * and looking for possible for classes on the right side using isAssignableFrom(rightClass).
- *
- * @param m2nImpl The m:n implementor to delete
- */
- public void addMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException;
+// /**
+// * Deletes an m:n implementor which defines the relationship between two persistent objects.
+// * This is usually a row in an indirection table.<br/>
+// * Note that OJB currently doesn't handle collection inheritance, so collections descriptors
+// * are written per class. We try to match one of these collection descriptors, iterating from the left side
+// * and looking for possible for classes on the right side using isAssignableFrom(rightClass).
+// *
+// * TODO: handle cache problems
+// * TODO: delete more than one row if possible
+// *
+// * @param m2nImpl The m:n implementor to delete
+// */
+// public void deleteMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException;
+//
+// /**
+// * Stores the given m:n implementor int the underlying persistence system.
+// * This is usually done by inserting a row in an indirection table.<br/>
+// * Note that OJB currently doesn't handle collection inheritance, so collections descriptors
+// * are written per class. We try to match one of these collection descriptors, iterating from the left side
+// * and looking for possible for classes on the right side using isAssignableFrom(rightClass).
+// *
+// * @param m2nImpl The m:n implementor to delete
+// */
+// public void addMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException;
/**
* Deletes all objects matching the given query, from the underlying persistence system.
@@ -494,14 +484,30 @@
public OJBIterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException;
/**
- * Retrieve a persistent object from the underlying datastore by its identity. However, users
- * are encouraged to use {@link #getObjectByQuery(Query)} instead, as this method is mainly
- * intended to be used for internal handling of materialization by OID (e.g. in Proxies).
- *
- * @param id The persistent object's id
- * @return The persistent object
- */
- public Object getObjectByIdentity(Identity id) throws PersistenceBrokerException;
+ * Retrieve a persistent object from the underlying datastore by its identity. It's also possible
+ * to use {@link #getObjectByQuery(Query)} instead (in the past this method is intended to be used
+ * for internal handling of materialization by OID - e.g. in Proxies, however it's straightforward
+ * to materialize objects by its identity without creating a query object).
+ *
+ * @param oid The persistent object's oid.
+ * @return The persistent object.
+ */
+ public Object getObjectByIdentity(Identity oid) throws PersistenceBrokerException;
+
+// TODO: Implement this method
+// /**
+// * Retrieve a persistent object from the underlying datastore by its identity. It's also possible
+// * to use {@link #getObjectByQuery(Query)} instead (in the past this method is intended to be used
+// * for internal handling of materialization by OID - e.g. in Proxies, however it's straightforward
+// * to materialize objects by its identity without creating a query object).
+// *
+// * @param oid The persistent object's oid.
+// * @param selectForUpdate If <em>true</em> a "SELECT ... FOR UPDATE" against the database is performed
+// * in any case. If <em>false</em> first a cache lookup will be performed and if no success a normal
+// * SELECT-clause is executed.
+// * @return The persistent object.
+// */
+// public Object getObjectByIdentity(Identity oid, boolean selectForUpdate) throws PersistenceBrokerException;
/**
* Retrieve the (first) persistent object from the underlying datastore that matches the given
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceBrokerInternal.java Fri Jan 12 10:19:39 2007
@@ -177,6 +177,19 @@
public void delete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException;
/**
+ * Deletes the persistence representation of the given object in the underlying
+ * persistence system. This method is intended for use in top-level apis internally.
+ *
+ * @param obj The object to delete.
+ * @param oid The {@link Identity} of the object.
+ * @param cld The {@link org.apache.ojb.broker.metadata.ClassDescriptor} of the object to delete.
+ * @param ignoreReferences Whether automatic deletion of contained references/collections (except
+ * super-references) shall be suppressed (independent of the auto-delete setting in the metadata).
+ */
+ public void delete(Object obj, Identity oid, ClassDescriptor cld , boolean ignoreReferences)
+ throws PersistenceBrokerException;
+
+ /**
* If <em>true</em> this instance is handled by a managed
* environment - registered within a JTA transaction.
*/
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceConfiguration.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceConfiguration.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceConfiguration.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/PersistenceConfiguration.java Fri Jan 12 10:19:39 2007
@@ -7,6 +7,7 @@
import org.apache.ojb.broker.accesslayer.RowReader;
import org.apache.ojb.broker.cache.CachingManager;
import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
+import org.apache.ojb.broker.core.CollectionTypes;
import org.apache.ojb.broker.core.configuration.ComponentContainer;
import org.apache.ojb.broker.core.factory.ObjectFactory;
import org.apache.ojb.broker.metadata.ClassDescriptor;
@@ -15,26 +16,30 @@
import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
import org.apache.ojb.broker.metadata.MetadataException;
import org.apache.ojb.broker.metadata.PersistenceConfigurationDescriptor;
+import org.apache.ojb.broker.metadata.SequenceDescriptor;
import org.apache.ojb.broker.util.ClassHelper;
-
+import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
+import org.apache.ojb.broker.util.sequence.SequenceManager;
+import org.apache.ojb.broker.util.sequence.PerFieldManager;
/* Copyright 2002-2004 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.
- */
+*
+* 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.
+*/
/**
- * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
+ *
+ *
* @version $Id$
*/
public class PersistenceConfiguration
@@ -49,6 +54,7 @@
/** The factory for creating collections */
private CollectionFactory collectionFactory;
private ObjectFactory objectFactory;
+ private SequenceManager sequenceManager;
/** Cache for row-reader objects keyed per class descriptor */
private HashMap rowReaderForClass = new HashMap();
@@ -56,9 +62,13 @@
{
this.pcd = pcd;
this.ojb = ojb;
-
subContainer = ojb.getComponentContainer().createChildContainer();
subContainer.setSingletonInstance(this);
+ init();
+ }
+
+ private void init()
+ {
subContainer.setSingletonInstance(pcd.getJdbcConnectionDescriptor());
subContainer.setSingletonInstance(pcd.getJdbcConnectionDescriptor().getPlatform());
@@ -71,7 +81,23 @@
connectionFactory = (ConnectionFactory) subContainer.getSingletonInstance(ConnectionFactory.class);
persistenceBrokerFactory = (PersistenceBrokerFactoryIF) subContainer.getSingletonInstance(PersistenceBrokerFactoryIF.class);
objectFactory = (ObjectFactory) subContainer.getSingletonInstance(ObjectFactory.class);
+
+ CollectionTypes types = (CollectionTypes) subContainer.getSingletonInstance(CollectionTypes.class);
collectionFactory = (CollectionFactory) subContainer.getSingletonInstance(CollectionFactory.class);
+ collectionFactory.setCollectionTypes(types);
+
+ SequenceDescriptor sd = pcd.getJdbcConnectionDescriptor().getSequenceDescriptor();
+ subContainer.setSingletonInstance(sd);
+ SequenceManager sm = SequenceManagerHelper.createManager(pcd.getJdbcConnectionDescriptor().getPlatform(), sd);
+ if(sd.isPerFieldSequences())
+ {
+ subContainer.setSingletonInstance(SequenceManager.class, new PerFieldManager(sm));
+ }
+ else
+ {
+ subContainer.setSingletonInstance(SequenceManager.class, sm);
+ }
+ sequenceManager = (SequenceManager) subContainer.getSingletonInstance(SequenceManager.class);
}
public PersistenceConfigurationDescriptor getPersistenceConfigurationDescriptor()
@@ -145,6 +171,17 @@
}
/**
+ * Returns the {@link org.apache.ojb.broker.util.sequence.SequenceManager}
+ * used by this persistence configuration.
+ *
+ * @return The sequence manager object.
+ */
+ public SequenceManager getSequenceManager()
+ {
+ return sequenceManager;
+ }
+
+ /**
* Returns the row reader object for the given class descriptor.
*
* @param classDesc The class descriptor
@@ -198,12 +235,16 @@
connectionFactory.releaseAllResources();
persistenceBrokerFactory.releaseAllInstances();
rowReaderForClass.clear();
- cachingManager.clearCaches();
+ cachingManager.evictAll();
+ init();
}
void shutdown()
{
// TODO: what should be done on shutdown?
- releaseAllInstances();
+ connectionFactory.releaseAllResources();
+ persistenceBrokerFactory.releaseAllInstances();
+ rowReaderForClass.clear();
+ cachingManager.evictAll();
}
}
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/CollectionPrefetcher.java Fri Jan 12 10:19:39 2007
@@ -68,7 +68,7 @@
{
PersistenceBroker pb = getBroker();
ClassDescriptor cld = getOwnerClassDescriptor();
- Class topLevelClass = pb.getTopLevelClass(cld.getClassOfObject());
+ Class topLevelClass = cld.getTopLevelClass();
Collection queries = new ArrayList(owners.size());
Collection idsSubset = new HashSet(owners.size());
Object[] fkValues;
@@ -143,7 +143,7 @@
IdentityFactory idFactory = pb.serviceIdentity();
CollectionDescriptor cds = getCollectionDescriptor();
PersistentField field = cds.getPersistentField();
- Class ownerTopLevelClass = pb.getTopLevelClass(getOwnerClassDescriptor().getClassOfObject());
+ Class ownerTopLevelClass = getOwnerClassDescriptor().getTopLevelClass();
Class collectionClass = cds.getCollectionClass(); // this collection type will be used:
HashMap ownerIdsToLists = new HashMap(owners.size());
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryAbstractImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryAbstractImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryAbstractImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryAbstractImpl.java Fri Jan 12 10:19:39 2007
@@ -172,7 +172,7 @@
// perform platform specific initializations:
try
{
- jcd.getPlatform().initializeJdbcConnection(jcd, con);
+ jcd.getPlatform().initializeJdbcConnection(con);
}
catch (PlatformException e)
{
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryDBCPImpl.java Fri Jan 12 10:19:39 2007
@@ -44,7 +44,6 @@
*
* (based on a proposal of Dirk Verbeek - Thanks).
*
- * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
* @version $Id$
*/
public class ConnectionFactoryDBCPImpl extends ConnectionFactoryAbstractImpl
@@ -200,13 +199,13 @@
}
// Get the configuration for the connection pool
- GenericObjectPool.Config conf = buildPoolConfiguration(jcd);
+ PoolConfiguration poolConf = new PoolConfiguration(jcd.getConnectionFactoryDescriptor().getPoolProperties());
// Get the additional abandoned configuration
AbandonedConfig ac = buildAbandonedConfiguration(jcd);
// Create the ObjectPool that serves as the actual pool of connections.
- final ObjectPool connectionPool = createConnectionPool(conf, ac);
+ final ObjectPool connectionPool = createConnectionPool(poolConf.getObjectPoolConfig(), ac);
// Create a DriverManager-based ConnectionFactory that
// the connectionPool will use to create Connection instances
@@ -236,7 +235,25 @@
defaultReadOnly,
defaultAutoCommit,
ac);
- return poolableConnectionFactory.getPool();
+ ObjectPool pool = poolableConnectionFactory.getPool();
+ // perform initial connection size
+ int initialSize = poolConf.getInitialSize();
+ if(initialSize > 0)
+ {
+ try
+ {
+ for (int i = 0 ; i < initialSize ; i++)
+ {
+ pool.addObject();
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error preloading the connection pool (initialSize=" + initialSize + ")", e);
+ }
+ log.info("Setup connection-pool initial size to " + initialSize);
+ }
+ return pool;
}
protected ObjectPool createConnectionPool(GenericObjectPool.Config config,
@@ -292,8 +309,8 @@
statementPoolFactory = new GenericKeyedObjectPoolFactory(null,
-1, // unlimited maxActive (per key)
GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL,
- 0, // maxWait
- 1, // maxIdle (per key)
+ GenericKeyedObjectPool.DEFAULT_MAX_WAIT, // maxWait
+ GenericKeyedObjectPool.DEFAULT_MAX_IDLE, // maxIdle (per key)
maxOpenPreparedStatements);
}
return statementPoolFactory;
@@ -336,13 +353,6 @@
dataSource.setLogWriter(loggerPiggyBack);
}
return dataSource;
- }
-
- private GenericObjectPool.Config buildPoolConfiguration(JdbcConnectionDescriptor jcd)
- {
- final Properties prop = jcd.getConnectionFactoryDescriptor().getPoolProperties();
- PoolConfiguration poolConf = new PoolConfiguration(prop);
- return poolConf.getObjectPoolConfig();
}
private AbandonedConfig buildAbandonedConfiguration(JdbcConnectionDescriptor jcd)
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java Fri Jan 12 10:19:39 2007
@@ -140,9 +140,27 @@
{
log.info("Create connection pool for " + getJcd());
}
- PoolableObjectFactory pof = new ConPoolFactory();
- GenericObjectPool.Config conf = buildPoolConfiguration(getJcd());
- op = new GenericObjectPool(pof, conf);
+ // create pool configuration helper class
+ PoolConfiguration poolConf = new PoolConfiguration(getJcd().getConnectionFactoryDescriptor().getPoolProperties());
+ op = new GenericObjectPool(new ConPoolFactory(), poolConf.getObjectPoolConfig());
+
+ // perform initial connection size
+ int initialSize = poolConf.getInitialSize();
+ if(initialSize > 0)
+ {
+ try
+ {
+ for (int i = 0 ; i < initialSize ; i++)
+ {
+ op.addObject();
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error preloading the connection pool (initialSize=" + initialSize + ")", e);
+ }
+ log.info("Setup connection-pool initial size to " + initialSize);
+ }
}
}
@@ -168,13 +186,6 @@
{
log.error("Error while clear connection pool", e);
}
- }
-
- private GenericObjectPool.Config buildPoolConfiguration(JdbcConnectionDescriptor jcd)
- {
- final Properties prop = jcd.getConnectionFactoryDescriptor().getPoolProperties();
- PoolConfiguration poolConf = new PoolConfiguration(prop);
- return poolConf.getObjectPoolConfig();
}
//**************************************************************************************
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/ConnectionManagerImpl.java Fri Jan 12 10:19:39 2007
@@ -150,7 +150,7 @@
if (jcd.getUseAutoCommit() == JdbcConnectionDescriptor.AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE)
{
if (log.isDebugEnabled()) log.debug("Try to change autoCommit state to 'false'");
- getSupportedPlatform().changeAutoCommitState(jcd, connection, false);
+ getSupportedPlatform().changeAutoCommitState(connection, false);
}
}
else
@@ -277,7 +277,7 @@
(con != null) &&
!con.isClosed())
{
- getSupportedPlatform().changeAutoCommitState(jcd, con, true);
+ getSupportedPlatform().changeAutoCommitState(con, true);
}
}
else
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/accesslayer/JdbcAccess.java Fri Jan 12 10:19:39 2007
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -23,6 +24,9 @@
import org.apache.ojb.broker.core.ValueContainer;
import org.apache.ojb.broker.metadata.ClassDescriptor;
import org.apache.ojb.broker.metadata.FieldDescriptor;
+import org.apache.ojb.broker.metadata.ProcedureDescriptor;
+import org.apache.ojb.broker.metadata.GenericDescriptor;
+import org.apache.ojb.broker.metadata.GenericObject;
import org.apache.ojb.broker.query.Query;
/**
@@ -159,14 +163,73 @@
public ResultSetAndStatement executePkQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException;
/**
- * For internal use! Bind the specified values to the prepared statement.
+ * Bind values to the callable statement IN/OUT parameter.
+ *
+ * @param cs The {@link java.sql.CallableStatement} to bind values.
+ * @param values The values to bind.
+ * @param index The index to start binding (Default start index should be 1).
+ * @param descriptor The {@link org.apache.ojb.broker.metadata.ProcedureDescriptor}
+ * or <em>null</em> if it doesn't exist.
+ * @return The next index after binding.
+ * @throws SQLException
+ */
+ public int bindValues(CallableStatement cs, ValueContainer[] values,
+ int index, ProcedureDescriptor descriptor) throws SQLException;
+
+ /**
+ * Bind values to the statements parameters.
*
* @param stmt The {@link java.sql.PreparedStatement} to bind values.
- * @param values The values to bind, if <em>null</em> the method return '0' immediately.
+ * @param values The values to bind, if <em>null</em> a {@link NullPointerException} will be thrown.
* @param index The index to start binding (Default start index should be 1).
- * @param isCallable If <em>true</em> indicate that the statement is a stored procedure.
* @return The next index after binding.
- * @throws java.sql.SQLException
+ * @throws SQLException
*/
- public int bindValues(PreparedStatement stmt, ValueContainer[] values, int index, boolean isCallable) throws SQLException;
+ public int bindValues(PreparedStatement stmt, ValueContainer[] values, int index) throws SQLException;
+
+ /**
+ * Performs an insert operation on the specified generic object.
+ *
+ * @param descriptor The {@link org.apache.ojb.broker.metadata.GenericDescriptor} instance.
+ * @param obj The object/the objects to insert.
+ * @return The row count for the <code>INSERT</code> operation.
+ */
+ public int executeInsert(GenericDescriptor descriptor, GenericObject obj);
+ /**
+ * Performs an update operation on the specified generic object.
+ *
+ * @param descriptor The {@link org.apache.ojb.broker.metadata.GenericDescriptor} instance.
+ * @param obj The object/the objects to insert.
+ * @return The row count for the <code>UPDATE</code> operation.
+ */
+ public int executeUpdate(GenericDescriptor descriptor, GenericObject obj);
+ /**
+ * Performs an delete operation on the specified generic object.
+ *
+ * @param descriptor The {@link org.apache.ojb.broker.metadata.GenericDescriptor} instance.
+ * @param obj The object/the objects to insert.
+ * @return The row count for the <code>DELETE</code> operation.
+ */
+ public int executeDelete(GenericDescriptor descriptor, GenericObject obj);
+
+// /**
+// * performs a primary key lookup operation against RDBMS and materializes
+// * an object from the resulting row. Only skalar attributes are filled from
+// * the row, references are not resolved.
+// *
+// * @param descriptor The {@link org.apache.ojb.broker.metadata.GenericDescriptor} instance.
+// * @param identifier The primary key values/the identifier of the object to find.
+// * @return the materialized object or <em>null</em> if no matching row was found or if any error occured.
+// */
+// public Object materializeObject(GenericDescriptor descriptor, ValueContainer[] identifier)
+// throws PersistenceBrokerException;
+//
+// /**
+// * Execute the specified sql-statement and returns the result after it
+// * passes method {@link org.apache.ojb.broker.metadata.GenericDescriptor#prepareQueryResult(org.apache.ojb.broker.accesslayer.ResultSetAndStatement)}.
+// * @param descriptor The generic descriptor.
+// * @param sql The sql query to perform.
+// * @return The prepared result of the query.
+// */
+// public Object executeGenericSQL(GenericDescriptor descriptor, String sql);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org