Package org.xmlBlaster.contrib.dbwriter

Examples of org.xmlBlaster.contrib.dbwriter.SqlInfoParser


         log.fine("message '" + msg + "'");

         if (doCheck) {
            checked = true;
            // first check parsing (if an assert occurs here it means there is a discrepancy between toXml and parse
            SqlInfoParser parser = new SqlInfoParser();
            parser.init(info);
            SqlInfo dbUpdateInfo = parser.parse(msg);
            String createStatement = dbSpecific.getCreateTableStatement(dbUpdateInfo.getDescription(), null);
            log.fine("=============================================");
            log.fine(createStatement);
            log.fine("=============================================");
            String msg1 = dbUpdateInfo.toXml("");
View Full Code Here


               this.dbPool.release(conn);
            conn = null;
         }
        
         // first check parsing (if an assert occurs here it means there is a discrepancy between toXml and parse
         SqlInfoParser parser = new SqlInfoParser();
         parser.init(info);

         SqlInfo dbUpdateInfo = parser.parse(message);
         String sql = this.dbSpecific.getCreateTableStatement(dbUpdateInfo.getDescription(), null);
         try {
            this.replicationWriter.store(dbUpdateInfo);
         }
         catch (Exception e) {
View Full Code Here

               for (int i=0; i < rows.size(); i++) {
                  SqlRow row = (SqlRow)rows.get(i);
                  ClientProperty oldRowProp = new ClientProperty(ReplicationConstants.OLD_CONTENT_ATTR, null, null, row.toXml("", false));
                  row.setAttribute(oldRowProp);
                  try {
                     I_Parser parser = new SqlInfoParser();
                     parser.init(this.info);
                     int ret = desc.update(conn, row, parser);
                     if (ret != 1)
                        throw new Exception("the number of updated entries is wrong '" + ret + "' but should be 1");
                  }
                  catch(Exception ex) {
View Full Code Here

      this.caseSensitive = info.getBoolean(DbWriter.CASE_SENSITIVE_KEY, false);
      this.quoteColumnNames = info.getBoolean(DbWriter.QUOTE_COLUMN_NAMES_KEY, false);
      this.charSet = info.get("charSet", null);
      this.info = info;
      try {
         this.parser = new SqlInfoParser();
         this.parser.init(info);
      }
      catch (Exception ex) {
         ex.printStackTrace();
      }
View Full Code Here

         while ( (line = reader.readLine()) != null) {
            buf.append(line).append("\n");
         }
         String newData = buf.toString();
         reader.close();
         SqlInfoParser parser = new SqlInfoParser();
         parser.init(info);
         SqlInfo oldInfo = parser.parse(oldData);
         SqlInfo newInfo = parser.parse(newData);
         String ret = SqlDescription.getDifferences(oldInfo.getDescription(), newInfo.getDescription());
         System.out.println(ret);
      }
      catch (Throwable ex) {
         ex.printStackTrace();
View Full Code Here

      "  <attr name='SUBNET_ID'>X25</attr>\n" +
      " </row>\n" +
      "</sql>\n";

     
      SqlInfoParser parser = new SqlInfoParser();
      parser.init(this.info);
      SqlInfo record = parser.parse(xml);

      SqlDescription description = record.getDescription();
      assertNotNull("the description shall not be null", description);
      assertNotNull("the identity shall not be null", description.getIdentity());
      assertNotNull("the command shall not be null", description.getCommand());
View Full Code Here

      "  <attr name='SUBNET_ID'>X25</attr>\n" +
      " </row>\n" +
      "</sql>\n";

     
      SqlInfoParser parser = new SqlInfoParser();
      parser.init(this.info);
     
      String xmlFileName = System.getProperty("xmlFileName",null);
      InputStream is = null;
      if (xmlFileName == null) {
         is = new ByteArrayInputStream(xml.getBytes());
      }
      else {
         // String isChar = System.getProperty("isChar", "false");
         // if ("true".equals(isChar))
         //    is = new InputSource(new FileReader(xmlFileName));
         // else
         // is = new InputSource(new FileInputStream(xmlFileName));
         is = new FileInputStream(xmlFileName);
        
      }
      String charSet = System.getProperty("charSet", null);
      SqlInfo record = parser.parse(is, charSet);
      SqlDescription description = record.getDescription();
      assertNotNull("the description shall not be null", description);
      assertNotNull("the identity shall not be null", description.getIdentity());
      assertNotNull("the command shall not be null", description.getCommand());
View Full Code Here

                   "    <attr name='dbId'>NULL</attr>\n" +
                   "    <attr name='version'>0.5</attr>\n" +
                   "  </row>\n" +
               "</sql>\n";
     
      SqlInfoParser parser = new SqlInfoParser();
      parser.init(this.info);
      SqlInfo record = parser.parse(xml);
      log.info(record.toXml(""));
     
      xml = "" +
      "<?xml version='1.0' encoding='UTF-8' ?>\n" +
      "<sql>\n" +
      "  <row num='0'>\n" +
      "    <col name='TEST'>100</col>\n" +
      "    <attr name='oldContent' encoding='forcePlain'><col name='TEST' encoding='base64'>Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj5MVEQgICBSQUZJUzw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8</col></attr>" +
      "    <attr name='test1' encoding='forcePlain'><col name='test2'><![CDATA[>>>>>>>>>>>>>>>>>>>>>>>>>>LTD RAFIS<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]]></col></attr>" +
      "  </row>\n" +
      "</sql>\n";

      record = parser.parse(xml);
      log.info(record.toXml(""));
     
     
      log.info("SUCCESS");
   }
View Full Code Here

            "  </row>\n" +
            "</sql>\n";
         try {
            String oldName = "COM_RECORDID";
            String newName = "COM_MESSAGEID";
            SqlInfoParser  parser = new SqlInfoParser();
            parser.init(info);
            SqlInfo sqlInfo = parser.parse(xmlTxt);
            List rows = sqlInfo.getRows();
            assertEquals("The number of rows is wrong", 1, rows.size());
            SqlRow row = (SqlRow)rows.get(0);
            log.info(row.toXml(""));
            row.renameColumn(oldName, newName);
View Full Code Here

         SqlInfo sql = createMsg(info, oldFirst, oldSecond, first, second, fifth, replKey);
        
         String xml = sql.toXml("");
         log.info(xml);
        
         SqlInfoParser parser = new SqlInfoParser();
         parser.init(info);
        
         sql = parser.parse(xml);
        
         ReplicationWriter writer = new ReplicationWriter();
         writer.init(info);
         writer.store(sql);
        
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.dbwriter.SqlInfoParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.