コード例 #1
0
  private static void test(LFCServer lfcServer, String path)
      throws LFCException, URISyntaxException {
    clear(lfcServer, path);

    lfcServer.register(new URI("http://www.example.com/" + randomString()), path, 12345);

    FileDesc fd2;
    fd2 = lfcServer.fetchFileDesc(path);
    System.out.println("mtime=" + fd2.getMDate());
    System.out.println("guid=" + fd2.getGuid());
    System.out.println("size=" + fd2.getFileSize());
    lfcServer.addReplica(fd2, new URI("http://www.example.com/" + randomString()));
    lfcServer.addReplica(fd2, new URI("http://www.example.com/" + randomString()));
    ArrayList<ReplicaDesc> al = lfcServer.getReplicasByPath(path);
    for (ReplicaDesc rd : al) {
      System.out.println(rd);
    }

    // String parent = path.substring(0, path.lastIndexOf("/"));
    // System.out.println("lfc-ls -l " + parent);
    // String[] s = { "-l", "-guid", "lfn://" + host + ":" + port + parent
    // };
    // LfcCommand.doLS(s);

    // clear(lfcServer, path);
  }
コード例 #2
0
 private static void clearAll(LFCServer lfcServer, String dir) {
   try {
     ArrayList<FileDesc> l = lfcServer.listDirectory(dir);
     if (l == null) {
       return;
     }
     for (FileDesc fd : l) {
       String name = fd.getFileName();
       String path = dir + "/" + name;
       String perm = fd.getPermissions();
       if (perm == null) {
         clear(lfcServer, path);
       } else if (perm.charAt(0) == 'd') {
         clearAll(lfcServer, path);
         System.out.println("rmdir: path=" + path);
         lfcServer.rmdir(path);
       } else {
         clear(lfcServer, path);
       }
     }
     lfcServer.rmdir(dir);
   } catch (LFCException e) {
     e.printStackTrace();
   }
 }
コード例 #3
0
 private static void clear(LFCServer lfcServer, String path) {
   FileDesc fd;
   try {
     System.out.println("clear: path=" + path);
     fd = lfcServer.fetchFileDesc(path);
     lfcServer.deleteFile(fd.getGuid(), path);
   } catch (LFCException e1) {
   }
 }