public boolean isFolder(String file) throws RemoteFileSystemException {
    final GridFile f = createGsiftpGridFile(file);

    final Map<String, String> urls = DtoProperty.mapFromDtoPropertiesList(f.getUrls());

    for (final String key : urls.keySet()) {
      if (key.startsWith("gsiftp")) {
        return user.getFileManager().isFolder(key);
      }
    }

    throw new RemoteFileSystemException("IsFolder not supported for virtual file system.");
  }
  public String upload(DataHandler source, String filename) throws RemoteFileSystemException {

    final GridFile f = createGsiftpGridFile(filename);

    final Map<String, String> urls = DtoProperty.mapFromDtoPropertiesList(f.getUrls());

    for (final String key : urls.keySet()) {
      if (key.startsWith("gsiftp")) {
        return user.getFileManager().upload(source, key);
      }
    }

    throw new RemoteFileSystemException("Upload not supported for virtual file system.");
  }
  public long lastModified(String url) throws RemoteFileSystemException {

    final GridFile f = createGsiftpGridFile(url);

    final Map<String, String> urls = DtoProperty.mapFromDtoPropertiesList(f.getUrls());

    for (final String key : urls.keySet()) {
      if (key.startsWith("gsiftp")) {
        return user.getFileManager().lastModified(key);
      }
    }

    throw new RemoteFileSystemException("Last modified not supported for virtual file system.");
  }
  public void filesSelected(Set<GridFile> files) {

    if ((files == null) || (files.size() == 0)) {
      getViewMenuItem().setEnabled(false);
      getRefreshMenuItem().setEnabled(false);
      getDownloadMenuItem().setEnabled(false);
      getCreateFolderMenuItem().setEnabled(false);
      getDeleteMenuItem().setEnabled(false);
      getCopyMenuItem().setEnabled(false);
      return;
    }

    if (files.size() == 1) {
      if (files.iterator().next().isFolder()) {
        getRefreshMenuItem().setEnabled(true);

        final Clipboard cb = FileManager.FILE_TRANSFER_CLIPBOARD;
        final Transferable t = cb.getContents(null);
        if (t != null) {

          final GridFile target = files.iterator().next();
          if (target.isVirtual()) {
            if (target.getUrls().size() == 1) {
              if (target.getUrl().startsWith(ServiceInterface.VIRTUAL_GRID_PROTOCOL_NAME)) {
                getPasteMenuItem().setEnabled(false);
              } else {
                getPasteMenuItem().setEnabled(true);
              }
            } else {
              getPasteMenuItem().setEnabled(true);
            }
          } else {
            getPasteMenuItem().setEnabled(true);
          }
        } else {
          getPasteMenuItem().setEnabled(false);
        }
      } else {
        getRefreshMenuItem().setEnabled(false);
        getPasteMenuItem().setEnabled(false);
      }
    } else {
      getRefreshMenuItem().setEnabled(false);
      getPasteMenuItem().setEnabled(false);
    }

    boolean folder = false;
    for (final GridFile file : files) {
      if (file.isFolder()) {
        folder = true;
      }
      if (file.isVirtual()) {

        if (folder) {
          getDownloadMenuItem().setEnabled(false);
          if (getOpenMenuItem() != null) {
            getOpenMenuItem().setEnabled(false);
          }
          getCreateFolderMenuItem().setEnabled(true);
        } else {
          if (file.getUrls().size() == 1) {
            getDownloadMenuItem().setEnabled(true);
            if (getOpenMenuItem() != null) {
              getOpenMenuItem().setEnabled(true);
            }
          } else {
            getDownloadMenuItem().setEnabled(false);
            if (getOpenMenuItem() != null) {
              getOpenMenuItem().setEnabled(false);
            }
          }
          getCreateFolderMenuItem().setEnabled(false);
        }

        getDeleteMenuItem().setEnabled(false);
        getCopyMenuItem().setEnabled(false);
        return;
      }
    }

    if (folder) {
      getViewMenuItem().setEnabled(false);
      if (getOpenMenuItem() != null) {
        getOpenMenuItem().setEnabled(false);
      }
    } else {
      getViewMenuItem().setEnabled(true);
      if (getOpenMenuItem() != null) {
        getOpenMenuItem().setEnabled(true);
      }
    }
    getDownloadMenuItem().setEnabled(true);
    getCreateFolderMenuItem().setEnabled(true);
    getDeleteMenuItem().setEnabled(true);
    getCopyMenuItem().setEnabled(true);
  }