public String toString() {
   String ret =
       "<CFDbTestValueByScopeIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredScopeId="
           + "\""
           + Long.toString(getRequiredScopeId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamClearTopDepByContTblIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredContTableId="
           + "\""
           + Long.toString(getRequiredContTableId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFFreeSwitchPbxIvrMenuEntryByMenuIdIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredMenuId="
           + "\""
           + Long.toString(getRequiredMenuId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamScopePKey"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredId="
           + "\""
           + Long.toString(getRequiredId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFCrmMemoTagByTagIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredTagId="
           + "\""
           + Long.toString(getRequiredTagId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamTimeColByTableIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredTableId="
           + "\""
           + Long.toString(getRequiredTableId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFCrmContactURLPKey"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredContactURLId="
           + "\""
           + Long.toString(getRequiredContactURLId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamPopDepByRelationIdx"
           + " RequiredRelationTenantId="
           + "\""
           + Long.toString(getRequiredRelationTenantId())
           + "\""
           + " RequiredRelationId="
           + "\""
           + Long.toString(getRequiredRelationId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFDbTestBoolTypeBySchemaIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredSchemaDefId="
           + "\""
           + Long.toString(getRequiredSchemaDefId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFAsteriskClusterId64Gen"
           + " RequiredId="
           + "\""
           + Long.toString(getRequiredId())
           + "\""
           + ", SliceId=\""
           + Short.toString(getRequiredSliceId())
           + "\""
           + ", NextId=\""
           + Long.toString(nextId)
           + "\"/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFFreeSwitchFSSFDialerHPKey"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredFSSFDialerId="
           + "\""
           + Long.toString(getRequiredFSSFDialerId())
           + "\""
           + " RequiredRevision=\""
           + Integer.toString(getRequiredRevision())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamValueHPKey"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredId="
           + "\""
           + Long.toString(getRequiredId())
           + "\""
           + " RequiredRevision=\""
           + Integer.toString(getRequiredRevision())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFDbTestTableByUNameIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredSchemaDefId="
           + "\""
           + Long.toString(getRequiredSchemaDefId())
           + "\""
           + " RequiredName="
           + "\""
           + CFDbTestSchema.xmlEncodeString(getRequiredName())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFInternetMajorVersionByNameIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredParentProjectId="
           + "\""
           + Long.toString(getRequiredParentProjectId())
           + "\""
           + " RequiredName="
           + "\""
           + CFInternetSchema.xmlEncodeString(getRequiredName())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFSecurityHostNodeByClusterIdx"
           + " RequiredClusterId="
           + "\""
           + Long.toString(getRequiredClusterId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFAccAccountContactByTenantIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + "/>";
   return (ret);
 }
示例#17
0
  /** Sets up configuration based on params */
  private static boolean setup(Hashtable<String, String> curConf, Configuration argConf) {

    if (argConf.get("file") == null) {
      logger.fatal("Missing file parameter");
      System.exit(1);
    }

    if (argConf.get("hdfs_base_path") == null) {
      logger.fatal("Missing HDFS base path, check gestore-conf.xml");
      System.exit(1);
    }

    if (argConf.get("hdfs_temp_path") == null) {
      logger.fatal("Missing HDFS temp path, check gestore-conf.xml");
      System.exit(1);
    }

    if (argConf.get("local_temp_path") == null) {
      logger.fatal("Missing local temp path, check gestore-conf.xml");
      System.exit(1);
    }

    // Input paramaters
    curConf.put("run_id", argConf.get("run", ""));
    curConf.put("task_id", argConf.get("task", ""));
    curConf.put("file_id", argConf.get("file"));
    curConf.put("local_path", argConf.get("path", ""));
    curConf.put("type", argConf.get("type", "l2r"));
    curConf.put("timestamp_start", argConf.get("timestamp_start", "1"));
    curConf.put(
        "timestamp_stop", argConf.get("timestamp_stop", Integer.toString(Integer.MAX_VALUE)));
    curConf.put("delimiter", argConf.get("regex", "ID=.*"));
    curConf.put("taxon", argConf.get("taxon", "all"));
    curConf.put("intermediate", argConf.get("full_run", "false"));
    curConf.put("quick_add", argConf.get("quick_add", "false"));
    Boolean full_run = curConf.get("intermediate").matches("(?i).*true.*");
    curConf.put("format", argConf.get("format", "unknown"));
    curConf.put("split", argConf.get("split", "1"));
    curConf.put("copy", argConf.get("copy", "true"));

    // Constants
    curConf.put("base_path", argConf.get("hdfs_base_path"));
    curConf.put("temp_path", argConf.get("hdfs_temp_path"));
    curConf.put("local_temp_path", argConf.get("local_temp_path"));
    curConf.put("db_name_files", argConf.get("hbase_file_table"));
    curConf.put("db_name_runs", argConf.get("hbase_run_table"));
    curConf.put("db_name_updates", argConf.get("hbase_db_update_table"));

    // Timestamps
    Date currentTime = new Date();
    Date endDate = new Date(new Long(curConf.get("timestamp_stop")));
    curConf.put("timestamp_real", Long.toString(currentTime.getTime()));

    return true;
  }
示例#18
0
 /**
  * Formats the given long value into a human readable notation using the Kilo, Mega, Giga, etc.
  * abbreviations.
  *
  * @param value the value to format
  * @return the string representation
  */
 public static String humanize(long value) {
   if (value < 0) {
     return '-' + humanize(-value);
   } else if (value > 1000000000000000000L) {
     return Double.toString(
             (value + 500000000000000L)
                 / 1000000000000000L
                 * 1000000000000000L
                 / 1000000000000000000.0)
         + 'E';
   } else if (value > 100000000000000000L) {
     return Double.toString(
             (value + 50000000000000L) / 100000000000000L * 100000000000000L / 1000000000000000.0)
         + 'P';
   } else if (value > 10000000000000000L) {
     return Double.toString(
             (value + 5000000000000L) / 10000000000000L * 10000000000000L / 1000000000000000.0)
         + 'P';
   } else if (value > 1000000000000000L) {
     return Double.toString(
             (value + 500000000000L) / 1000000000000L * 1000000000000L / 1000000000000000.0)
         + 'P';
   } else if (value > 100000000000000L) {
     return Double.toString(
             (value + 50000000000L) / 100000000000L * 100000000000L / 1000000000000.0)
         + 'T';
   } else if (value > 10000000000000L) {
     return Double.toString((value + 5000000000L) / 10000000000L * 10000000000L / 1000000000000.0)
         + 'T';
   } else if (value > 1000000000000L) {
     return Double.toString((value + 500000000) / 1000000000 * 1000000000 / 1000000000000.0) + 'T';
   } else if (value > 100000000000L) {
     return Double.toString((value + 50000000) / 100000000 * 100000000 / 1000000000.0) + 'G';
   } else if (value > 10000000000L) {
     return Double.toString((value + 5000000) / 10000000 * 10000000 / 1000000000.0) + 'G';
   } else if (value > 1000000000) {
     return Double.toString((value + 500000) / 1000000 * 1000000 / 1000000000.0) + 'G';
   } else if (value > 100000000) {
     return Double.toString((value + 50000) / 100000 * 100000 / 1000000.0) + 'M';
   } else if (value > 10000000) {
     return Double.toString((value + 5000) / 10000 * 10000 / 1000000.0) + 'M';
   } else if (value > 1000000) {
     return Double.toString((value + 500) / 1000 * 1000 / 1000000.0) + 'M';
   } else if (value > 100000) {
     return Double.toString((value + 50) / 100 * 100 / 1000.0) + 'K';
   } else if (value > 10000) {
     return Double.toString((value + 5) / 10 * 10 / 1000.0) + 'K';
   } else if (value > 1000) {
     return Double.toString(value / 1000.0) + 'K';
   } else {
     return Long.toString(value) + ' ';
   }
 }
 public String toString() {
   String ret =
       "<CFSecurityTenantByUNameIdx"
           + " RequiredClusterId="
           + "\""
           + Long.toString(getRequiredClusterId())
           + "\""
           + " RequiredTenantName="
           + "\""
           + CFSecuritySchema.xmlEncodeString(getRequiredTenantName())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFSecuritySecGroupFormByGroupIdx"
           + " RequiredClusterId="
           + "\""
           + Long.toString(getRequiredClusterId())
           + "\""
           + " RequiredSecGroupId="
           + "\""
           + Integer.toString(getRequiredSecGroupId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFDbTestOptFullRangeByUDescrIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredDescription="
           + "\""
           + CFDbTestSchema.xmlEncodeString(getRequiredDescription())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFBamTSecGroupIncludeByIncludeIdx"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredIncludeGroupId="
           + "\""
           + Integer.toString(getRequiredIncludeGroupId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFSecurityTSecGroupPKey"
           + " RequiredTenantId="
           + "\""
           + Long.toString(getRequiredTenantId())
           + "\""
           + " RequiredTSecGroupId="
           + "\""
           + Integer.toString(getRequiredTSecGroupId())
           + "\""
           + "/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFCrmClusterId32Gen"
           + " RequiredId="
           + "\""
           + Long.toString(getRequiredId())
           + "\""
           + ", SliceId=\""
           + Short.toString(getRequiredSliceId())
           + "\""
           + ", NextId=\""
           + Integer.toString(nextId)
           + "\"/>";
   return (ret);
 }
 public String toString() {
   String ret =
       "<CFSecuritySecFormHPKey"
           + " RequiredClusterId="
           + "\""
           + Long.toString(getRequiredClusterId())
           + "\""
           + " RequiredSecFormId="
           + "\""
           + Integer.toString(getRequiredSecFormId())
           + "\""
           + " RequiredRevision=\""
           + Integer.toString(getRequiredRevision())
           + "\""
           + "/>";
   return (ret);
 }
示例#26
0
 public void genSeed(ActionEvent e) {
   long seed = 0;
   boolean redo = false;
   do {
     redo = false;
     String seedString =
         JOptionPane.showInputDialog(
             this, "Enter a number:", Long.toString(rand.nextLong(), 36)
             // "Random Seed", JOptionPane.QUESTION_MESSAGE
             );
     if (seedString == null) return;
     try {
       seed = Long.parseLong(seedString, 36);
     } catch (NumberFormatException ex) {
       JOptionPane.showMessageDialog(this, "Use only letters and numbers, max 12 characters.");
       redo = true;
     }
   } while (redo);
   genSeed(seed);
 }
示例#27
0
文件: Macro.java 项目: bramk/bnd
 public String _currenttime(@SuppressWarnings("unused") String args[]) {
   return Long.toString(System.currentTimeMillis());
 }
示例#28
0
  // Information needed to get a single file:
  // BASE_PATH, FILE_ID, TIMESTAMP_START, TIMESTAMP_STOP, SOURCE, FILESYSTEM
  private static Vector<Path> getFile(
      FileSystem fs, Hashtable<String, String> config, dbutil db_util) throws Exception {
    Long latestVersion = latestVersion(config, db_util);

    try {
      config.put("timestamp_start", config.get("timestamp_start"));
      config.put("timestamp_real", latestVersion.toString());
      config.put("timestamp_stop", latestVersion.toString());
    } catch (Exception E) {
      logger.error("Tryign to get file that is impossible to generate: " + getFullPath(config));
      return null;
    }
    if (Integer.parseInt(config.get("timestamp_start"))
        > Integer.parseInt(config.get("timestamp_stop"))) {
      return null;
    }
    logger.debug(
        "Getting DB for timestamp "
            + config.get("timestamp_start")
            + " to "
            + config.get("timestamp_stop"));

    String final_result = getFullPath(config);

    String temp_path_base =
        config.get("local_temp_path")
            + "_"
            + config.get("task_id")
            + "_"
            + config.get("run_id")
            + "/";
    Path newPath = new Path(final_result + "*");
    Vector<Path> ret_path = new Vector<Path>();
    String lockName = lock(final_result.replaceAll("/", "_"));
    if (fs.globStatus(newPath).length != 0) {
      ret_path.add(newPath);
      unlock(lockName);
      config.put("full_file_name", final_result);
      return ret_path;
    } else {
      if (!config.get("source").equals("local")) {
        config.put("temp_path_base", temp_path_base);

        config.put("timestamp_start", config.get("timestamp_start"));
        config.put("timestamp_real", latestVersion.toString());
        config.put("timestamp_stop", latestVersion.toString());

        Class<?> sourceClass =
            Class.forName("org.gestore.plugin.source." + config.get("source") + "Source");
        Method process_data = sourceClass.getMethod("process", Hashtable.class, FileSystem.class);
        Object processor = sourceClass.newInstance();
        Object retVal;
        try {
          retVal = process_data.invoke(processor, config, fs);
        } catch (InvocationTargetException E) {
          Throwable exception = E.getTargetException();
          logger.error("Unable to call method in child class: " + exception.toString());
          exception.printStackTrace(System.out);
          unlock(lockName);
          return null;
        }
        FileStatus[] files = (FileStatus[]) retVal;
        if (files == null) {
          logger.error("Error getting files, no files returned");
          return null;
        }

        for (FileStatus file : files) {
          Path cur_file = file.getPath();
          Path cur_local_path = new Path(temp_path_base + config.get("file_id"));
          String suffix = getSuffix(config.get("file_id"), cur_file.getName());
          cur_local_path = cur_local_path.suffix(suffix);
          Path res_path = new Path(new String(final_result + suffix));
          logger.debug("Moving file" + cur_file.toString() + " to " + res_path.toString());
          if (config.get("copy").equals("true")) {
            fs.moveFromLocalFile(cur_file, res_path);
          } else {
            fs.rename(cur_file, res_path);
          }
        }

        config.put("full_file_name", final_result);
      }
    }
    unlock(lockName);
    return ret_path;
  }
示例#29
0
  public int run(String[] args) throws Exception {
    // printUsage();
    /*
     * SETUP
     */
    Configuration argConf = getConf();
    Hashtable<String, String> confArg = new Hashtable<String, String>();
    setup(confArg, argConf);
    Date currentTime = new Date();
    Date endDate = new Date(new Long(confArg.get("timestamp_stop")));
    Boolean full_run = confArg.get("intermediate").matches("(?i).*true.*");
    Boolean quick_add = confArg.get("quick_add").matches("(?i).*true.*");
    logger.info("Running GeStore");

    // ZooKeeper setup
    Configuration config = HBaseConfiguration.create();
    zkWatcher = new ZooKeeperWatcher(config, "Testing", new HBaseAdmin(config));
    zkInstance =
        new ZooKeeper(
            ZKConfig.getZKQuorumServersString(config),
            config.getInt("zookeeper.session.timeout", -1),
            zkWatcher);

    if (!confArg.get("task_id").isEmpty()) {
      confArg.put("temp_path", confArg.get("temp_path") + confArg.get("task_id"));
    }

    String lockRequest = confArg.get("file_id");
    if (!confArg.get("run_id").isEmpty())
      lockRequest = lockRequest + "_" + confArg.get("run_id") + "_";
    if (!confArg.get("task_id").isEmpty())
      lockRequest = lockRequest + "_" + confArg.get("task_id") + "_";

    // Get type of movement
    toFrom type_move = checkArgs(confArg);
    if (type_move == toFrom.LOCAL2REMOTE && !confArg.get("format").equals("unknown")) {
      List<String> arguments = new ArrayList<String>();
      arguments.add("-Dinput=" + confArg.get("local_path"));
      arguments.add("-Dtable=" + confArg.get("file_id"));
      arguments.add("-Dtimestamp=" + confArg.get("timestamp_stop"));
      arguments.add("-Dtype=" + confArg.get("format"));
      arguments.add("-Dtarget_dir=" + confArg.get("base_path") + "_" + confArg.get("file_id"));
      arguments.add("-Dtemp_hdfs_path=" + confArg.get("temp_path"));
      arguments.add("-Drun_id=" + confArg.get("run_id"));
      if (!confArg.get("run_id").isEmpty()) arguments.add("-Drun_id=" + confArg.get("run_id"));
      if (!confArg.get("task_id").isEmpty()) arguments.add("-Dtask_id=" + confArg.get("task_id"));
      if (quick_add) arguments.add("-Dquick_add=" + confArg.get("quick_add"));
      String lockName = lock(lockRequest);
      String[] argumentString = arguments.toArray(new String[arguments.size()]);
      adddb.main(argumentString);
      unlock(lockName);
      System.exit(0);
    }

    // Database registration

    dbutil db_util = new dbutil(config);
    db_util.register_database(confArg.get("db_name_files"), true);
    db_util.register_database(confArg.get("db_name_runs"), true);
    db_util.register_database(confArg.get("db_name_updates"), true);
    FileSystem hdfs = FileSystem.get(config);
    FileSystem localFS = FileSystem.getLocal(config);

    // Get source type
    confArg.put("source", getSource(db_util, confArg.get("db_name_files"), confArg.get("file_id")));
    confArg.put(
        "database", isDatabase(db_util, confArg.get("db_name_files"), confArg.get("file_id")));
    if (!confArg.get("source").equals("local")
        && type_move == toFrom.REMOTE2LOCAL
        && !confArg.get("timestamp_stop").equals(Integer.toString(Integer.MAX_VALUE))) {
      confArg.put("timestamp_stop", Long.toString(latestVersion(confArg, db_util)));
    }

    /*
     * Get previous timestamp
     */
    Get run_id_get = new Get(confArg.get("run_id").getBytes());
    Result run_get = db_util.doGet(confArg.get("db_name_runs"), run_id_get);
    KeyValue run_file_prev =
        run_get.getColumnLatest(
            "d".getBytes(), (confArg.get("file_id") + "_db_timestamp").getBytes());
    String last_timestamp = new String("0");
    if (null != run_file_prev && !confArg.get("source").equals("local")) {
      long last_timestamp_real = run_file_prev.getTimestamp();
      Long current_timestamp = new Long(confArg.get("timestamp_real"));
      if ((current_timestamp - last_timestamp_real) > 36000) {
        last_timestamp = new String(run_file_prev.getValue());
        Integer lastTimestamp = new Integer(last_timestamp);
        lastTimestamp += 1;
        last_timestamp = lastTimestamp.toString();
        logger.info("Last timestamp: " + last_timestamp + " End data: " + endDate);
        Date last_run = new Date(run_file_prev.getTimestamp());
        if (last_run.before(endDate) && !full_run) {
          confArg.put("timestamp_start", last_timestamp);
        }
      }
    }

    Integer tse = new Integer(confArg.get("timestamp_stop"));
    Integer tss = new Integer(confArg.get("timestamp_start"));
    if (tss > tse) {
      logger.info("No new version of requested file.");
      return 0;
    }

    /*
     * Generate file
     */

    String lockName = lock(lockRequest);

    Get file_id_get = new Get(confArg.get("file_id").getBytes());
    Result file_get = db_util.doGet(confArg.get("db_name_files"), file_id_get);
    if (!file_get.isEmpty()) {
      boolean found =
          hasFile(
              db_util,
              hdfs,
              confArg.get("db_name_files"),
              confArg.get("file_id"),
              getFullPath(confArg));
      if (confArg.get("source").equals("fullfile")) {
        found = false;
      }
      String filenames_put =
          getFileNames(
              db_util, confArg.get("db_name_files"), confArg.get("file_id"), getFullPath(confArg));
      // Filename not found in file database
      if (!found && type_move == toFrom.REMOTE2LOCAL) {
        if (!confArg.get("source").equals("local")) {
          // Generate intermediate file
          if (getFile(hdfs, confArg, db_util) == null) {
            unlock(lockName);
            return 1;
          }
          // Put generated file into file database
          if (!confArg.get("format").equals("fullfile")) {
            putFileEntry(
                db_util,
                hdfs,
                confArg.get("db_name_files"),
                confArg.get("file_id"),
                confArg.get("full_file_name"),
                confArg.get("source"));
          }
        } else {
          logger.warn("Remote file not found, and cannot be generated! File: " + confArg);
          unlock(lockName);
          return 1;
        }
      }
    } else {
      if (type_move == toFrom.REMOTE2LOCAL) {
        logger.warn("Remote file not found, and cannot be generated.");
        unlock(lockName);
        return 1;
      }
    }

    /*
     * Copy file
     * Update tables
     */

    if (type_move == toFrom.LOCAL2REMOTE) {
      if (!confArg.get("format").equals("fullfile")) {
        putFileEntry(
            db_util,
            hdfs,
            confArg.get("db_name_files"),
            confArg.get("file_id"),
            getFullPath(confArg),
            confArg.get("source"));
      }
      putRunEntry(
          db_util,
          confArg.get("db_name_runs"),
          confArg.get("run_id"),
          confArg.get("file_id"),
          confArg.get("type"),
          confArg.get("timestamp_real"),
          confArg.get("timestamp_stop"),
          getFullPath(confArg),
          confArg.get("delimiter"));
      hdfs.copyFromLocalFile(new Path(confArg.get("local_path")), new Path(getFullPath(confArg)));
    } else if (type_move == toFrom.REMOTE2LOCAL) {
      FileStatus[] files = hdfs.globStatus(new Path(getFullPath(confArg) + "*"));
      putRunEntry(
          db_util,
          confArg.get("db_name_runs"),
          confArg.get("run_id"),
          confArg.get("file_id"),
          confArg.get("type"),
          confArg.get("timestamp_real"),
          confArg.get("timestamp_stop"),
          getFullPath(confArg),
          confArg.get("delimiter"));
      unlock(lockName);
      for (FileStatus file : files) {
        Path cur_file = file.getPath();
        Path cur_local_path =
            new Path(new String(confArg.get("local_path") + confArg.get("file_id")));
        String suffix = getSuffix(getFileName(confArg), cur_file.getName());
        if (suffix.length() > 0) {
          cur_local_path = cur_local_path.suffix(new String("." + suffix));
        }
        if (confArg.get("copy").equals("true")) {
          String crc = hdfs.getFileChecksum(cur_file).toString();
          if (checksumLocalTest(cur_local_path, crc)) {
            continue;
          } else {
            hdfs.copyToLocalFile(cur_file, cur_local_path);
            writeChecksum(cur_local_path, crc);
          }
        } else {
          System.out.println(cur_local_path + "\t" + cur_file);
        }
      }
    }
    unlock(lockName);
    return 0;
  }
示例#30
0
 public void genSeed(long seed) {
   System.out.println(Long.toString(seed, 36));
   showPuzzle(new AngryPuzzle(wordList, seed));
 }