db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb build.xml
Date Mon, 21 Jun 2004 21:53:25 GMT
tomdz       2004/06/21 14:53:25

  Modified:    src/test/org/apache/ojb/tutorial1 UCQuitApplication.java
                        UseCase.java Product.java Application.java
                        AbstractUseCase.java UCDeleteProduct.java
                        UCEditProduct.java UCListAllProducts.java
                        UCEnterNewProduct.java
               src/doc/forrest/src/documentation/content/xdocs/docu
                        getting-started.xml
               src/doc/forrest/src/documentation/content/xdocs/docu/tutorials
                        mapping-tutorial.xml
               .        build.xml
  Added:       src/ojb-blank/src/resources log4j.properties repository.xml
  Log:
  Added normal and xdoclet javadoc comments to the sources for tutorial 1
  Some tweaking of the ojb-blank
  Additional info for running the ojb-blank project
  
  Revision  Changes    Path
  1.5       +15 -13    db-ojb/src/test/org/apache/ojb/tutorial1/UCQuitApplication.java
  
  Index: UCQuitApplication.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UCQuitApplication.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UCQuitApplication.java	8 Apr 2003 20:19:29 -0000	1.4
  +++ UCQuitApplication.java	21 Jun 2004 21:53:24 -0000	1.5
  @@ -1,14 +1,14 @@
   package org.apache.ojb.tutorial1;
   
  -
   /**
  - * implements Use Case "Quit Application".
  - * @author Thomas Mahler
  + * Use case for quitting the application.
    */
   public class UCQuitApplication extends AbstractUseCase
   {
       /**
  -     * UCQuitApplication constructor comment.
  +     * Creates a new quit use case instance.
  +     * 
  +     * @param broker The broker to use for database operations
        */
       public UCQuitApplication(org.apache.ojb.broker.PersistenceBroker b)
       {
  @@ -16,7 +16,17 @@
       }
   
       /**
  -     * apply method comment.
  +     * Returns a description of this use case.
  +     * 
  +     * @return A description of the use case
  +     */
  +    public String getDescription()
  +    {
  +        return "Quit Application";
  +    }
  +
  +    /**
  +     * Performs this use case.
        */
       public void apply()
       {
  @@ -26,13 +36,5 @@
           // 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       +9 -4      db-ojb/src/test/org/apache/ojb/tutorial1/UseCase.java
  
  Index: UseCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UseCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UseCase.java	8 Apr 2003 20:19:29 -0000	1.2
  +++ UseCase.java	21 Jun 2004 21:53:24 -0000	1.3
  @@ -1,14 +1,19 @@
   package org.apache.ojb.tutorial1;
   
   /**
  - * Interface for application use cases.
  - * @author Thomas Mahler
  + * Declares use cases in the tutorial applications.
    */
   public interface UseCase
   {
  -    /** perform this use case*/
  +    /**
  +     * Performs this use case.
  +     */
       public abstract void apply();
   
  -    /** get descriptive information on use case*/
  +    /**
  +     * Returns a description of this use case.
  +     * 
  +     * @return A description of the use case
  +     */
       public abstract String getDescription();
   }
  
  
  
  1.2       +62 -39    db-ojb/src/test/org/apache/ojb/tutorial1/Product.java
  
  Index: Product.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/Product.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Product.java	20 Jun 2002 17:07:55 -0000	1.1
  +++ Product.java	21 Jun 2004 21:53:24 -0000	1.2
  @@ -1,42 +1,65 @@
   package org.apache.ojb.tutorial1;
   
  -/** represents product objects in the tutorial system*/
  +/**
  + * Represents product objects in the tutorial system
  + * 
  + * @ojb.class
  + */
   public class Product implements java.io.Serializable
   {
  +    /**
  +     * Artificial primary key atribute
  +     * 
  +     * @ojb.field primarykey="true"
  +     *            autoincrement="ojb"
  +     */
  +    private Integer id;
  +
  +    /**
  +     * Product name
  +     * 
  +     * @ojb.field length="100"
  +     */
  +    protected String name;
   
  -    /** price per item*/
  +    /**
  +     * Price per item
  +     * 
  +     * @ojb.field
  +     */
       protected double price;
  -    /** stock of currently available items*/
  +
  +    /**
  +     * Stock of currently available items
  +     * 
  +     * @ojb.field
  +     */
       protected int stock;
  -    /** product name*/
  -    protected String name;
  -    /**artificial primary key atribute*/
  -    private int id;
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 11:13:27)
  -     * @return int
  +     * Returns the id
  +     * 
  +     * @return The id
        */
       public int getId()
       {
  -        return id;
  +        return id.intValue();
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @return java.lang.String
  +     * Returns the name of the product.
  +     * 
  +     * @return The name
        */
  -    public java.lang.String getName()
  +    public String getName()
       {
           return name;
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @return double
  +     * Returns the price of the product.
  +     * 
  +     * @return The price
        */
       public double getPrice()
       {
  @@ -44,9 +67,9 @@
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @return int
  +     * Returns the number of available items of this product.
  +     * 
  +     * @return The number of items in stock
        */
       public int getStock()
       {
  @@ -54,29 +77,29 @@
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 11:13:27)
  -     * @param new_id int
  +     * Sets the id of the product.
  +     * 
  +     * @param newId The new id
        */
  -    public void setId(int new_id)
  +    public void setId(int newId)
       {
  -        id = new_id;
  +        id = new Integer(newId);
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @param newName java.lang.String
  +     * Sets the name of the product.
  +     * 
  +     * @param newName The new name
        */
  -    public void setName(java.lang.String newName)
  +    public void setName(String newName)
       {
           name = newName;
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @param newPrice double
  +     * Sets the price of the product
  +     * 
  +     * @param newPrice The new price
        */
       public void setPrice(double newPrice)
       {
  @@ -84,9 +107,9 @@
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @param newStock int
  +     * Sets the number of available items of this product.
  +     * 
  +     * @param newStock The number of available items 
        */
       public void setStock(int newStock)
       {
  @@ -94,9 +117,9 @@
       }
   
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:57:36)
  -     * @return int
  +     * Returns a string representation of the product.
  +     * 
  +     * @return The string representation
        */
       public String toString()
       {
  
  
  
  1.5       +31 -14    db-ojb/src/test/org/apache/ojb/tutorial1/Application.java
  
  Index: Application.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/Application.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Application.java	8 Apr 2003 20:19:29 -0000	1.4
  +++ Application.java	21 Jun 2004 21:53:24 -0000	1.5
  @@ -1,4 +1,5 @@
   package org.apache.ojb.tutorial1;
  +
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
   import org.apache.ojb.broker.util.ui.AsciiSplash;
  @@ -6,16 +7,19 @@
   import java.io.BufferedReader;
   import java.io.InputStreamReader;
   import java.util.Vector;
  +
   /**
    * The tutorial application.
  - * @author Thomas Mahler
    */
   public class Application
   {
  +    /** The use cases */
       private Vector useCases;
  +    /** The broker to use for database operations */
       private PersistenceBroker broker;
  +
       /**
  -     * Application constructor comment.
  +     * Creates a new application object.
        */
       public Application()
       {
  @@ -28,6 +32,7 @@
           {
               t.printStackTrace();
           }
  +
           useCases = new Vector();
           useCases.add(new UCListAllProducts(broker));
           useCases.add(new UCEnterNewProduct(broker));
  @@ -35,35 +40,42 @@
           useCases.add(new UCDeleteProduct(broker));
           useCases.add(new UCQuitApplication(broker));
       }
  +
       /**
  -     * Disply available use cases.
  +     * Disply the available use cases.
        */
       public void displayUseCases()
       {
           System.out.println();
  -        for (int i = 0; i < useCases.size(); i++)
  +        for (int idx = 0; idx < useCases.size(); idx++)
           {
  -            System.out.println("[" + i + "] " + ((UseCase) useCases.get(i)).getDescription());
  +            System.out.println("[" + idx + "] " + ((UseCase)useCases.get(idx)).getDescription());
           }
       }
  +
       /**
  -     * Insert the method's description here.
  -     * Creation date: (04.03.2001 10:40:25)
  -     * @param args java.lang.String[]
  +     * The main entry point of the tutorial application
  +     *
  +     * @param args The commandline arguments
        */
       public static void main(String[] args)
       {
           Application app = new Application();
  +
           app.run();
       }
  +
       /**
  -     * read a single line from stdin and return as String
  +     * Reads a single line from stdin and returns it.
  +     * 
  +     * @return The user's intput
        */
       private String readLine()
       {
           try
           {
               BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
  +
               return rin.readLine();
           }
           catch (Exception e)
  @@ -71,14 +83,16 @@
               return "";
           }
       }
  +
       /**
  -     * the applications main loop.
  +     * The application's 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)
           {
  @@ -95,16 +109,19 @@
               }
           }
       }
  +
       /**
  -     * select a use case.
  +     * Allows the user to 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);
  +
  +        String in  = readLine();
  +        int    idx = Integer.parseInt(in);
  +
  +        return (UseCase)useCases.get(idx);
       }
       
   
  
  
  
  1.3       +12 -12    db-ojb/src/test/org/apache/ojb/tutorial1/AbstractUseCase.java
  
  Index: AbstractUseCase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/AbstractUseCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractUseCase.java	8 Apr 2003 20:19:29 -0000	1.2
  +++ AbstractUseCase.java	21 Jun 2004 21:53:24 -0000	1.3
  @@ -6,40 +6,40 @@
   import java.io.InputStreamReader;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 11:31:41)
  - * @author Thomas Mahler
  + * Base class for the tutorial's use cases.
    */
   public abstract class AbstractUseCase implements UseCase
   {
  +    /** The persistence broker */
       protected PersistenceBroker broker;
   
       /**
  -     * AbstractUseCase constructor comment.
  +     * Creates a new instance of the use case. Is intended to be called
  +     * by sub classes.
  +     * 
  +     * @param broker The broker to use for database operations
        */
       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
  +     * Reads a single line from stdin and returns it.
  +     * 
  +     * @param message The message to print
  +     * @return The text entered by the user
        */
       protected String readLineWithMessage(String message)
       {
           System.out.print(message + " ");
  +
           try
           {
               BufferedReader rin = new BufferedReader(new InputStreamReader(System.in));
               return rin.readLine();
           }
  -        catch (Exception e)
  +        catch (Exception ex)
           {
               return "";
           }
  
  
  
  1.4       +25 -14    db-ojb/src/test/org/apache/ojb/tutorial1/UCDeleteProduct.java
  
  Index: UCDeleteProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UCDeleteProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UCDeleteProduct.java	8 Apr 2003 20:19:29 -0000	1.3
  +++ UCDeleteProduct.java	21 Jun 2004 21:53:24 -0000	1.4
  @@ -1,37 +1,54 @@
   package org.apache.ojb.tutorial1;
   
  +import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByIdentity;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  + * Use case for deleting a product from the database.
    */
   public class UCDeleteProduct extends AbstractUseCase
   {
       /**
  -     * UCEnterNewProduct constructor comment.
  +     * Creates a new delete use case instance.
  +     * 
  +     * @param broker The broker to use for database operations
        */
  -    public UCDeleteProduct(org.apache.ojb.broker.PersistenceBroker b)
  +    public UCDeleteProduct(PersistenceBroker broker)
       {
  -        super(b);
  +        super(broker);
       }
   
  -    /** perform this use case*/
  +    /**
  +     * Returns a description of this use case.
  +     * 
  +     * @return A description of the use case
  +     */
  +    public String getDescription()
  +    {
  +        return "Delete a product entry";
  +    }
  +
  +    /**
  +     * Performs this use case.
  +     */
       public void apply()
       {
           String in = readLineWithMessage("Delete Product with id:");
  -        int id = Integer.parseInt(in);
  +        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
  @@ -49,11 +66,5 @@
               broker.abortTransaction();
               t.printStackTrace();
           }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Delete a product entry";
       }
   }
  
  
  
  1.4       +20 -16    db-ojb/src/test/org/apache/ojb/tutorial1/UCEditProduct.java
  
  Index: UCEditProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UCEditProduct.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UCEditProduct.java	8 Apr 2003 20:19:29 -0000	1.3
  +++ UCEditProduct.java	21 Jun 2004 21:53:24 -0000	1.4
  @@ -1,38 +1,50 @@
   package org.apache.ojb.tutorial1;
   
  +import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByIdentity;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  + * Use case for editing a product.
    */
   public class UCEditProduct extends AbstractUseCase
   {
       /**
  -     * UCEditProduct constructor comment.
  +     * Creates a new edit use case instance.
  +     * 
  +     * @param broker The broker to use for database operations
        */
  -    public UCEditProduct(org.apache.ojb.broker.PersistenceBroker b)
  +    public UCEditProduct(PersistenceBroker broker)
       {
  -        super(b);
  +        super(broker);
       }
   
  -    /** perform this use case*/
  +    /** get descriptive information on use case*/
  +    public String getDescription()
  +    {
  +        return "Edit a product entry";
  +    }
  +
  +    /**
  +     * Performs this use case.
  +     */
       public void apply()
       {
           String in = readLineWithMessage("Edit Product with id:");
  -        int id = Integer.parseInt(in);
  +        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
  @@ -50,8 +62,6 @@
               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
  @@ -63,11 +73,5 @@
               broker.abortTransaction();
               t.printStackTrace();
           }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Edit a product entry";
       }
   }
  
  
  
  1.3       +25 -15    db-ojb/src/test/org/apache/ojb/tutorial1/UCListAllProducts.java
  
  Index: UCListAllProducts.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UCListAllProducts.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCListAllProducts.java	8 Apr 2003 20:19:29 -0000	1.2
  +++ UCListAllProducts.java	21 Jun 2004 21:53:24 -0000	1.3
  @@ -1,39 +1,55 @@
   package org.apache.ojb.tutorial1;
   
  +import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
   
   import java.util.Collection;
  +import java.util.Iterator;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  + * Use case for listing all products in the database.
    */
   public class UCListAllProducts extends AbstractUseCase
   {
       /**
  -     * UCEnterNewProduct constructor comment.
  +     * Creates a new list-all use case instance.
  +     * 
  +     * @param broker The broker to use for database operations
        */
  -    public UCListAllProducts(org.apache.ojb.broker.PersistenceBroker b)
  +    public UCListAllProducts(PersistenceBroker broker)
       {
  -        super(b);
  +        super(broker);
       }
   
  -    /** perform this use case*/
  +    /**
  +     * Returns a description of this use case.
  +     * 
  +     * @return A description of the use case
  +     */
  +    public String getDescription()
  +    {
  +        return "List all product entries";
  +    }
  +
  +    /**
  +     * Performs 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())
  +            for (Iterator iter = allProducts.iterator(); iter.hasNext();)
               {
                   System.out.println(iter.next());
               }
  @@ -42,11 +58,5 @@
           {
               t.printStackTrace();
           }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "List all product entries";
       }
   }
  
  
  
  1.3       +20 -11    db-ojb/src/test/org/apache/ojb/tutorial1/UCEnterNewProduct.java
  
  Index: UCEnterNewProduct.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/tutorial1/UCEnterNewProduct.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UCEnterNewProduct.java	8 Apr 2003 20:19:29 -0000	1.2
  +++ UCEnterNewProduct.java	21 Jun 2004 21:53:24 -0000	1.3
  @@ -4,28 +4,43 @@
   import org.apache.ojb.broker.PersistenceBrokerException;
   
   /**
  - * Insert the type's description here.
  - * Creation date: (04.03.2001 10:34:15)
  - * @author Thomas Mahler
  + * Use case for adding a new product to the database.
    */
   public class UCEnterNewProduct extends AbstractUseCase
   {
       /**
  -     * UCEnterNewProduct constructor comment.
  +     * Creates a new enter-new use case instance.
  +     * 
  +     * @param broker The broker to use for database operations
        */
       public UCEnterNewProduct(PersistenceBroker broker)
       {
           super(broker);
       }
   
  -    /** perform this use case*/
  +    /**
  +     * Returns a description of this use case.
  +     * 
  +     * @return A description of the use case
  +     */
  +    public String getDescription()
  +    {
  +        return "Enter a new product";
  +    }
  +
  +    /**
  +     * Performs this use case.
  +     */
       public void apply()
       {
           // this will be our new object
           Product newProduct = new Product();
  +
           // 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));
  @@ -49,11 +64,5 @@
               System.out.println(ex.getMessage());
               ex.printStackTrace();
           }
  -    }
  -
  -    /** get descriptive information on use case*/
  -    public String getDescription()
  -    {
  -        return "Enter a new product";
       }
   }
  
  
  
  1.4       +30 -3     db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/getting-started.xml
  
  Index: getting-started.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/getting-started.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- getting-started.xml	20 Jun 2004 20:58:16 -0000	1.3
  +++ getting-started.xml	21 Jun 2004 21:53:24 -0000	1.4
  @@ -308,7 +308,7 @@
                       </tr>
                       <tr>
                           <td>compile</td>
  -                        <td>Compiles your java source files to <code>build/java</code>.
Usually, you
  +                        <td>Compiles your java source files to <code>build/classes</code>.
Usually, you
                               don't run this target, but rather the next one which includes
the
                               compilation step.</td>
                       </tr>
  @@ -674,7 +674,7 @@
                   </p>
                   <source><![CDATA[
   <class-descriptor
  -    class="sample.Product"
  +    class="productmanager.Product"
       table="Product"
   >
       <field-descriptor
  @@ -706,6 +706,33 @@
   </class-descriptor>
   ...
   ]]></source>
  +                <p>
  +                    Now you should be able to run your application:
  +                </p>
  +                <source><![CDATA[
  +cd build/resources
  +
  +java productmanager.Main
  +]]></source>
  +                <p>
  +                    Of course, you'll need to setup the <code>CLASSPATH</code>
before running
  +                    your application. You'll should add all jars except the ones for Torque
  +                    (<code>torque-[version].jar</code>, <code>velocity-[version].jar</code>
  +                    and <code>commons-collections-[version].jar</code>) and
for the XDoclet OJB
  +                    module (<code>xdoclet-[version].jar</code>, <code>xjavadoc-[version].jar</code>
  +                    and <code>xdoclet-ojb-module-[version].jar</code>).
  +                </p>
  +                <p>
  +                    It is important to note that OJB per default assumes the <code>OJB.properties</code>
  +                    and <code>OJB-logging.properties</code> files in the directory
where you're
  +                    starting the application. Hence, we changed to the <code>build/resources</code>
  +                    directory.
  +                </p>
  +                <p>
  +                    Per default, the same applies to the other configuration files
  +                    (<code>repository*.xml</code>) but you can change this
in the
  +                    <code>OJB.properties</code> file.
  +                </p>
               </section>
           </section>
   
  
  
  
  1.2       +4 -4      db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/tutorials/mapping-tutorial.xml
  
  Index: mapping-tutorial.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/tutorials/mapping-tutorial.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mapping-tutorial.xml	20 Jun 2004 09:12:33 -0000	1.1
  +++ mapping-tutorial.xml	21 Jun 2004 21:53:24 -0000	1.2
  @@ -49,7 +49,7 @@
           private Double price;
   
           /** stock of currently available items */
  -        private Integer stock;
  +        private int stock;
   
           ...
       }
  @@ -69,7 +69,7 @@
                         but under certain conditions <link href="site:howto/anonymous-keys">anonymous
keys</link>
                         can also be used to keep this database artifact hidden in the database.
However,
                         as access to an artifical unique identifier for a particular object
instance can be
  -                      useful, particularly in web-based applications, this tutorial will
expose it.
  +                      useful, particularly in web-based applications, this tutorial will
expose it
                     </p>
                 </section>
                 <section><title>The Database</title>
  @@ -245,7 +245,7 @@
            *
            * @ojb.field
            */
  -        private Integer stock;
  +        private int stock;
       }
                     ]]></source>
                     <p>
  
  
  
  1.1                  db-ojb/src/ojb-blank/src/resources/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  #<!--
  #/* Copyright 2002-2004 The Apache Software Foundation
  # *
  # * Licensed under the Apache License, Version 2.0 (the "License");
  # * you may not use this file except in compliance with the License.
  # * You may obtain a copy of the License at
  # *
  # *     http://www.apache.org/licenses/LICENSE-2.0
  # *
  # * Unless required by applicable law or agreed to in writing, software
  # * distributed under the License is distributed on an "AS IS" BASIS,
  # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # * See the License for the specific language governing permissions and
  # * limitations under the License.
  # */
  #-->
  # An example log4j configuration file that outputs both to System.out
  # and a file named 'org.apache.ojb.log'.
  
  # For the general syntax of property based configuration files see the
  # documenation of org.apache.log4j.PropertyConfigurator.
  
  # WARNING: Location information can be useful but is very costly in
  # terms of computation.
  
  # The root category uses the appenders called A1 and A2. Since no
  # priority is set, the root category assumes the default which is
  # DEBUG
  
  log4j.rootCategory=WARN, A1, A2
  
  # Configure the individual component logging like this:
  #
  #log4j.logger.org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl=DEBUG
  #log4j.logger.org.apache.ojb.broker.metadata.RepositoryXmlHandler=DEBUG
  #log4j.logger.org.apache.ojb.broker.accesslayer.ConnectionManager=INFO
  #log4j.logger.org.apache.ojb.odmg=INFO
  
  
  # A1 is set to be ConsoleAppender sending its output to System.out
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  
  
  # A1 uses PatternLayout.
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  
  # The conversion pattern consists of date in ISO8601 format, priority,
  # thread name, category name truncated to its rightmost two components
  # and left justified to 17 characters, location information consisting
  # of file name (padded to 13 characters) and line number, nested
  # diagnostic context, the and the application supplied message
  
  #log4j.appender.A1.layout.ConversionPattern=%-6r %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n
  
  # use a simpler output format
  log4j.appender.A1.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n
  
  # Appender A2 writes to the file "org.apache.ojb.log".
  log4j.appender.A2=org.apache.log4j.FileAppender
  log4j.appender.A2.File=org.apache.ojb.log
  
  # Truncate 'test' if it aleady exists.
  log4j.appender.A2.Append=false
  
  # Appender A2 uses the PatternLayout.
  log4j.appender.A2.layout=org.apache.log4j.PatternLayout
  log4j.appender.A2.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n
  
  
  
  
  
  
  
  1.1                  db-ojb/src/ojb-blank/src/resources/repository.xml
  
  Index: repository.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
  #/* Copyright 2002-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  -->
  <!-- This is a sample metadata repository for the
       Apache ObJectRelationalBridge (OJB) System.
       Use this file as a template for building your own mappings.
  -->
  
  <!-- doctype definition
       By default we are using a local DTD that is expected to reside
       in the same directory as this repository.xml file.
       If you intend to validate your repository.xml against
       the public dtd at the Apache site, please replace the string
       "repository.dtd"
       by the public adress
       "http://db.apache.org/ojb/dtds/1.0/repository.dtd".
       In this case validation will only work if the machine you
       run your application on can connect to the internet!
  -->
  
  <!DOCTYPE descriptor-repository PUBLIC
         "-//Apache Software Foundation//DTD OJB Repository//EN"
         "repository.dtd"
  [
  
  <!ENTITY database SYSTEM "repository_database.xml">
  <!ENTITY internal SYSTEM "repository_internal.xml">
  <!ENTITY user SYSTEM "repository_user.xml">
  ]>
  
  
  <descriptor-repository version="1.0"
                         isolation-level="read-uncommitted"
                         proxy-prefetching-limit="50">
  
      <!-- include all used database connections -->
      &database;
  
      <!-- include ojb internal mappings here; comment this if you don't need them -->
      &internal;
  
      <!-- include user defined mappings here -->
      &user;
  </descriptor-repository>
  
  
  
  1.139     +3 -3      db-ojb/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/build.xml,v
  retrieving revision 1.138
  retrieving revision 1.139
  diff -u -r1.138 -r1.139
  --- build.xml	20 Jun 2004 13:05:35 -0000	1.138
  +++ build.xml	21 Jun 2004 21:53:24 -0000	1.139
  @@ -559,9 +559,9 @@
           <copy todir="${build.ojb-blank}/src/resources">
               <fileset dir="${src.test}/org/apache/ojb">
                   <include name="OJB*.properties" />
  -                <include name="log4j.properties" />
                   <include name="repository.dtd" />
  -                <include name="repository*.xml" />
  +                <include name="repository_database.xml" />
  +                <include name="repository_internal.xml" />
               </fileset>
           </copy>
   
  
  
  

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


Mime
View raw message