Exemple #1
0
  // bulk method to fetch all transport VRLs at once;
  public VRL[] getTransportVRLsForChildren() throws VrsException {
    // list full details:
    VFSNode[] nodesArray = list();

    ArrayList<String> filePathsList = new ArrayList<String>();
    // get file paths
    for (int i = 0; i < nodesArray.length; i++) {
      if (nodesArray[i] instanceof SRMFile) {
        filePathsList.add(nodesArray[i].getPath());
      }
      // else skip directories!
    }

    // get transfer urls
    String[] filePathsArray = new String[filePathsList.size()];
    filePathsArray = filePathsList.toArray(filePathsArray);

    ITaskMonitor monitor =
        getVRSContext()
            .getTaskWatcher()
            .getCurrentThreadTaskMonitor("getTransportVRLsForChildern", -1);
    VRL[] tVrls = srmfs.getTransportVRLs(monitor, filePathsArray);

    return tVrls;
  }
Exemple #2
0
  @Override
  public boolean exists() throws VrsException {
    if (srmfs.pathExists(getPath()) == false) return false;

    // path exists, now check for directory type !
    return this.srmfs.isDirectory(this.fetchFullDetails().getType());
  }
Exemple #3
0
  private TMetaDataPathDetail fetchFullDetails() throws VrsException {
    // check if full details have been fetched. If not fetch them.
    if (srmDetails == null) {
      srmDetails = srmfs.queryPath(getPath());
    }

    return srmDetails;
  }
Exemple #4
0
  public VRL rename(String newName, boolean renameFullPath) throws VrsException {
    String newPath = null;

    if ((renameFullPath == true) || (newName.startsWith("/"))) newPath = newName;
    else newPath = getVRL().getDirname() + "/" + newName;

    return srmfs.mv(getPath(), newPath);
  }
Exemple #5
0
 public boolean delete(boolean recurse) throws VrsException {
   ITaskMonitor monitor =
       getVRSContext()
           .getTaskWatcher()
           .getCurrentThreadTaskMonitor("Deleting (SRM) directory:" + this.getPath(), 1);
   monitor.logPrintf("Deleting SRM Directory:" + this + "\n");
   return srmfs.rmdir(getPath(), recurse);
 }
Exemple #6
0
 public SRMDir(SRMFileSystem client, TMetaDataPathDetail details, DirQuery dirQ) {
   super(client, (VRL) null);
   this.srmfs = client;
   this.srmDetails = details;
   this.dirQuery = dirQ;
   // recreate Dir VRL !
   VRL vrl = client.createPathVRL(details.getPath(), null);
   this.setLocation(vrl);
 }
Exemple #7
0
  public SRMDir(SRMFileSystem client, VRL vrl) {
    super(client, (VRL) null);
    this.srmfs = client;

    // parse dir query or return null object!
    this.dirQuery = DirQuery.parseDirQuery(vrl);

    // update VRL !
    VRL parsedVrl = client.createPathVRL(vrl.getPath(), dirQuery);
    this.setLocation(parsedVrl);
  }
Exemple #8
0
 public boolean create(boolean force) throws VrsException {
   VDir dir = srmfs.createDir(getPath(), force);
   return (dir != null);
 }
Exemple #9
0
 private void debugPrintf(String format, Object... args) {
   SRMFileSystem.getLogger().debugPrintf("SRMDir:" + format, args);
   // System.err.printf(format,args);
 }