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 to...@apache.org on 2005/12/21 23:31:29 UTC

cvs commit: db-ojb/src/test/org/apache/ojb/junit PBTestCase.java

tomdz       2005/12/21 14:31:29

  Modified:    src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        QueryTest.java CharacterTest.java
                        EmptyTableTest.java HsqldbShutdown.java
                        Version.java FieldTypeTest.java M2NGraphTest.java
                        BlobTest.java
               src/test/org/apache/ojb/broker/cache Tag: OJB_1_0_RELEASE
                        LocalCacheTest.java
               src/test/org/apache/ojb/broker/locking Tag: OJB_1_0_RELEASE
                        LockManagerHelper.java
               src/test/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        PersistentFieldPerfTest.java
                        PersistentFieldTest.java
               src/jdori/org/apache/ojb/jdori/sql Tag: OJB_1_0_RELEASE
                        Helper.java OjbStoreConnector.java OjbStorePMF.java
                        OjbFieldManager.java OjbStoreManager.java
                        OjbStoreFatalInternalException.java OjbExtent.java
               src/prevayler/org/apache/ojb/broker/prevayler/demo Tag:
                        OJB_1_0_RELEASE UCQuitApplication.java UseCase.java
                        UCEnterNewProduct.java AbstractUseCase.java
                        Application.java UCDeleteProduct.java
                        UCEditProduct.java UCListAllProducts.java
               src/prevayler/org/apache/ojb/broker/prevayler Tag:
                        OJB_1_0_RELEASE Database.java PBPrevaylerImpl.java
                        CommandDelete.java CommandStore.java
               src/test/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        OQLOrOnForeignKeyTest.java CircularTest.java
               src/test/org/apache/ojb/broker/sqlcount Tag: OJB_1_0_RELEASE
                        AllTests.java
               src/test/org/apache/ojb/junit Tag: OJB_1_0_RELEASE
                        PBTestCase.java
  Log:
  Updated license
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.61.2.20 +2 -2      db-ojb/src/test/org/apache/ojb/broker/QueryTest.java
  
  Index: QueryTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/QueryTest.java,v
  retrieving revision 1.61.2.19
  retrieving revision 1.61.2.20
  diff -u -r1.61.2.19 -r1.61.2.20
  --- QueryTest.java	1 Dec 2005 21:26:19 -0000	1.61.2.19
  +++ QueryTest.java	21 Dec 2005 22:31:23 -0000	1.61.2.20
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.1.2.3   +2 -2      db-ojb/src/test/org/apache/ojb/broker/CharacterTest.java
  
  Index: CharacterTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/CharacterTest.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- CharacterTest.java	4 Mar 2005 23:33:47 -0000	1.1.2.2
  +++ CharacterTest.java	21 Dec 2005 22:31:23 -0000	1.1.2.3
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.1.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/EmptyTableTest.java
  
  Index: EmptyTableTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/EmptyTableTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- EmptyTableTest.java	13 Nov 2005 15:45:54 -0000	1.1.2.1
  +++ EmptyTableTest.java	21 Dec 2005 22:31:23 -0000	1.1.2.2
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.1.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/HsqldbShutdown.java
  
  Index: HsqldbShutdown.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/HsqldbShutdown.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- HsqldbShutdown.java	6 Oct 2005 21:01:44 -0000	1.1.2.1
  +++ HsqldbShutdown.java	21 Dec 2005 22:31:23 -0000	1.1.2.2
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2003-2004 The Apache Software Foundation
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.2.4.1   +15 -8     db-ojb/src/test/org/apache/ojb/broker/Version.java
  
  Index: Version.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/Version.java,v
  retrieving revision 1.2
  retrieving revision 1.2.4.1
  diff -u -r1.2 -r1.2.4.1
  --- Version.java	1 Aug 2002 18:13:15 -0000	1.2
  +++ Version.java	21 Dec 2005 22:31:23 -0000	1.2.4.1
  @@ -1,13 +1,20 @@
  -/*
  - * Created by IntelliJ IDEA.
  - * User: Matt
  - * Date: Jun 8, 2002
  - * Time: 3:25:04 PM
  - * To change template for new class use 
  - * Code Style | Class Templates options (Tools | IDE Options).
  - */
   package org.apache.ojb.broker;
   
  +/* Copyright 2002-2005 The Apache Software Foundation
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.io.Serializable;
   import java.util.Date;
   
  
  
  
  1.1.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/FieldTypeTest.java
  
  Index: FieldTypeTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/FieldTypeTest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- FieldTypeTest.java	2 Feb 2005 19:52:03 -0000	1.1.2.1
  +++ FieldTypeTest.java	21 Dec 2005 22:31:23 -0000	1.1.2.2
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2003-2004 The Apache Software Foundation
  +/* Copyright 2003-2005 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
  
  
  
  1.2.2.3   +2 -2      db-ojb/src/test/org/apache/ojb/broker/M2NGraphTest.java
  
  Index: M2NGraphTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/M2NGraphTest.java,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- M2NGraphTest.java	16 Aug 2005 15:11:33 -0000	1.2.2.2
  +++ M2NGraphTest.java	21 Dec 2005 22:31:23 -0000	1.2.2.3
  @@ -9,7 +9,7 @@
   import org.apache.ojb.broker.metadata.CollectionDescriptor;
   import org.apache.ojb.junit.PBTestCase;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.9.2.6   +2 -2      db-ojb/src/test/org/apache/ojb/broker/BlobTest.java
  
  Index: BlobTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BlobTest.java,v
  retrieving revision 1.9.2.5
  retrieving revision 1.9.2.6
  diff -u -r1.9.2.5 -r1.9.2.6
  --- BlobTest.java	15 Mar 2005 02:29:32 -0000	1.9.2.5
  +++ BlobTest.java	21 Dec 2005 22:31:23 -0000	1.9.2.6
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.2.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/cache/LocalCacheTest.java
  
  Index: LocalCacheTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/cache/LocalCacheTest.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- LocalCacheTest.java	23 Jan 2005 03:03:19 -0000	1.2.2.1
  +++ LocalCacheTest.java	21 Dec 2005 22:31:24 -0000	1.2.2.2
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker.cache;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.1.2.3   +1 -1      db-ojb/src/test/org/apache/ojb/broker/locking/LockManagerHelper.java
  
  Index: LockManagerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/locking/LockManagerHelper.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- LockManagerHelper.java	19 Feb 2005 21:49:55 -0000	1.1.2.2
  +++ LockManagerHelper.java	21 Dec 2005 22:31:24 -0000	1.1.2.3
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker.locking;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.4.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldPerfTest.java
  
  Index: PersistentFieldPerfTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldPerfTest.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- PersistentFieldPerfTest.java	8 Aug 2005 13:11:52 -0000	1.4.2.1
  +++ PersistentFieldPerfTest.java	21 Dec 2005 22:31:24 -0000	1.4.2.2
  @@ -11,7 +11,7 @@
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.ojb.junit.OJBTestCase;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.8.2.2   +2 -2      db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldTest.java
  
  Index: PersistentFieldTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/metadata/PersistentFieldTest.java,v
  retrieving revision 1.8.2.1
  retrieving revision 1.8.2.2
  diff -u -r1.8.2.1 -r1.8.2.2
  --- PersistentFieldTest.java	8 Aug 2005 13:11:52 -0000	1.8.2.1
  +++ PersistentFieldTest.java	21 Dec 2005 22:31:24 -0000	1.8.2.2
  @@ -20,7 +20,7 @@
   import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.junit.OJBTestCase;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.4.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/Helper.java
  
  Index: Helper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/Helper.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Helper.java	5 Apr 2004 00:18:36 -0000	1.4
  +++ Helper.java	21 Dec 2005 22:31:25 -0000	1.4.2.1
  @@ -12,7 +12,7 @@
   import com.sun.jdori.model.jdo.JDOClass;
   import com.sun.jdori.model.jdo.JDOModel;
   
  -/* Copyright 2003-2004 The Apache Software Foundation
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.4.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreConnector.java
  
  Index: OjbStoreConnector.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreConnector.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- OjbStoreConnector.java	5 Apr 2004 00:18:36 -0000	1.4
  +++ OjbStoreConnector.java	21 Dec 2005 22:31:25 -0000	1.4.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.5.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java
  
  Index: OjbStorePMF.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStorePMF.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- OjbStorePMF.java	5 Apr 2004 00:18:36 -0000	1.5
  +++ OjbStorePMF.java	21 Dec 2005 22:31:25 -0000	1.5.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.7.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbFieldManager.java
  
  Index: OjbFieldManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbFieldManager.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- OjbFieldManager.java	5 Apr 2004 00:18:36 -0000	1.7
  +++ OjbFieldManager.java	21 Dec 2005 22:31:25 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.8.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreManager.java
  
  Index: OjbStoreManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreManager.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- OjbStoreManager.java	5 Apr 2004 00:18:36 -0000	1.8
  +++ OjbStoreManager.java	21 Dec 2005 22:31:25 -0000	1.8.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.3.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreFatalInternalException.java
  
  Index: OjbStoreFatalInternalException.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbStoreFatalInternalException.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- OjbStoreFatalInternalException.java	5 Apr 2004 00:18:36 -0000	1.3
  +++ OjbStoreFatalInternalException.java	21 Dec 2005 22:31:25 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.4.2.1   +1 -1      db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbExtent.java
  
  Index: OjbExtent.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/jdori/org/apache/ojb/jdori/sql/OjbExtent.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- OjbExtent.java	5 Apr 2004 00:18:36 -0000	1.4
  +++ OjbExtent.java	21 Dec 2005 22:31:25 -0000	1.4.2.1
  @@ -1,5 +1,5 @@
   package org.apache.ojb.jdori.sql;
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +39 -39    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCQuitApplication.java
  
  Index: UCQuitApplication.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCQuitApplication.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UCQuitApplication.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UCQuitApplication.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,39 +14,39 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -/**
  - * implements Use Case "Quit Application".
  - * @author Thomas Mahler
  - */
  -public class UCQuitApplication extends AbstractUseCase
  -{
  -    /**
  -     * UCQuitApplication constructor comment.
  -     */
  -    public UCQuitApplication(org.apache.ojb.broker.PersistenceBroker b)
  -    {
  -        super(b);
  -    }
  -
  -    /**
  -     * apply method comment.
  -     */
  -    public void apply()
  -    {
  -        // release the broker in use
  -        broker.close();
  -        
  -        // no OJB API for quitting the application ;-)
  -        System.out.println("bye...");
  -        System.exit(0);
  -    }
  -
  -    /**
  -     * getDescription method comment.
  -     */
  -    public String getDescription()
  -    {
  -        return "Quit Application";
  -    }
  -}
  +
  +/**
  + * implements Use Case "Quit Application".
  + * @author Thomas Mahler
  + */
  +public class UCQuitApplication extends AbstractUseCase
  +{
  +    /**
  +     * UCQuitApplication constructor comment.
  +     */
  +    public UCQuitApplication(org.apache.ojb.broker.PersistenceBroker b)
  +    {
  +        super(b);
  +    }
  +
  +    /**
  +     * apply method comment.
  +     */
  +    public void apply()
  +    {
  +        // release the broker in use
  +        broker.close();
  +        
  +        // no OJB API for quitting the application ;-)
  +        System.out.println("bye...");
  +        System.exit(0);
  +    }
  +
  +    /**
  +     * getDescription method comment.
  +     */
  +    public String getDescription()
  +    {
  +        return "Quit Application";
  +    }
  +}
  
  
  
  1.3.2.1   +16 -16    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UseCase.java
  
  Index: UseCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UseCase.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UseCase.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UseCase.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,16 +14,16 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -/**
  - * Interface for application use cases.
  - * @author Thomas Mahler
  - */
  -public interface UseCase
  -{
  -    /** perform this use case*/
  -    public abstract void apply();
  -
  -    /** get descriptive information on use case*/
  -    public abstract String getDescription();
  -}
  +
  +/**
  + * Interface for application use cases.
  + * @author Thomas Mahler
  + */
  +public interface UseCase
  +{
  +    /** perform this use case*/
  +    public abstract void apply();
  +
  +    /** get descriptive information on use case*/
  +    public abstract String getDescription();
  +}
  
  
  
  1.3.2.1   +66 -66    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCEnterNewProduct.java
  
  Index: UCEnterNewProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCEnterNewProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UCEnterNewProduct.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UCEnterNewProduct.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,66 +14,66 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.tutorial1.Product;
  -
  -/**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  - */
  -public class UCEnterNewProduct extends AbstractUseCase
  -{
  -    /**
  -     * UCEnterNewProduct constructor comment.
  -     */
  -    public UCEnterNewProduct(PersistenceBroker broker)
  -    {
  -        super(broker);
  -    }
  -
  -    /** perform this use case*/
  -    public void apply()
  -    {
  -        // this will be our new object
  -        Product newProduct = new Product();
  -        
  -        // thma: attention, no sequence numbers yet for ojb/prevalyer        
  -        newProduct.setId((int)System.currentTimeMillis());
  -        
  -        // now read in all relevant information and fill the new object:
  -        System.out.println("please enter a new product");
  -        String in = readLineWithMessage("enter name:");
  -        newProduct.setName(in);
  -        in = readLineWithMessage("enter price:");
  -        newProduct.setPrice(Double.parseDouble(in));
  -        in = readLineWithMessage("enter available stock:");
  -        newProduct.setStock(Integer.parseInt(in));
  -
  -        // now perform persistence operations
  -        try
  -        {
  -            // 1. open transaction
  -            broker.beginTransaction();
  -
  -            // 2. make the new object persistent
  -            broker.store(newProduct);
  -            broker.commitTransaction();
  -        }
  -        catch (PersistenceBrokerException ex)
  -        {
  -            // if something went wrong: rollback
  -            broker.abortTransaction();
  -            System.out.println(ex.getMessage());
  -            ex.printStackTrace();
  -        }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Enter a new product";
  -    }
  -}
  +
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.tutorial1.Product;
  +
  +/**
  + * Insert the type's description here.
  + * Creation date: (04.03.2001 10:34:15)
  + * @author Thomas Mahler
  + */
  +public class UCEnterNewProduct extends AbstractUseCase
  +{
  +    /**
  +     * UCEnterNewProduct constructor comment.
  +     */
  +    public UCEnterNewProduct(PersistenceBroker broker)
  +    {
  +        super(broker);
  +    }
  +
  +    /** perform this use case*/
  +    public void apply()
  +    {
  +        // this will be our new object
  +        Product newProduct = new Product();
  +        
  +        // thma: attention, no sequence numbers yet for ojb/prevalyer        
  +        newProduct.setId((int)System.currentTimeMillis());
  +        
  +        // now read in all relevant information and fill the new object:
  +        System.out.println("please enter a new product");
  +        String in = readLineWithMessage("enter name:");
  +        newProduct.setName(in);
  +        in = readLineWithMessage("enter price:");
  +        newProduct.setPrice(Double.parseDouble(in));
  +        in = readLineWithMessage("enter available stock:");
  +        newProduct.setStock(Integer.parseInt(in));
  +
  +        // now perform persistence operations
  +        try
  +        {
  +            // 1. open transaction
  +            broker.beginTransaction();
  +
  +            // 2. make the new object persistent
  +            broker.store(newProduct);
  +            broker.commitTransaction();
  +        }
  +        catch (PersistenceBrokerException ex)
  +        {
  +            // if something went wrong: rollback
  +            broker.abortTransaction();
  +            System.out.println(ex.getMessage());
  +            ex.printStackTrace();
  +        }
  +    }
  +
  +    /** get descriptive information on use case*/
  +    public String getDescription()
  +    {
  +        return "Enter a new product";
  +    }
  +}
  
  
  
  1.3.2.1   +49 -49    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/AbstractUseCase.java
  
  Index: AbstractUseCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/AbstractUseCase.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- AbstractUseCase.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ AbstractUseCase.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,49 +14,49 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  - 
  -import org.apache.ojb.broker.PersistenceBroker;
  -
  -import java.io.BufferedReader;
  -import java.io.InputStreamReader;
  -
  -/**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 11:31:41)
  - * @author Thomas Mahler
  - */
  -public abstract class AbstractUseCase implements UseCase
  -{
  -    protected PersistenceBroker broker;
  -
  -    /**
  -     * AbstractUseCase constructor comment.
  -     */
  -    public AbstractUseCase(PersistenceBroker broker)
  -    {
  -        this.broker = broker;
  -    }
  -
  -    /** perform this use case*/
  -    public abstract void apply();
  -
  -    /** get descriptive information on use case*/
  -    public abstract String getDescription();
  -
  -    /**
  -     * read a single line from stdin and return as String
  -     */
  -    protected String readLineWithMessage(String message)
  -    {
  -        System.out.print(message + " ");
  -        try
  -        {
  -            BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
  -            return rin.readLine();
  -        }
  -        catch (Exception e)
  -        {
  -            return "";
  -        }
  -    }
  -}
  + 
  +import org.apache.ojb.broker.PersistenceBroker;
  +
  +import java.io.BufferedReader;
  +import java.io.InputStreamReader;
  +
  +/**
  + * Insert the type's description here.
  + * Creation date: (04.03.2001 11:31:41)
  + * @author Thomas Mahler
  + */
  +public abstract class AbstractUseCase implements UseCase
  +{
  +    protected PersistenceBroker broker;
  +
  +    /**
  +     * AbstractUseCase constructor comment.
  +     */
  +    public AbstractUseCase(PersistenceBroker broker)
  +    {
  +        this.broker = broker;
  +    }
  +
  +    /** perform this use case*/
  +    public abstract void apply();
  +
  +    /** get descriptive information on use case*/
  +    public abstract String getDescription();
  +
  +    /**
  +     * read a single line from stdin and return as String
  +     */
  +    protected String readLineWithMessage(String message)
  +    {
  +        System.out.print(message + " ");
  +        try
  +        {
  +            BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
  +            return rin.readLine();
  +        }
  +        catch (Exception e)
  +        {
  +            return "";
  +        }
  +    }
  +}
  
  
  
  1.3.2.1   +114 -114  db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/Application.java
  
  Index: Application.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/Application.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- Application.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ Application.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,114 +14,114 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  - 
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.util.ui.AsciiSplash;
  -
  -import java.io.BufferedReader;
  -import java.io.InputStreamReader;
  -import java.util.Vector;
  -/**
  - * The tutorial application.
  - * @author Thomas Mahler
  - */
  -public class Application
  -{
  -    private Vector useCases;
  -    private PersistenceBroker broker;
  -    /**
  -     * Application constructor comment.
  -     */
  -    public Application()
  -    {
  -        broker = null;
  -        try
  -        {
  -            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  -        }
  -        catch (Throwable t)
  -        {
  -            t.printStackTrace();
  -        }
  -        useCases = new Vector();
  -        useCases.add(new UCListAllProducts(broker));
  -        useCases.add(new UCEnterNewProduct(broker));
  -        useCases.add(new UCEditProduct(broker));
  -        useCases.add(new UCDeleteProduct(broker));
  -        useCases.add(new UCQuitApplication(broker));
  -    }
  -    /**
  -     * Disply available use cases.
  -     */
  -    public void displayUseCases()
  -    {
  -        System.out.println();
  -        for (int i = 0; i < useCases.size(); i++)
  -        {
  -            System.out.println("[" + i + "] " + ((UseCase) useCases.get(i)).getDescription());
  -        }
  -    }
  -    /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:40:25)
  -     * @param args java.lang.String[]
  -     */
  -    public static void main(String[] args)
  -    {
  -        Application app = new Application();
  -        app.run();
  -    }
  -    /**
  -     * read a single line from stdin and return as String
  -     */
  -    private String readLine()
  -    {
  -        try
  -        {
  -            BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
  -            return rin.readLine();
  -        }
  -        catch (Exception e)
  -        {
  -            return "";
  -        }
  -    }
  -    /**
  -     * the applications main loop.
  -     */
  -    public void run()
  -    {    	
  -    	System.out.println(AsciiSplash.getSplashArt());
  -        System.out.println("Welcome to the OJB PB tutorial application");
  -        System.out.println();
  -        // never stop (there is a special use case to quit the application)
  -        while (true)
  -        {
  -            try
  -            {
  -                // select a use case and perform it
  -                UseCase uc = selectUseCase();
  -                uc.apply();
  -            }
  -            catch (Throwable t)
  -            {
  -                broker.close();
  -                System.out.println(t.getMessage());
  -            }
  -        }
  -    }
  -    /**
  -     * select a use case.
  -     */
  -    public UseCase selectUseCase()
  -    {
  -        displayUseCases();
  -        System.out.println("type in number to select a use case");
  -        String in = readLine();
  -        int index = Integer.parseInt(in);
  -        return (UseCase) useCases.get(index);
  -    }
  -    
  -
  -}
  + 
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.util.ui.AsciiSplash;
  +
  +import java.io.BufferedReader;
  +import java.io.InputStreamReader;
  +import java.util.Vector;
  +/**
  + * The tutorial application.
  + * @author Thomas Mahler
  + */
  +public class Application
  +{
  +    private Vector useCases;
  +    private PersistenceBroker broker;
  +    /**
  +     * Application constructor comment.
  +     */
  +    public Application()
  +    {
  +        broker = null;
  +        try
  +        {
  +            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
  +        }
  +        catch (Throwable t)
  +        {
  +            t.printStackTrace();
  +        }
  +        useCases = new Vector();
  +        useCases.add(new UCListAllProducts(broker));
  +        useCases.add(new UCEnterNewProduct(broker));
  +        useCases.add(new UCEditProduct(broker));
  +        useCases.add(new UCDeleteProduct(broker));
  +        useCases.add(new UCQuitApplication(broker));
  +    }
  +    /**
  +     * Disply available use cases.
  +     */
  +    public void displayUseCases()
  +    {
  +        System.out.println();
  +        for (int i = 0; i < useCases.size(); i++)
  +        {
  +            System.out.println("[" + i + "] " + ((UseCase) useCases.get(i)).getDescription());
  +        }
  +    }
  +    /**
  +     * Insert the method's description here.
  +     * Creation date: (04.03.2001 10:40:25)
  +     * @param args java.lang.String[]
  +     */
  +    public static void main(String[] args)
  +    {
  +        Application app = new Application();
  +        app.run();
  +    }
  +    /**
  +     * read a single line from stdin and return as String
  +     */
  +    private String readLine()
  +    {
  +        try
  +        {
  +            BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
  +            return rin.readLine();
  +        }
  +        catch (Exception e)
  +        {
  +            return "";
  +        }
  +    }
  +    /**
  +     * the applications main loop.
  +     */
  +    public void run()
  +    {    	
  +    	System.out.println(AsciiSplash.getSplashArt());
  +        System.out.println("Welcome to the OJB PB tutorial application");
  +        System.out.println();
  +        // never stop (there is a special use case to quit the application)
  +        while (true)
  +        {
  +            try
  +            {
  +                // select a use case and perform it
  +                UseCase uc = selectUseCase();
  +                uc.apply();
  +            }
  +            catch (Throwable t)
  +            {
  +                broker.close();
  +                System.out.println(t.getMessage());
  +            }
  +        }
  +    }
  +    /**
  +     * select a use case.
  +     */
  +    public UseCase selectUseCase()
  +    {
  +        displayUseCases();
  +        System.out.println("type in number to select a use case");
  +        String in = readLine();
  +        int index = Integer.parseInt(in);
  +        return (UseCase) useCases.get(index);
  +    }
  +    
  +
  +}
  
  
  
  1.3.2.1   +62 -62    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCDeleteProduct.java
  
  Index: UCDeleteProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCDeleteProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UCDeleteProduct.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UCDeleteProduct.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,62 +14,62 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.query.QueryByIdentity;
  -import org.apache.ojb.tutorial1.Product;
  -
  -/**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  - */
  -public class UCDeleteProduct extends AbstractUseCase
  -{
  -    /**
  -     * UCEnterNewProduct constructor comment.
  -     */
  -    public UCDeleteProduct(org.apache.ojb.broker.PersistenceBroker b)
  -    {
  -        super(b);
  -    }
  -
  -    /** perform this use case*/
  -    public void apply()
  -    {
  -        String in = readLineWithMessage("Delete Product with id:");
  -        int id = Integer.parseInt(in);
  -
  -        // We don't have a reference to the selected Product.
  -        // So first we have to lookup the object,
  -        // we do this by a query by example (QBE):
  -        // 1. build an example object with matching primary key values:
  -        Product example = new Product();
  -        example.setId(id);
  -        // 2. build a QueryByIdentity from this sample instance:
  -        Query query = new QueryByIdentity(example);
  -        try
  -        {
  -            // start broker transaction
  -            broker.beginTransaction();
  -            // lookup the product specified by the QBE
  -            Product toBeDeleted = (Product) broker.getObjectByQuery(query);
  -            // now ask broker to delete the object
  -            broker.delete(toBeDeleted);
  -            // commit transaction
  -            broker.commitTransaction();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            broker.abortTransaction();
  -            t.printStackTrace();
  -        }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Delete a product entry";
  -    }
  -}
  +
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByIdentity;
  +import org.apache.ojb.tutorial1.Product;
  +
  +/**
  + * Insert the type's description here.
  + * Creation date: (04.03.2001 10:34:15)
  + * @author Thomas Mahler
  + */
  +public class UCDeleteProduct extends AbstractUseCase
  +{
  +    /**
  +     * UCEnterNewProduct constructor comment.
  +     */
  +    public UCDeleteProduct(org.apache.ojb.broker.PersistenceBroker b)
  +    {
  +        super(b);
  +    }
  +
  +    /** perform this use case*/
  +    public void apply()
  +    {
  +        String in = readLineWithMessage("Delete Product with id:");
  +        int id = Integer.parseInt(in);
  +
  +        // We don't have a reference to the selected Product.
  +        // So first we have to lookup the object,
  +        // we do this by a query by example (QBE):
  +        // 1. build an example object with matching primary key values:
  +        Product example = new Product();
  +        example.setId(id);
  +        // 2. build a QueryByIdentity from this sample instance:
  +        Query query = new QueryByIdentity(example);
  +        try
  +        {
  +            // start broker transaction
  +            broker.beginTransaction();
  +            // lookup the product specified by the QBE
  +            Product toBeDeleted = (Product) broker.getObjectByQuery(query);
  +            // now ask broker to delete the object
  +            broker.delete(toBeDeleted);
  +            // commit transaction
  +            broker.commitTransaction();
  +        }
  +        catch (Throwable t)
  +        {
  +            // rollback in case of errors
  +            broker.abortTransaction();
  +            t.printStackTrace();
  +        }
  +    }
  +
  +    /** get descriptive information on use case*/
  +    public String getDescription()
  +    {
  +        return "Delete a product entry";
  +    }
  +}
  
  
  
  1.3.2.1   +76 -76    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCEditProduct.java
  
  Index: UCEditProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCEditProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UCEditProduct.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UCEditProduct.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,76 +14,76 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.query.QueryByIdentity;
  -import org.apache.ojb.tutorial1.Product;
  -
  -/**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  - */
  -public class UCEditProduct extends AbstractUseCase
  -{
  -    /**
  -     * UCEditProduct constructor comment.
  -     */
  -    public UCEditProduct(org.apache.ojb.broker.PersistenceBroker b)
  -    {
  -        super(b);
  -    }
  -
  -    /** perform this use case*/
  -    public void apply()
  -    {
  -        String in = readLineWithMessage("Edit Product with id:");
  -        int id = Integer.parseInt(in);
  -
  -        // We don't have a reference to the selected Product.
  -        // So first we have to lookup the object,
  -        // we do this by a query by example (QBE):
  -        // 1. build an example object with matching primary key values:
  -        Product example = new Product();
  -        example.setId(id);
  -
  -        // 2. build a QueryByIdentity from this sample instance:
  -        Query query = new QueryByIdentity(example);
  -        try
  -        {
  -            // 3. start broker transaction
  -            broker.beginTransaction();
  -
  -            // 4. lookup the product specified by the QBE
  -            Product toBeEdited = (Product) broker.getObjectByQuery(query);
  -
  -            // 5. edit the existing entry
  -            System.out.println("please edit the product entry");
  -            in = readLineWithMessage("enter name (was " + toBeEdited.getName() + "):");
  -            toBeEdited.setName(in);
  -            in = readLineWithMessage("enter price (was " + toBeEdited.getPrice() + "):");
  -            toBeEdited.setPrice(Double.parseDouble(in));
  -            in = readLineWithMessage("enter available stock (was " + toBeEdited.getStock() + "):");
  -            toBeEdited.setStock(Integer.parseInt(in));
  -
  -
  -
  -            // 6. now ask broker to store the edited object
  -            broker.store(toBeEdited);
  -            // 7. commit transaction
  -            broker.commitTransaction();
  -        }
  -        catch (Throwable t)
  -        {
  -            // rollback in case of errors
  -            broker.abortTransaction();
  -            t.printStackTrace();
  -        }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Edit a product entry";
  -    }
  -}
  +
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByIdentity;
  +import org.apache.ojb.tutorial1.Product;
  +
  +/**
  + * Insert the type's description here.
  + * Creation date: (04.03.2001 10:34:15)
  + * @author Thomas Mahler
  + */
  +public class UCEditProduct extends AbstractUseCase
  +{
  +    /**
  +     * UCEditProduct constructor comment.
  +     */
  +    public UCEditProduct(org.apache.ojb.broker.PersistenceBroker b)
  +    {
  +        super(b);
  +    }
  +
  +    /** perform this use case*/
  +    public void apply()
  +    {
  +        String in = readLineWithMessage("Edit Product with id:");
  +        int id = Integer.parseInt(in);
  +
  +        // We don't have a reference to the selected Product.
  +        // So first we have to lookup the object,
  +        // we do this by a query by example (QBE):
  +        // 1. build an example object with matching primary key values:
  +        Product example = new Product();
  +        example.setId(id);
  +
  +        // 2. build a QueryByIdentity from this sample instance:
  +        Query query = new QueryByIdentity(example);
  +        try
  +        {
  +            // 3. start broker transaction
  +            broker.beginTransaction();
  +
  +            // 4. lookup the product specified by the QBE
  +            Product toBeEdited = (Product) broker.getObjectByQuery(query);
  +
  +            // 5. edit the existing entry
  +            System.out.println("please edit the product entry");
  +            in = readLineWithMessage("enter name (was " + toBeEdited.getName() + "):");
  +            toBeEdited.setName(in);
  +            in = readLineWithMessage("enter price (was " + toBeEdited.getPrice() + "):");
  +            toBeEdited.setPrice(Double.parseDouble(in));
  +            in = readLineWithMessage("enter available stock (was " + toBeEdited.getStock() + "):");
  +            toBeEdited.setStock(Integer.parseInt(in));
  +
  +
  +
  +            // 6. now ask broker to store the edited object
  +            broker.store(toBeEdited);
  +            // 7. commit transaction
  +            broker.commitTransaction();
  +        }
  +        catch (Throwable t)
  +        {
  +            // rollback in case of errors
  +            broker.abortTransaction();
  +            t.printStackTrace();
  +        }
  +    }
  +
  +    /** get descriptive information on use case*/
  +    public String getDescription()
  +    {
  +        return "Edit a product entry";
  +    }
  +}
  
  
  
  1.3.2.1   +55 -55    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCListAllProducts.java
  
  Index: UCListAllProducts.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/demo/UCListAllProducts.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- UCListAllProducts.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ UCListAllProducts.java	21 Dec 2005 22:31:26 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler.demo;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler.demo;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,55 +14,55 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.query.QueryByCriteria;
  -import org.apache.ojb.tutorial1.Product;
  -
  -import java.util.Collection;
  -
  -/**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  - */
  -public class UCListAllProducts extends AbstractUseCase
  -{
  -    /**
  -     * UCEnterNewProduct constructor comment.
  -     */
  -    public UCListAllProducts(org.apache.ojb.broker.PersistenceBroker b)
  -    {
  -        super(b);
  -    }
  -
  -    /** perform this use case*/
  -    public void apply()
  -    {
  -        System.out.println("The list of available products:");
  -        // build a query that select all objects of Class Product, without any further criteria
  -        // according to ODMG the Collection containing all instances of a persistent class is called "Extent"
  -        Query query = new QueryByCriteria(Product.class, null);
  -        try
  -        {
  -            // ask the broker to retrieve the Extent collection
  -            Collection allProducts = broker.getCollectionByQuery(query);
  -            // now iterate over the result to print each product
  -            java.util.Iterator iter = allProducts.iterator();
  -            while (iter.hasNext())
  -            {
  -                System.out.println(iter.next());
  -            }
  -        }
  -        catch (Throwable t)
  -        {
  -            t.printStackTrace();
  -        }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "List all product entries";
  -    }
  -}
  +
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByCriteria;
  +import org.apache.ojb.tutorial1.Product;
  +
  +import java.util.Collection;
  +
  +/**
  + * Insert the type's description here.
  + * Creation date: (04.03.2001 10:34:15)
  + * @author Thomas Mahler
  + */
  +public class UCListAllProducts extends AbstractUseCase
  +{
  +    /**
  +     * UCEnterNewProduct constructor comment.
  +     */
  +    public UCListAllProducts(org.apache.ojb.broker.PersistenceBroker b)
  +    {
  +        super(b);
  +    }
  +
  +    /** perform this use case*/
  +    public void apply()
  +    {
  +        System.out.println("The list of available products:");
  +        // build a query that select all objects of Class Product, without any further criteria
  +        // according to ODMG the Collection containing all instances of a persistent class is called "Extent"
  +        Query query = new QueryByCriteria(Product.class, null);
  +        try
  +        {
  +            // ask the broker to retrieve the Extent collection
  +            Collection allProducts = broker.getCollectionByQuery(query);
  +            // now iterate over the result to print each product
  +            java.util.Iterator iter = allProducts.iterator();
  +            while (iter.hasNext())
  +            {
  +                System.out.println(iter.next());
  +            }
  +        }
  +        catch (Throwable t)
  +        {
  +            t.printStackTrace();
  +        }
  +    }
  +
  +    /** get descriptive information on use case*/
  +    public String getDescription()
  +    {
  +        return "List all product entries";
  +    }
  +}
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +75 -75    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/Database.java
  
  Index: Database.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/Database.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- Database.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ Database.java	21 Dec 2005 22:31:27 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,75 +14,75 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -
  -import java.io.Serializable;
  -import java.util.Hashtable;
  -
  -import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.PersistenceBroker;
  -import org.prevayler.implementation.AbstractPrevalentSystem;
  -
  -/**
  - * This class represents the persistent store OJB works against.
  - * It is implement as an PrevalentSystem.
  - * All Commands executed this DB are tracked by Prevayler and written to disk
  - * as command-logs.
  - * If the system is halted, crashes or rebooted for what reason so ever, Prevayler
  - * will establish the state of the Database from the command-logs written to disk.
  - * @author Thomas Mahler
  - *
  - */
  -public class Database extends AbstractPrevalentSystem
  -{
  -	
  -	private final Hashtable table = new Hashtable();
  -	
  -	private transient PersistenceBroker broker;
  -	
  -	
  -	public void store(Object obj)
  -	{
  -		Identity oid = new Identity(obj,broker);
  -		this.getTable().put(oid.toString(), obj);
  -	}
  -	
  -	public void remove(Object obj)
  -	{
  -		Identity oid = new Identity(obj,broker);
  -		this.getTable().remove(oid.toString());
  -	}
  -	
  -	public Serializable lookupObjectByIdentity(Identity oid)
  -	{
  -		return (Serializable) this.getTable().get(oid.toString());	
  -	}
  -
  -    /**
  -     * Returns the table.
  -     * @return Hashtable
  -     */
  -    public Hashtable getTable()
  -    {
  -        return table;
  -    }
  -
  -    /**
  -     * Returns the broker.
  -     * @return PersistenceBroker
  -     */
  -    public PersistenceBroker getBroker()
  -    {
  -        return broker;
  -    }
  -
  -    /**
  -     * Sets the broker.
  -     * @param broker The broker to set
  -     */
  -    public void setBroker(PersistenceBroker broker)
  -    {
  -        this.broker = broker;
  -    }
  -
  -}
  +
  +
  +import java.io.Serializable;
  +import java.util.Hashtable;
  +
  +import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.PersistenceBroker;
  +import org.prevayler.implementation.AbstractPrevalentSystem;
  +
  +/**
  + * This class represents the persistent store OJB works against.
  + * It is implement as an PrevalentSystem.
  + * All Commands executed this DB are tracked by Prevayler and written to disk
  + * as command-logs.
  + * If the system is halted, crashes or rebooted for what reason so ever, Prevayler
  + * will establish the state of the Database from the command-logs written to disk.
  + * @author Thomas Mahler
  + *
  + */
  +public class Database extends AbstractPrevalentSystem
  +{
  +	
  +	private final Hashtable table = new Hashtable();
  +	
  +	private transient PersistenceBroker broker;
  +	
  +	
  +	public void store(Object obj)
  +	{
  +		Identity oid = new Identity(obj,broker);
  +		this.getTable().put(oid.toString(), obj);
  +	}
  +	
  +	public void remove(Object obj)
  +	{
  +		Identity oid = new Identity(obj,broker);
  +		this.getTable().remove(oid.toString());
  +	}
  +	
  +	public Serializable lookupObjectByIdentity(Identity oid)
  +	{
  +		return (Serializable) this.getTable().get(oid.toString());	
  +	}
  +
  +    /**
  +     * Returns the table.
  +     * @return Hashtable
  +     */
  +    public Hashtable getTable()
  +    {
  +        return table;
  +    }
  +
  +    /**
  +     * Returns the broker.
  +     * @return PersistenceBroker
  +     */
  +    public PersistenceBroker getBroker()
  +    {
  +        return broker;
  +    }
  +
  +    /**
  +     * Sets the broker.
  +     * @param broker The broker to set
  +     */
  +    public void setBroker(PersistenceBroker broker)
  +    {
  +        this.broker = broker;
  +    }
  +
  +}
  
  
  
  1.4.2.1   +349 -349  db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/PBPrevaylerImpl.java
  
  Index: PBPrevaylerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/PBPrevaylerImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- PBPrevaylerImpl.java	5 Apr 2004 00:21:13 -0000	1.4
  +++ PBPrevaylerImpl.java	21 Dec 2005 22:31:27 -0000	1.4.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,349 +14,349 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import java.io.File;
  -import java.io.IOException;
  -import java.io.Serializable;
  -import java.util.ArrayList;
  -import java.util.Collection;
  -import java.util.Enumeration;
  -import java.util.Iterator;
  -
  -import org.apache.ojb.broker.Identity;
  -import org.apache.ojb.broker.ManageableCollection;
  -import org.apache.ojb.broker.MtoNImplementor;
  -import org.apache.ojb.broker.PBKey;
  -import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.TransactionAbortedException;
  -import org.apache.ojb.broker.TransactionInProgressException;
  -import org.apache.ojb.broker.TransactionNotInProgressException;
  -import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
  -import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  -import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.query.QueryByIdentity;
  -import org.apache.ojb.broker.util.BrokerHelper;
  -import org.apache.ojb.broker.util.ObjectModification;
  -import org.prevayler.Command;
  -import org.prevayler.Prevayler;
  -import org.prevayler.implementation.SnapshotPrevayler;
  -
  -
  -/**
  - * An OJB PersistenBroker implementation working against a datastore
  - * that is persisted by Prevayler.
  - * So in other word, this is an OODBMS with a PB API.
  - * Of course you can use OJB/ODMG or OJB/JDO on top of it.
  - * 
  - * important note: this implementation is not finished. 
  - * Do not try to use it in production environments.
  - * 
  - * @author Thomas Mahler
  - */
  -public class PBPrevaylerImpl extends PersistenceBrokerImpl
  -{
  -
  -	private transient Database db;
  -	
  -	private Prevayler prevayler;
  -
  -	private ArrayList commandLog = new ArrayList(100);
  -	
  -	private boolean inTransaction = false;
  -
  -
  -    /**
  -     * Constructor for PBPrevaylerImpl.
  -     * @param key
  -     * @param pbf
  -     */
  -    public PBPrevaylerImpl(PBKey key, PersistenceBrokerFactoryIF pbf)
  -    {
  -    	super(key, pbf);
  -        refresh();
  -        if(key == null) throw new PersistenceBrokerException("Could not instantiate broker with PBKey 'null'");
  -        this.pbf = pbf;
  -        this.setPBKey(key);
  -
  -        brokerHelper = new BrokerHelper(this);
  -        //connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
  -        //objectCache = ObjectCacheFactory.getInstance().createObjectCache(this);
  -        //sequenceManager = SequenceManagerFactory.getSequenceManager(this);
  -        //dbAccess = JdbcAccessFactory.getInstance().createJdbcAccess(this);
  -        //statementManager = StatementManagerFactory.getInstance().createStatementManager(this);
  -        //sqlGenerator = SqlGeneratorFactory.getInstance().createSqlGenerator(connectionManager.getSupportedPlatform());
  -
  -        //markedForDelete = new ArrayList();        
  -        try
  -        {
  -             prevayler = new SnapshotPrevayler(new Database(), "PrevalenceBase" + File.separator + "Database");
  -             db = (Database) prevayler.system();	
  -             db.setBroker(this);
  -        }
  -        catch (Exception e)
  -        {
  -        }
  -    }
  -
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#abortTransaction()
  -	 */
  -	public void abortTransaction() throws TransactionNotInProgressException
  -	{
  -		if (! isInTransaction())
  -		{
  -			throw new TransactionNotInProgressException();
  -		}
  -		inTransaction = false;
  -		commandLog.clear();		
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#beginTransaction()
  -	 */
  -	public void beginTransaction()
  -		throws TransactionInProgressException, TransactionAbortedException
  -	{
  -		if (this.isInTransaction())
  -		{
  -			throw new TransactionInProgressException();
  -		}
  -		inTransaction = true;
  -		commandLog.clear();
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#commitTransaction()
  -	 */
  -    public void commitTransaction()
  -        throws TransactionNotInProgressException, TransactionAbortedException
  -    {
  -        if (!isInTransaction())
  -        {
  -            throw new TransactionNotInProgressException();
  -        }
  -
  -        Iterator iter = commandLog.iterator();
  -        try
  -        {
  -            while (iter.hasNext())
  -            {
  -                Command cmd = (Command) iter.next();
  -                prevayler.executeCommand(cmd);
  -            }
  -        }
  -        catch (Exception e)
  -        {
  -            this.abortTransaction();
  -        }
  -        inTransaction = false;
  -        commandLog.clear();
  -    }
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#isInTransaction()
  -	 */
  -	public boolean isInTransaction() throws PersistenceBrokerException
  -	{
  -		return inTransaction;
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#close()
  -	 */
  -	public boolean close()
  -	{
  -        if (isInTransaction())
  -        {
  -            abortTransaction();
  -        }
  -		try
  -        {
  -            ((SnapshotPrevayler)prevayler).takeSnapshot();
  -        }
  -        catch (IOException e)
  -        {
  -        }
  -        setClosed(true);
  -		return true;
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#clearCache()
  -	 */
  -	public void clearCache() throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#removeFromCache(Object)
  -	 */
  -	public void removeFromCache(Object obj) throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#store(Object, ObjectModification)
  -	 */
  -	public void store(Object obj, ObjectModification modification)
  -		throws PersistenceBrokerException
  -	{
  -		this.store(obj);
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#store(Object)
  -	 */
  -	public void store(Object obj) throws PersistenceBrokerException
  -	{
  -		if (! (obj instanceof Serializable))
  -		{
  -			throw new PersistenceBrokerException(obj.getClass().getName() + "does not implement java.io.Serializable.");
  -		}
  -		
  -		CommandStore cmd = new CommandStore(obj);
  -		commandLog.add(cmd);		
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#delete(Object)
  -	 */
  -	public void delete(Object obj) throws PersistenceBrokerException
  -	{
  -		Command cmd = new CommandDelete(obj);
  -		commandLog.add(cmd);
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#deleteMtoNImplementor(MtoNImplementor)
  -	 */
  -	public void deleteMtoNImplementor(MtoNImplementor m2nImpl)
  -		throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#addMtoNImplementor(MtoNImplementor)
  -	 */
  -	public void addMtoNImplementor(MtoNImplementor m2nImpl)
  -		throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#deleteByQuery(Query)
  -	 */
  -	public void deleteByQuery(Query query) throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveAllReferences(Object)
  -	 */
  -	public void retrieveAllReferences(Object pInstance)
  -		throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveReference(Object, String)
  -	 */
  -	public void retrieveReference(Object pInstance, String pAttributeName)
  -		throws PersistenceBrokerException
  -	{
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getCount(Query)
  -	 */
  -	public int getCount(Query query) throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Query)
  -	 */
  -	public Collection getCollectionByQuery(Query query)
  -		throws PersistenceBrokerException
  -	{
  -		// needs some more work ;-)
  -		return db.getTable().values();
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Class, Query)
  -	 */
  -	public ManageableCollection getCollectionByQuery(
  -		Class collectionClass,
  -		Query query)
  -		throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getIteratorByQuery(Query)
  -	 */
  -	public Iterator getIteratorByQuery(Query query)
  -		throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getReportQueryIteratorByQuery(Query)
  -	 */
  -	public Iterator getReportQueryIteratorByQuery(Query query)
  -		throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getObjectByIdentity(Identity)
  -	 */
  -	public Object getObjectByIdentity(Identity id)
  -		throws PersistenceBrokerException
  -	{
  -		return db.lookupObjectByIdentity(id);
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getObjectByQuery(Query)
  -	 */
  -	public Object getObjectByQuery(Query query)
  -		throws PersistenceBrokerException
  -	{
  -		if (query instanceof QueryByIdentity)
  -		{
  -			Object id = ((QueryByIdentity) query).getExampleObject();
  -			if (! (id instanceof Identity))
  -			{
  -				id = new Identity(id,PersistenceBrokerFactory.defaultPersistenceBroker());	
  -			}			
  -			Identity oid = (Identity) id;
  -			return db.lookupObjectByIdentity(oid);
  -		}
  -		else
  -		{
  -			throw new PersistenceBrokerException("not yet implemented");	
  -		}
  -	}
  -
  -	/**
  -	 * @see org.apache.ojb.broker.PersistenceBroker#getPKEnumerationByQuery(Class, Query)
  -	 */
  -	public Enumeration getPKEnumerationByQuery(
  -		Class PrimaryKeyClass,
  -		Query query)
  -		throws PersistenceBrokerException
  -	{
  -		throw new PersistenceBrokerException("not yet implemented");
  -	}
  -
  -
  -}
  +
  +import java.io.File;
  +import java.io.IOException;
  +import java.io.Serializable;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.Enumeration;
  +import java.util.Iterator;
  +
  +import org.apache.ojb.broker.Identity;
  +import org.apache.ojb.broker.ManageableCollection;
  +import org.apache.ojb.broker.MtoNImplementor;
  +import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.TransactionAbortedException;
  +import org.apache.ojb.broker.TransactionInProgressException;
  +import org.apache.ojb.broker.TransactionNotInProgressException;
  +import org.apache.ojb.broker.core.PersistenceBrokerFactoryIF;
  +import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  +import org.apache.ojb.broker.query.Query;
  +import org.apache.ojb.broker.query.QueryByIdentity;
  +import org.apache.ojb.broker.util.BrokerHelper;
  +import org.apache.ojb.broker.util.ObjectModification;
  +import org.prevayler.Command;
  +import org.prevayler.Prevayler;
  +import org.prevayler.implementation.SnapshotPrevayler;
  +
  +
  +/**
  + * An OJB PersistenBroker implementation working against a datastore
  + * that is persisted by Prevayler.
  + * So in other word, this is an OODBMS with a PB API.
  + * Of course you can use OJB/ODMG or OJB/JDO on top of it.
  + * 
  + * important note: this implementation is not finished. 
  + * Do not try to use it in production environments.
  + * 
  + * @author Thomas Mahler
  + */
  +public class PBPrevaylerImpl extends PersistenceBrokerImpl
  +{
  +
  +	private transient Database db;
  +	
  +	private Prevayler prevayler;
  +
  +	private ArrayList commandLog = new ArrayList(100);
  +	
  +	private boolean inTransaction = false;
  +
  +
  +    /**
  +     * Constructor for PBPrevaylerImpl.
  +     * @param key
  +     * @param pbf
  +     */
  +    public PBPrevaylerImpl(PBKey key, PersistenceBrokerFactoryIF pbf)
  +    {
  +    	super(key, pbf);
  +        refresh();
  +        if(key == null) throw new PersistenceBrokerException("Could not instantiate broker with PBKey 'null'");
  +        this.pbf = pbf;
  +        this.setPBKey(key);
  +
  +        brokerHelper = new BrokerHelper(this);
  +        //connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
  +        //objectCache = ObjectCacheFactory.getInstance().createObjectCache(this);
  +        //sequenceManager = SequenceManagerFactory.getSequenceManager(this);
  +        //dbAccess = JdbcAccessFactory.getInstance().createJdbcAccess(this);
  +        //statementManager = StatementManagerFactory.getInstance().createStatementManager(this);
  +        //sqlGenerator = SqlGeneratorFactory.getInstance().createSqlGenerator(connectionManager.getSupportedPlatform());
  +
  +        //markedForDelete = new ArrayList();        
  +        try
  +        {
  +             prevayler = new SnapshotPrevayler(new Database(), "PrevalenceBase" + File.separator + "Database");
  +             db = (Database) prevayler.system();	
  +             db.setBroker(this);
  +        }
  +        catch (Exception e)
  +        {
  +        }
  +    }
  +
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#abortTransaction()
  +	 */
  +	public void abortTransaction() throws TransactionNotInProgressException
  +	{
  +		if (! isInTransaction())
  +		{
  +			throw new TransactionNotInProgressException();
  +		}
  +		inTransaction = false;
  +		commandLog.clear();		
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#beginTransaction()
  +	 */
  +	public void beginTransaction()
  +		throws TransactionInProgressException, TransactionAbortedException
  +	{
  +		if (this.isInTransaction())
  +		{
  +			throw new TransactionInProgressException();
  +		}
  +		inTransaction = true;
  +		commandLog.clear();
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#commitTransaction()
  +	 */
  +    public void commitTransaction()
  +        throws TransactionNotInProgressException, TransactionAbortedException
  +    {
  +        if (!isInTransaction())
  +        {
  +            throw new TransactionNotInProgressException();
  +        }
  +
  +        Iterator iter = commandLog.iterator();
  +        try
  +        {
  +            while (iter.hasNext())
  +            {
  +                Command cmd = (Command) iter.next();
  +                prevayler.executeCommand(cmd);
  +            }
  +        }
  +        catch (Exception e)
  +        {
  +            this.abortTransaction();
  +        }
  +        inTransaction = false;
  +        commandLog.clear();
  +    }
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#isInTransaction()
  +	 */
  +	public boolean isInTransaction() throws PersistenceBrokerException
  +	{
  +		return inTransaction;
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#close()
  +	 */
  +	public boolean close()
  +	{
  +        if (isInTransaction())
  +        {
  +            abortTransaction();
  +        }
  +		try
  +        {
  +            ((SnapshotPrevayler)prevayler).takeSnapshot();
  +        }
  +        catch (IOException e)
  +        {
  +        }
  +        setClosed(true);
  +		return true;
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#clearCache()
  +	 */
  +	public void clearCache() throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#removeFromCache(Object)
  +	 */
  +	public void removeFromCache(Object obj) throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#store(Object, ObjectModification)
  +	 */
  +	public void store(Object obj, ObjectModification modification)
  +		throws PersistenceBrokerException
  +	{
  +		this.store(obj);
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#store(Object)
  +	 */
  +	public void store(Object obj) throws PersistenceBrokerException
  +	{
  +		if (! (obj instanceof Serializable))
  +		{
  +			throw new PersistenceBrokerException(obj.getClass().getName() + "does not implement java.io.Serializable.");
  +		}
  +		
  +		CommandStore cmd = new CommandStore(obj);
  +		commandLog.add(cmd);		
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#delete(Object)
  +	 */
  +	public void delete(Object obj) throws PersistenceBrokerException
  +	{
  +		Command cmd = new CommandDelete(obj);
  +		commandLog.add(cmd);
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#deleteMtoNImplementor(MtoNImplementor)
  +	 */
  +	public void deleteMtoNImplementor(MtoNImplementor m2nImpl)
  +		throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#addMtoNImplementor(MtoNImplementor)
  +	 */
  +	public void addMtoNImplementor(MtoNImplementor m2nImpl)
  +		throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#deleteByQuery(Query)
  +	 */
  +	public void deleteByQuery(Query query) throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveAllReferences(Object)
  +	 */
  +	public void retrieveAllReferences(Object pInstance)
  +		throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#retrieveReference(Object, String)
  +	 */
  +	public void retrieveReference(Object pInstance, String pAttributeName)
  +		throws PersistenceBrokerException
  +	{
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getCount(Query)
  +	 */
  +	public int getCount(Query query) throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Query)
  +	 */
  +	public Collection getCollectionByQuery(Query query)
  +		throws PersistenceBrokerException
  +	{
  +		// needs some more work ;-)
  +		return db.getTable().values();
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Class, Query)
  +	 */
  +	public ManageableCollection getCollectionByQuery(
  +		Class collectionClass,
  +		Query query)
  +		throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getIteratorByQuery(Query)
  +	 */
  +	public Iterator getIteratorByQuery(Query query)
  +		throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getReportQueryIteratorByQuery(Query)
  +	 */
  +	public Iterator getReportQueryIteratorByQuery(Query query)
  +		throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getObjectByIdentity(Identity)
  +	 */
  +	public Object getObjectByIdentity(Identity id)
  +		throws PersistenceBrokerException
  +	{
  +		return db.lookupObjectByIdentity(id);
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getObjectByQuery(Query)
  +	 */
  +	public Object getObjectByQuery(Query query)
  +		throws PersistenceBrokerException
  +	{
  +		if (query instanceof QueryByIdentity)
  +		{
  +			Object id = ((QueryByIdentity) query).getExampleObject();
  +			if (! (id instanceof Identity))
  +			{
  +				id = new Identity(id,PersistenceBrokerFactory.defaultPersistenceBroker());	
  +			}			
  +			Identity oid = (Identity) id;
  +			return db.lookupObjectByIdentity(oid);
  +		}
  +		else
  +		{
  +			throw new PersistenceBrokerException("not yet implemented");	
  +		}
  +	}
  +
  +	/**
  +	 * @see org.apache.ojb.broker.PersistenceBroker#getPKEnumerationByQuery(Class, Query)
  +	 */
  +	public Enumeration getPKEnumerationByQuery(
  +		Class PrimaryKeyClass,
  +		Query query)
  +		throws PersistenceBrokerException
  +	{
  +		throw new PersistenceBrokerException("not yet implemented");
  +	}
  +
  +
  +}
  
  
  
  1.3.2.1   +1 -1      db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/CommandDelete.java
  
  Index: CommandDelete.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/CommandDelete.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- CommandDelete.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ CommandDelete.java	21 Dec 2005 22:31:27 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker.prevayler;
   
  -/* Copyright 2003-2004 The Apache Software Foundation
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.3.2.1   +32 -32    db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/CommandStore.java
  
  Index: CommandStore.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/prevayler/org/apache/ojb/broker/prevayler/CommandStore.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- CommandStore.java	5 Apr 2004 00:21:13 -0000	1.3
  +++ CommandStore.java	21 Dec 2005 22:31:27 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
  -package org.apache.ojb.broker.prevayler;
  -
  -/* Copyright 2003-2004 The Apache Software Foundation
  +package org.apache.ojb.broker.prevayler;
  +
  +/* Copyright 2003-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -14,32 +14,32 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import java.io.Serializable;
  -
  -import org.prevayler.Command;
  -import org.prevayler.PrevalentSystem;
  -
  -/**
  - * @author Thomas Mahler
  - * Command to store an object in the Database.
  - */
  -public class CommandStore implements Command
  -{
  -	private final Object objectToStore;
  -	
  -	public CommandStore(Object toStore)
  -	{
  -		this.objectToStore = toStore;	
  -	}
  -
  -	/**
  -	 * @see org.prevayler.Command#execute(PrevalentSystem)
  -	 */
  -	public Serializable execute(PrevalentSystem ps) throws Exception
  -	{
  -		((Database) ps).store(objectToStore);
  -		return null;
  -	}
  -
  -}
  +
  +import java.io.Serializable;
  +
  +import org.prevayler.Command;
  +import org.prevayler.PrevalentSystem;
  +
  +/**
  + * @author Thomas Mahler
  + * Command to store an object in the Database.
  + */
  +public class CommandStore implements Command
  +{
  +	private final Object objectToStore;
  +	
  +	public CommandStore(Object toStore)
  +	{
  +		this.objectToStore = toStore;	
  +	}
  +
  +	/**
  +	 * @see org.prevayler.Command#execute(PrevalentSystem)
  +	 */
  +	public Serializable execute(PrevalentSystem ps) throws Exception
  +	{
  +		((Database) ps).store(objectToStore);
  +		return null;
  +	}
  +
  +}
  
  
  
  No                   revision
  No                   revision
  1.9.2.2   +1 -1      db-ojb/src/test/org/apache/ojb/odmg/OQLOrOnForeignKeyTest.java
  
  Index: OQLOrOnForeignKeyTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/OQLOrOnForeignKeyTest.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- OQLOrOnForeignKeyTest.java	4 Dec 2004 14:01:08 -0000	1.9.2.1
  +++ OQLOrOnForeignKeyTest.java	21 Dec 2005 22:31:27 -0000	1.9.2.2
  @@ -1,6 +1,6 @@
   package org.apache.ojb.odmg;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  1.1.2.10  +2 -2      db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java
  
  Index: CircularTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/odmg/CircularTest.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- CircularTest.java	13 Dec 2005 18:18:25 -0000	1.1.2.9
  +++ CircularTest.java	21 Dec 2005 22:31:28 -0000	1.1.2.10
  @@ -1,6 +1,6 @@
   package org.apache.ojb.odmg;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +2 -2      db-ojb/src/test/org/apache/ojb/broker/sqlcount/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/sqlcount/AllTests.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- AllTests.java	5 Apr 2004 12:16:25 -0000	1.3
  +++ AllTests.java	21 Dec 2005 22:31:28 -0000	1.3.2.1
  @@ -1,6 +1,6 @@
   package org.apache.ojb.broker.sqlcount;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  
  No                   revision
  No                   revision
  1.3.2.4   +2 -2      db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java
  
  Index: PBTestCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/junit/PBTestCase.java,v
  retrieving revision 1.3.2.3
  retrieving revision 1.3.2.4
  diff -u -r1.3.2.3 -r1.3.2.4
  --- PBTestCase.java	7 May 2005 16:02:57 -0000	1.3.2.3
  +++ PBTestCase.java	21 Dec 2005 22:31:29 -0000	1.3.2.4
  @@ -1,6 +1,6 @@
   package org.apache.ojb.junit;
   
  -/* Copyright 2002-2004 The Apache Software Foundation
  +/* Copyright 2002-2005 The Apache Software Foundation
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org