コード例 #1
0
ファイル: LogCategorizer.java プロジェクト: joshmoore/netcdf
  public static PathMatcher readRoots() {
    PathMatcher pathMatcher = new PathMatcher();
    String rootString = StringUtil.replace(roots, "\n", ",");
    String[] roots = rootString.split(",");
    for (int i = 0; i < roots.length; i += 2) {
      if (showRoots) System.out.printf("  %-40s %-40s%n", roots[i], roots[i + 1]);
      pathMatcher.put(roots[i], roots[i + 1]);
    }

    return pathMatcher;
  }
コード例 #2
0
ファイル: LogCategorizer.java プロジェクト: joshmoore/netcdf
  public static String getDataroot(String path, int status) {
    if (pathMatcher == null) pathMatcher = readRoots();

    String ss = getServiceSpecial(path);
    if (ss != null) return "service-" + ss;

    if (path.startsWith("//thredds/")) path = path.substring(1);

    if (!path.startsWith("/thredds/")) return "zervice-root";

    String dataRoot = null;
    String spath = path.substring(9); // remove /thredds/
    String service = findService(spath);
    if (service != null) {
      // if (service.equals("radarServer")) dataRoot = "radarServer";
      // else if (service.equals("casestudies")) dataRoot = "casestudies";
      // else if (service.equals("dqc")) dataRoot = "dqc";
      if (spath.length() > service.length()) {
        spath = spath.substring(service.length() + 1);
        PathMatcher.Match match = pathMatcher.match(spath);
        if (match != null) dataRoot = match.root;
      }
    }

    if (dataRoot == null) {
      if (status >= 400) dataRoot = "zBad";
    }

    if (dataRoot == null) {
      service = getService(path);
      dataRoot = (service != null) ? "zervice-" + service : "unknown";
    }
    return dataRoot;
  }
コード例 #3
0
ファイル: Backup.java プロジェクト: petermost/Snippets
  @Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    if (_pathMatcher.matches(file.getFileName())) storeFile(file.toFile());

    return super.visitFile(file, attrs);
  }