Package org.xmlBlaster.contrib

Examples of org.xmlBlaster.contrib.I_Info


         // I_Info cfgInfo = new PropertiesInfo(new Properties());
        
         ReplicationAgent agent = new ReplicationAgent();

         GlobalInfo cfgInfo = agent.prepare(args);
         I_Info readerInfo = agent.createReaderInfo(cfgInfo);
         I_Info writerInfo = agent.createWriterInfo(agent.prepare(args));
        
         if (ReplicationAgent.needsHelp(args)) {
            agent.displayHelp(readerInfo, writerInfo);
            System.exit(-1);
         }
View Full Code Here


      if (!masterFilename.equalsIgnoreCase("default")) {
         InputStream is = getFileFromClasspath(masterFilename);
         props.load(is);
         is.close();
      }
      I_Info readerInfo = new OwnGlobalInfo(cfgInfo, new PropertiesInfo(props), "reader", null);
      Map defaultMap = getReaderDefaultMap(readerInfo);
     
      String[] keys = (String[])defaultMap.keySet().toArray(new String[defaultMap.size()]);
      for (int i=0; i < keys.length; i++) {
         if (readerInfo.get(keys[i], null) == null)
            readerInfo.put(keys[i], (String)defaultMap.get(keys[i]));
      }
      return readerInfo;
   }
View Full Code Here

      }
     
      I_InitialUpdateListener listener = null;
      if (stopWatcherOnIU)
         listener = this;
      I_Info writerInfo = new OwnGlobalInfo(cfgInfo, new PropertiesInfo(props), "writer", listener);
     
      Map defaultMap = getWriterDefaultMap(writerInfo);
      String[] keys = (String[])defaultMap.keySet().toArray(new String[defaultMap.size()]);
      for (int i=0; i < keys.length; i++) {
         if (writerInfo.get(keys[i], null) == null)
            writerInfo.put(keys[i], (String)defaultMap.get(keys[i]));
      }
      return writerInfo;
     
   }
View Full Code Here

   }
  
   public void stopInitialUpdate() throws Exception {
      if (hasDbWatcher) {
         GlobalInfo cfgInfo = prepare(cmdLineArgs);
         I_Info readerInfo = createReaderInfo(cfgInfo);
         startDbWatcher(readerInfo);
         log.info("The DbWatcher has been successfully restarted");
      }
   }
View Full Code Here

  
   public final void process(I_Info readerInfo, I_Info writerInfo) throws Exception {
      InputStreamReader isr = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(isr);

      I_Info info = readerInfo;
      if (info == null)
         info = writerInfo;
      if (info == null)
         return;
     
      I_DbPool pool = (I_DbPool)info.getObject("db.pool");
      Connection conn = null;
     
      String prompt = "master>";
      if (readerInfo == null)
         prompt = "slave>";
View Full Code Here

   public static TableToWatchInfo[] getTablesToWatch(Connection conn, I_Info originalInfo) throws Exception {
      synchronized (originalInfo) {
         Iterator iter = originalInfo.getKeys().iterator();

         // prepare defaults defined with a '*' token
         I_Info ownInfo = new PropertiesInfo(new Properties());
         while (iter.hasNext()) {
            String key = ((String)iter.next()).trim();
            if (!key.startsWith(TABLE_PREFIX_WITH_SEP))
               continue;
            String val = originalInfo.get(key, null);
            if (key.indexOf(ALL_TOKEN) < 0L) {
               ownInfo.put(key, val);
               continue;
            }
            TableToWatchInfo tableToWatch = new TableToWatchInfo();
            tableToWatch.assignFromInfoPair(key, val);
            String[] tableNames = getTablesForSchema(TABLE_PREFIX_WITH_SEP, conn, tableToWatch);
            for (int i=0; i < tableNames.length; i++)
               ownInfo.put(tableNames[i], "");
         }

         TreeMap map = new TreeMap();
         int count = 0;
         iter = ownInfo.getKeys().iterator();
         while (iter.hasNext()) {
            String key = ((String)iter.next()).trim();
            if (!key.startsWith(TABLE_PREFIX_WITH_SEP))
               continue;
            count++;
            String val = ownInfo.get(key, null);
            TableToWatchInfo tableToWatch = new TableToWatchInfo();
            tableToWatch.assignFromInfoPair(key, val);
            Long mapKey = new Long(tableToWatch.getReplKey());
            ArrayList list = (ArrayList)map.get(mapKey);
            if (list == null) {
View Full Code Here

    * @throws Exception Can be of any type
    */
   private void pollingExample(Preferences prefs) throws Exception {
      log.info("Start polling test");
     
      I_Info info = new Info(prefs);
      DbWriter processor = new DbWriter(info);
     
      long sleep = info.getLong("example.sleep", 0L);
      if (sleep > 0) {
         log.info("Sleeping for '" + sleep / 1000 + " seconds");
         Thread.sleep(sleep);
      }
      else {
View Full Code Here

     
   }

   public final I_Info init(I_Info origInfo) throws XmlBlasterException {
      table = origInfo.get(prefix + ".table." + tableNameDefault, tableNameDefault);
      I_Info info = super.init(origInfo);
      prepareDefaultStatements();
      info.put("table", table);
     
      String tmp = info.get(base + ".table." + XBStoreFactory.getName(), XBStoreFactory.getName());
      info.put(XBStoreFactory.getName(), tmp);
      tmp = info.get(base + ".table." + XBMeatFactory.getName(), XBMeatFactory.getName());
      info.put(XBMeatFactory.getName(), tmp);
      doInit(info);

      insertSt = info.get(prefix + ".insertStatement", insertSt);
      deleteAllSt = info.get(prefix + ".deleteAllStatement", deleteAllSt);
      deleteSt = info.get(prefix + ".deleteStatement", deleteSt);
      deleteTransientsSt = info.get(prefix + ".deleteTransientsSttatement", deleteTransientsSt);
      getSt = info.get(prefix + ".getStatement", getSt);
      getAllSt = info.get(prefix + ".getAllStatement", getAllSt);
      createSt = info.get(prefix + ".createStatement", createSt);
      dropSt = info.get(prefix + ".dropStatement", dropSt);
      countSt = info.get(prefix + ".countStatement", countSt);
      getNumOfAllSt = info.get(prefix + ".getNumOfAllStatement", getNumOfAllSt);
      return info;
   }
View Full Code Here

    * @param info
    * @return
    * @throws Exception
    */
   public static I_DbPool getDbInfoPool(I_Info info) throws Exception {
      I_Info infoForDbInfo = (I_Info)info.getObject("infoForDbInfo");
      if (infoForDbInfo == null) {
         Map dbInfoMap = InfoHelper.getPropertiesStartingWith("dbinfo.", info, null, "db.");
         if (dbInfoMap.containsKey("db.url")) {
            infoForDbInfo = new PropertiesInfo(new Properties());
            InfoHelper.fillInfoWithEntriesFromMap(infoForDbInfo, dbInfoMap);
View Full Code Here

         System.err.println("Usage: java " + SqlInfoParser.class.getName() + " inputFilename");
         System.exit(-1);
      }
     
      try {
         I_Info info = new PropertiesInfo(System.getProperties());
         SqlInfoParser parser = new SqlInfoParser();
         parser.init(info);
         SqlInfo sqlInfo = parser.readObject(new FileInputStream(args[0]), null);
         System.out.println("Number of rows: " + sqlInfo.getRowCount());
      }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.I_Info

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.