db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/src/test/org/apache/ojb repository_database.xml repository.dtd repository.xml repository_junit.xml
Date Tue, 24 Dec 2002 13:55:55 GMT
arminw      2002/12/24 05:55:55

  Modified:    src/schema ojbtest-schema.xml
               src/test/org/apache/ojb repository.dtd repository.xml
                        repository_junit.xml
  Added:       src/test/org/apache/ojb repository_database.xml
  Log:
  improve metadata handling:
  separate the object stuff (class descriptor, field descriptor, ...)
  from the connection stuff (jdbc descriptor).
  DescriptorRepository now handles only object
  specific properties.
  
  Do some performance improvements
  
  Revision  Changes    Path
  1.17      +4 -2      jakarta-ojb/src/schema/ojbtest-schema.xml
  
  Index: ojbtest-schema.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/schema/ojbtest-schema.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ojbtest-schema.xml	8 Dec 2002 12:22:40 -0000	1.16
  +++ ojbtest-schema.xml	24 Dec 2002 13:55:54 -0000	1.17
  @@ -28,8 +28,8 @@
       <column name="Beschreibung" type="VARCHAR" size="60"
               javaName="description"/>
     </table>
  -  
  -  
  +
  +
     <table name="Artikel"
            javaName="Article">
       <column name="Artikel_Nr" required="true" primaryKey="true" type="INTEGER"
  @@ -116,6 +116,8 @@
       <column name="ID" required="true" primaryKey="true" type="INTEGER"/>
       <column name="CLASS_NAME" type="VARCHAR" size="60"/>
       <column name="VALUE_" type="INTEGER"/>
  +    <column name="A_FIELD" type="VARCHAR" size="60"/>
  +    <column name="B_FIELD" type="VARCHAR" size="60"/>
     </table>
   
     <!-- Product Table for Tutorial 1, 2 & 4-->
  
  
  
  1.24      +50 -31    jakarta-ojb/src/test/org/apache/ojb/repository.dtd
  
  Index: repository.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/repository.dtd,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- repository.dtd	22 Dec 2002 17:12:22 -0000	1.23
  +++ repository.dtd	24 Dec 2002 13:55:54 -0000	1.24
  @@ -16,7 +16,7 @@
   	class-descriptor elements specify o/r mapping information for
   	persistent classes.
     -->
  -<!ELEMENT descriptor-repository (documentation?, jdbc-connection-descriptor, class-descriptor*)>
  +<!ELEMENT descriptor-repository (documentation?, database-repository?, jdbc-connection-descriptor*,
class-descriptor*)>
   <!--
       The isolation attribute defines the default isolation level for
       class-descriptor that do not define a specific isolation level.
  @@ -26,10 +26,9 @@
       avoid versions conflicts.
     -->
   <!ATTLIST descriptor-repository
  -	version (0.9.8) #REQUIRED
  -	isolation-level (read-uncommitted | read-committed |
  -                    repeatable-read | serializable |
  -                    optimistic) "read-uncommitted"
  +	version (0.9.9) #REQUIRED
  +	isolation-level (read-uncommitted | read-committed | repeatable-read |
  +	                 serializable | optimistic) "read-uncommitted"
   >
   
   <!--
  @@ -38,6 +37,8 @@
   -->
   <!ELEMENT documentation (#PCDATA)>
   
  +<!ELEMENT database-repository (jdbc-connection-descriptor*)>
  +
   <!--
   	The jdbc-connection-descriptor element specifies the default jdbc
   	connection for the repository. All class-descriptor elements that do not
  @@ -49,18 +50,34 @@
     -->
   <!ELEMENT jdbc-connection-descriptor (documentation?, connection-pool?)>
   <!--
  -	The platform attribute is used to define the specific
  -    RDBMS Platform. This attribute corresponds to a
  +    The jcdAlias attribute is a shortcut name for the defined connection
  +    descriptor. OJB use jcdAlias as key for the defined connections.
  +
  +    The default-connection attribute used to define if this connection
  +    should used as default connection with OJB. You could define only
  +    one connection as default connection. It is also possible to set
  +    the default connection at runtime using
  +    PersistenceBrokerFactory#setDefaultKey(...) method
  +
  +    The platform attribute is used to define the specific RDBMS Platform.
  +	This attribute corresponds to a
   	org.apache.ojb.broker.platforms.PlatformXXXImpl class.
   
   	The jdbc-level attribute is used to specify the Jdbc compliance
   	level of the used Jdbc driver.
   
  -	If a jndi-datasource-name for JNDI based lookup of
  -    Jdbc Connections is specified, the four attributes
  -    driver, protocol, subprotocol, dbalias
  -    used for Jdbc DriverManager based construction of
  -    Jdbc Connections must not be declared.
  +    The eager-release attribute was adopt to solve a problem occured when
  +    using OJB within JBoss (>=3.0). Only use within JBoss.
  +
  +    The batch-mode attribute allow to set batch mode modus global
  +    from the used connection. It is also possible to change
  +    batch mode at runtime, using the
  +    PB.serviceConnectionManager.setBatchMode(...) method.
  +
  +	If a jndi-datasource-name for JNDI based lookup of Jdbc Connections is
  +    specified, the four attributes driver, protocol, subprotocol, dbalias
  +    used for Jdbc DriverManager based construction of Jdbc Connections
  +    must not be declared.
   
       The username and password attributes are used as credentials
       for obtaining a jdbc connections.
  @@ -69,11 +86,13 @@
       using PBKey.java to obtain a PersistenceBroker
     -->
   <!ATTLIST jdbc-connection-descriptor
  -	platform (Db2 | Hsqldb | Informix | MsAccess | MsSQLServer |
  +	jcd-alias CDATA #REQUIRED
  +    default-connection (true | false) "false"
  +    platform (Db2 | Hsqldb | Informix | MsAccess | MsSQLServer |
   	          MySQL | Oracle | PostgreSQL | Sybase | Sapdb) "Hsqldb"
   	jdbc-level (1.0 | 2.0 | 3.0) "1.0"
   	eager-release (true | false) "false"
  -	batch-mode (true | false) "false"
  +    batch-mode (true | false) "false"
   
   	jndi-datasource-name CDATA #IMPLIED
   
  @@ -87,8 +106,8 @@
   >
   
   <!--
  -	The connection-pool element specifies the connection
  -    pooling parameter.
  +	The connection-pool element specifies the connection pooling
  +	parameter.
   -->
   <!ELEMENT connection-pool (documentation?)>
   <!--
  @@ -97,13 +116,11 @@
   	pool at one time. When non-positive, there is no limit.
   
   	maxIdle
  -	controls the maximum number of connections that can sit
  -    idle in the pool at any time. When non-positive,
  -    there is no limit
  +	controls the maximum number of connections that can sit idle in the
  +	pool at any time. When non-positive, there is no limit
   
   	maxWait
  -	max time block to get connection instance from pool,
  -    after that exception is thrown.
  +	max time block to get connection instance from pool, after that exception is thrown.
   	When non-positive, block till last judgement
   
   	whenExhaustedAction
  @@ -111,23 +128,19 @@
   	1 - block when pool is exhausted
   	2 - grow when pool is exhausted
   
  -
   	testOnBorrow
  -	The pool will attempt to validate each object before
  -    it is returned from the pool
  +	The pool will attempt to validate each object before it is returned from the pool
   
   	testOnReturn
  -	The pool will attempt to validate each object
  -    before it is returned to the pool
  +	The pool will attempt to validate each object before it is returned to the pool
   
   	testWhileIdle
   	Indicates whether or not idle objects should be validated.
   	Objects that fail to validate will be dropped from the pool
   
   	timeBetweenEvictionRunsMillis
  -	indicates how long the eviction thread should sleep before "runs"
  -    of examining idle objects. When non-positive, no eviction
  -    thread will be launched.
  +	indicates how long the eviction thread should sleep before "runs" of examining
  +	idle objects. When non-positive, no eviction thread will be launched.
   
   	minEvictableIdleTimeMillis
   	specifies the minimum amount of time that a connection may sit idle
  @@ -138,6 +151,11 @@
   	numTestsPerEvictionRun
   	The number of connections to examine during each run of the
   	idle object evictor thread (if any)
  +
  +    validationQuery
  +    Here you could specify a validation query used by pool to test a
  +    obtained connection (e.g. "select 1 from dual"), else a default query was
  +    used - if defined in the platform class for your database.
   -->
   <!ATTLIST connection-pool
       maxActive                       CDATA #IMPLIED
  @@ -150,6 +168,7 @@
       testWhileIdle                   (true|false) #IMPLIED
       timeBetweenEvictionRunsMillis   CDATA #IMPLIED
       whenExhaustedAction             (0|1|2) #IMPLIED
  +    validationQuery                 CDATA #IMPLIED
   >
   
   
  @@ -413,7 +432,7 @@
     -->
   <!ELEMENT collection-descriptor (
       documentation?,
  - 	orderby*,
  +    orderby*,
       inverse-foreignkey*,
   	fk-pointing-to-this-class*,
   	fk-pointing-to-element-class*,
  @@ -526,4 +545,4 @@
     -->
   <!ATTLIST fk-pointing-to-element-class
   	column CDATA #REQUIRED
  ->
  \ No newline at end of file
  +>
  
  
  
  1.10      +11 -19    jakarta-ojb/src/test/org/apache/ojb/repository.xml
  
  Index: repository.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/repository.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- repository.xml	22 Dec 2002 15:59:44 -0000	1.9
  +++ repository.xml	24 Dec 2002 13:55:54 -0000	1.10
  @@ -4,6 +4,7 @@
   
   <!-- defining entities for include-files -->
   <!DOCTYPE descriptor-repository SYSTEM "repository.dtd" [
  +<!ENTITY database SYSTEM "repository_database.xml">
   <!ENTITY user SYSTEM "repository_user.xml">
   <!ENTITY junit SYSTEM "repository_junit.xml">
   <!ENTITY internal SYSTEM "repository_internal.xml">
  @@ -11,32 +12,23 @@
   ]>
   
   
  -<descriptor-repository version="0.9.8" isolation-level="read-uncommitted">
  +<descriptor-repository version="0.9.9" isolation-level="read-uncommitted">
   <!-- The Default JDBC Connection. If a class-descriptor does not specify its own JDBC
Connection,
        the Connection specified here will be used. -->
   
  -   <jdbc-connection-descriptor
  -   		platform="@DBMS_NAME@"
  -   		jdbc-level="@JDBC_LEVEL@"
  -   		driver="@DRIVER_NAME@"
  -   		protocol="@URL_PROTOCOL@"
  -   		subprotocol="@URL_SUBPROTOCOL@"
  -   		dbalias="@URL_DBALIAS@"
  -   		username="@USER_NAME@"
  -   		password="@USER_PASSWD@"
  -   		batch-mode="false"
  -   />
  -
  -    <!-- include user defined mappings here -->
  -    &user; 
  +    <!-- include all used database connections -->
  +    &database;
   
       <!-- include mappings for JUnit tests here -->
  -    &junit; 
  +    &junit;
   
       <!-- include ojb internal mappings here -->
       &internal;
   
  -	<!-- user data of farAway db -->
  -    &farAway; 
  +	<!-- user data of farAway test db -->
  +    &farAway;
  +
  +    <!-- include user defined mappings here -->
  +    <!-- &user; -->
   
  -</descriptor-repository>
  +</descriptor-repository>
  \ No newline at end of file
  
  
  
  1.32      +16 -3     jakarta-ojb/src/test/org/apache/ojb/repository_junit.xml
  
  Index: repository_junit.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/repository_junit.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- repository_junit.xml	22 Dec 2002 17:12:22 -0000	1.31
  +++ repository_junit.xml	24 Dec 2002 13:55:54 -0000	1.32
  @@ -65,15 +65,17 @@
         	 <attribute attribute-name="color" attribute-value="green" />
         	 <attribute attribute-name="size" attribute-value="small" />
         </field-descriptor>
  +
         <reference-descriptor
  -         name="productGroup"
  -         class-ref="org.apache.ojb.broker.ProductGroup"
  +            name="productGroup"
  +            class-ref="org.apache.ojb.broker.ProductGroup"
         >
            <documentation>this is the reference to an articles productgroup</documentation>
            <foreignkey field-id-ref="4"/>
            <attribute attribute-name="color" attribute-value="red" />
         	 <attribute attribute-name="size" attribute-value="tiny" />
         </reference-descriptor>
  +
         <attribute attribute-name="color" attribute-value="blue" />
         <attribute attribute-name="size" attribute-value="big" />
      </class-descriptor>
  @@ -373,7 +375,8 @@
         <reference-descriptor
            name="productGroup"
            class-ref="org.apache.ojb.broker.ProductGroup"
  -	 proxy="true"
  +         proxy="true"
  +         auto-update="true"
         >
            <foreignkey field-id-ref="4"/>
         </reference-descriptor>
  @@ -401,6 +404,11 @@
            column="VALUE_"
            jdbc-type="INTEGER"
         />
  +      <field-descriptor id="4"
  +         name="someAField"
  +         column="A_FIELD"
  +         jdbc-type="VARCHAR"
  +      />
      </class-descriptor>
   
   <!-- Definitions for org.apache.ojb.broker.B -->
  @@ -425,6 +433,11 @@
            name="someValue"
            column="VALUE_"
            jdbc-type="INTEGER"
  +      />
  +      <field-descriptor id="4"
  +         name="someBField"
  +         column="B_FIELD"
  +         jdbc-type="VARCHAR"
         />
      </class-descriptor>
   
  
  
  
  1.1                  jakarta-ojb/src/test/org/apache/ojb/repository_database.xml
  
  Index: repository_database.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <database-repository>
  <!--
  Define here all used connections.
  One defined connection should be defined as the default one,
  by set default-connection="true" - this could be done at runtime too.
  
  It is possible to set user/password at
  runtime or let login different users at runtime using the same
  database. Use different PBKey with same jcdAlias name but
  different user/password.
  
  Ditto it is possible to add jdbc-connection-descriptor at runtime
  using the MetadataManager.
  -->
  
  
      <!-- this connection was used as the default one within OJB  -->
      <jdbc-connection-descriptor
     		jcd-alias="@JCD_ALIAS@"
          default-connection="true"
          platform="@DBMS_NAME@"
     		jdbc-level="@JDBC_LEVEL@"
     		driver="@DRIVER_NAME@"
     		protocol="@URL_PROTOCOL@"
     		subprotocol="@URL_SUBPROTOCOL@"
     		dbalias="@URL_DBALIAS@"
     		username="@USER_NAME@"
     		password="@USER_PASSWD@"
          batch-mode="false"
       >
  
          <connection-pool
              validationQuery="@VALIDATION_QUERY@" />
     </jdbc-connection-descriptor>
  
      <!-- A test db connections used for junit tests -->
  	 <jdbc-connection-descriptor
          jcd-alias="farAway"
     		platform="Hsqldb"
     		jdbc-level="2.0"
     		driver="org.hsqldb.jdbcDriver"
     		protocol="jdbc"
     		subprotocol="hsqldb"
     		dbalias="../OJB_FarAway"
     		username="sa"
     		password=""
          batch-mode="false"
  	>
          <connection-pool
              maxActive="5"
              whenExhaustedAction="0"
          />
      </jdbc-connection-descriptor>
  
  </database-repository>
  
  

Mime
View raw message