db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mka...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/dbhandling CommonsSqlDataHandling.java DataSet.java DatabaseHandlingTask.java
Date Thu, 12 Aug 2004 18:21:15 GMT
mkalen      2004/08/12 11:21:14

  Modified:    src/java/org/apache/ojb/broker/util/dbhandling
                        CommonsSqlDataHandling.java DataSet.java
                        DatabaseHandlingTask.java
  Log:
  Update database handling to work with refactored OJB/MetadataManager.
  
  Revision  Changes    Path
  1.4       +2 -8      db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/CommonsSqlDataHandling.java
  
  Index: CommonsSqlDataHandling.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/CommonsSqlDataHandling.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CommonsSqlDataHandling.java	27 Jul 2004 23:14:19 -0000	1.3
  +++ CommonsSqlDataHandling.java	12 Aug 2004 18:21:14 -0000	1.4
  @@ -18,7 +18,6 @@
   import java.io.IOException;
   import java.io.Reader;
   import java.io.StringReader;
  -import java.io.StringWriter;
   import java.io.Writer;
   import java.util.ArrayList;
   import java.util.Iterator;
  @@ -39,7 +38,6 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.EntityResolver;
   import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
   
   /**
    * Provides data input and output via commons-sql.
  @@ -112,8 +110,6 @@
   
       /** The database model */
       private Database _db;
  -    /** The model */
  -    private DescriptorRepository _model;
       /** The prepared model */
       private PreparedModel _preparedModel;
       /** The digester for parsing the XML */
  @@ -128,11 +124,10 @@
       public CommonsSqlDataHandling(Database db, DescriptorRepository model)
       {
           _db            = db;
  -        _model         = model;
           _preparedModel = new PreparedModel(model, db);
           _digester      = new Digester();
           _digester.setEntityResolver(new EntityResolver() {
  -            public InputSource resolveEntity(String publicId, String systemId) throws SAXException
  +            public InputSource resolveEntity(String publicId, String systemId)
               {
                   // we don't care about the DTD for data files
                   return new InputSource(new StringReader(""));
  @@ -259,8 +254,7 @@
           try
           {
               DataSet      set    = (DataSet)_digester.parse(input);
  -            StringWriter writer = new StringWriter();
  -
  +            
               set.insert(ds, _db);
           }
           catch (Exception ex)
  
  
  
  1.2       +0 -2      db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DataSet.java
  
  Index: DataSet.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DataSet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DataSet.java	27 Jul 2004 23:14:19 -0000	1.1
  +++ DataSet.java	12 Aug 2004 18:21:14 -0000	1.2
  @@ -56,7 +56,6 @@
       public void createInsertionSql(Database db, Writer writer) throws IOException
       {
           DynaSql      dynaSql = new DynaSql();
  -        StringBuffer result  = new StringBuffer();
   
           dynaSql.setDatabase(db);
           for (Iterator it = _beans.iterator(); it.hasNext();)
  @@ -78,7 +77,6 @@
       public void insert(DataSource ds, Database db) throws SQLException
       {
           DynaSql      dynaSql = new DynaSql(ds, db);
  -        StringBuffer result  = new StringBuffer();
   
           for (Iterator it = _beans.iterator(); it.hasNext();)
           {
  
  
  
  1.7       +8 -3      db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java
  
  Index: DatabaseHandlingTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DatabaseHandlingTask.java	8 Aug 2004 11:28:02 -0000	1.6
  +++ DatabaseHandlingTask.java	12 Aug 2004 18:21:14 -0000	1.7
  @@ -20,6 +20,7 @@
   
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  +import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.metadata.ConnectionRepository;
   import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
   import org.apache.ojb.broker.metadata.MetadataManager;
  @@ -163,6 +164,7 @@
                   }
                   catch (Exception ex)
                   {
  +                    ex.printStackTrace(System.err);
                       throw new BuildException(ex);
                   }
               }
  @@ -742,9 +744,12 @@
               }
   
               // this effectively initializes OJB
  -            MetadataManager     metadataManager = MetadataManager.getInstance();
  +            OJB ojb = new OJB();
  +            PersistenceBrokerFactory.setOjb(ojb);
  +
  +            MetadataManager     metadataManager = ojb.getMetadataManager();
               RepositoryPersistor persistor       = new RepositoryPersistor();
  -    
  +
               if (_repositoryFile != null)
               {
                   if (!_repositoryFile.exists())
  @@ -765,7 +770,7 @@
                   // that the properties file is in, and the repository file path is relative
                   // So lets try to resolve this path and load the repository info manually
                   Properties props = new Properties();
  -    
  +
                   props.load(new FileInputStream(_ojbPropertiesFile));
       
                   String repositoryPath = props.getProperty("repositoryFile", "repository.xml");
  
  
  

---------------------------------------------------------------------
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