Package org.xmlBlaster.contrib.filewriter

Examples of org.xmlBlaster.contrib.filewriter.FileWriterCallback


     
      String tmpImportLocation = this.info.get("replication.importLocationChunks", this.importLocation + "/chunks");
      boolean overwriteDumpFiles = true;
      String lockExtention =  null;
      this.keepDumpFiles = info_.getBoolean("replication.keepDumpFiles", false);
      this.callback = new FileWriterCallback(this.importLocation, tmpImportLocation, lockExtention, overwriteDumpFiles, this.keepDumpFiles);
      this.info = info_;

      String parserClass = this.info.get("parser.class", "org.xmlBlaster.contrib.dbwriter.SqlInfoParser").trim();
      if (parserClass.length() > 0) {
         ClassLoader cl = this.getClass().getClassLoader();
View Full Code Here


     
      String tmpImportLocation = this.info.get("replication.importLocationChunks", this.importLocation + "/chunks");
      boolean overwriteDumpFiles = true;
      String lockExtention =  null;
      this.keepDumpFiles = info_.getBoolean("replication.keepDumpFiles", false);
      this.callback = new FileWriterCallback(this.importLocation, tmpImportLocation, lockExtention, overwriteDumpFiles, this.keepDumpFiles);
      this.info = info_;
      this.pool = (I_DbPool)info_.getObject(DbWriter.DB_POOL_KEY);
      if (this.pool == null)
         throw new Exception(ME + ".init: the pool has not been configured, please check your '" + DbWriter.DB_POOL_KEY + "' configuration settings");
View Full Code Here

      String tmpImportLocation = "/tmp/tmpFiles";
      String lockExtention = ".lock";
      boolean overwriteDumpFiles = true;
      boolean keepDumpFiles = false;
      try {
         FileWriterCallback callback = new FileWriterCallback(importLocation, tmpImportLocation, lockExtention, overwriteDumpFiles, keepDumpFiles);
         byte[] content = new byte[100000];
         File checkFile = new File("/tmp/dummy");
         checkFile.delete();
         callback.update("dummy", new ByteArrayInputStream(content), null);
         assertTrue("The file 'dummy' must exist", checkFile.exists());
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur. " + ex.getMessage(), false);
      }
     
      try {
         FileWriterCallback callback = new FileWriterCallback(importLocation, tmpImportLocation, lockExtention, overwriteDumpFiles, keepDumpFiles);
         String filename = "second.dat";
         File checkFile = new File("/tmp/" + filename);
         checkFile.delete();
         HashMap map = new HashMap();
         map.put("_filename", new ClientProperty("_filename", null, null, filename));
         String key = XBMessage.addToKeyAndCheck(XBConnectionMetaData.JMSX_GROUP_SEQ);
         map.put(key, new ClientProperty(key, null, null, "" + 0L));
         callback.update("dummy", new ByteArrayInputStream("first".getBytes()), map);

         map.clear();
         map.put("_filename", new ClientProperty("_filename", null, null, filename));
         key = XBMessage.addToKeyAndCheck(XBConnectionMetaData.JMSX_GROUP_SEQ);
         map.put(key, new ClientProperty(key, null, null, "" + 1L));
         callback.update("dummy", new ByteArrayInputStream("second".getBytes()), map);
        
         map.clear();
         map.put("_filename", new ClientProperty("_filename", null, null, filename));
         key = XBMessage.addToKeyAndCheck(XBConnectionMetaData.JMSX_GROUP_SEQ);
         map.put(key, new ClientProperty(key, null, null, "" + 2L));
         key = XBMessage.addToKeyAndCheck(XBConnectionMetaData.JMSX_GROUP_EOF);
         map.put(key, new ClientProperty(key, null, null, "true"));
         callback.update("dummy", new ByteArrayInputStream("third".getBytes()), map);
        
         assertTrue("The file 'dummy' must exist", checkFile.exists());
         FileInputStream fis = new FileInputStream(checkFile);
         byte[] buf = new byte[100];
         fis.read(buf);
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.filewriter.FileWriterCallback

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.