db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From florianbruck...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb DBMeta.java
Date Sat, 21 Jun 2003 10:31:46 GMT
florianbruckner    2003/06/21 03:31:46

  Modified:    src/java/org/apache/ojb/tools/mapping/reversedb DBMeta.java
  Log:
  implement XML generation with PrintWriter; getXML() still works and uses writeXML(java.io.PrintWriter)
  
  Revision  Changes    Path
  1.5       +31 -19    db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/DBMeta.java
  
  Index: DBMeta.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/DBMeta.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DBMeta.java	28 Jan 2003 21:42:53 -0000	1.4
  +++ DBMeta.java	21 Jun 2003 10:31:45 -0000	1.5
  @@ -286,29 +286,37 @@
   
     public String getXML()
     {
  -    String strReturn = "";
  -    strReturn = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + System.getProperty("line.separator");
  -    strReturn += "<!DOCTYPE descriptor-repository SYSTEM \"repository.dtd\">" + System.getProperty("line.separator");
  -    strReturn += "<descriptor-repository version=\"0.9.9\">" + System.getProperty("line.separator");
  -    strReturn += "  <jdbc-connection-descriptor" + System.getProperty("line.separator");
  -    strReturn += "    jcd-alias=\"default\"" + System.getProperty("line.separator");
  -    strReturn += "    default-connection=\"true\"" + System.getProperty("line.separator");
  -    strReturn += "    platform=\"XXXX\"" + System.getProperty("line.separator");
  -    strReturn += "    jdbc-level=\"1.0\"" + System.getProperty("line.separator");
  -    strReturn += "    driver=\"XXX\"" + System.getProperty("line.separator");
  -    strReturn += "    protocol=\"XXX\"" + System.getProperty("line.separator");
  -    strReturn += "    subprotocol=\"XXX\"" + System.getProperty("line.separator");
  -    strReturn += "    dbalias=\"XXX\"" + System.getProperty("line.separator");
  -    strReturn += "    username=\"XXX\"" + System.getProperty("line.separator");
  -    strReturn += "    password=\"XXX\">" + System.getProperty("line.separator");
  -    strReturn += "  </jdbc-connection-descriptor>" + System.getProperty("line.separator");
  +        java.io.StringWriter sw = new java.io.StringWriter();
  +        writeXML(new java.io.PrintWriter(sw));
  +        return sw.getBuffer().toString();      
  +  }
  +  
  +  public void writeXML(java.io.PrintWriter pw) 
  +  {
  +      
  +    
  +    pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
  +    pw.println("<!DOCTYPE descriptor-repository SYSTEM \"repository.dtd\">" );
  +    pw.println("<descriptor-repository version=\"0.9.9\">" );
  +    pw.println("  <jdbc-connection-descriptor" );
  +    pw.println("    jcd-alias=\"default\"" );
  +    pw.println("    default-connection=\"true\"" );
  +    pw.println("    platform=\"XXXX\"" );
  +    pw.println("    jdbc-level=\"1.0\"");
  +    pw.println("    driver=\"XXX\"" );
  +    pw.println("    protocol=\"XXX\"" );
  +    pw.println("    subprotocol=\"XXX\"");
  +    pw.println("    dbalias=\"XXX\"" );
  +    pw.println("    username=\"XXX\"");
  +    pw.println("    password=\"XXX\">");
  +    pw.println("  </jdbc-connection-descriptor>");
       
       Iterator i = this.hmCatalogs.values().iterator();
       while (i.hasNext())
       {
  -      strReturn += ((DBCatalog)i.next()).getXML() + System.getProperty("line.separator");
  +      ((DBCatalog)i.next()).writeXML(pw);
       }
  -    return strReturn + "</descriptor-repository>";
  +    pw.println("</descriptor-repository>");      
     }
     
     public void generateJava (java.io.File aFile, String strHeader, String strFooter) throws
java.io.IOException, java.io.FileNotFoundException
  @@ -329,11 +337,15 @@
       while (it.hasNext()) ((DBCatalog)it.next()).disableClassesWithRegex(aRegexp);     
  
     }
     
  +  
   }
   
   
   /***************************** Changelog *****************************
   // $Log$
  +// Revision 1.5  2003/06/21 10:31:45  florianbruckner
  +// implement XML generation with PrintWriter; getXML() still works and uses writeXML(java.io.PrintWriter)
  +//
   // Revision 1.4  2003/01/28 21:42:53  florianbruckner
   // update XML generation
   //
  
  
  

Mime
View raw message