Package org.apache.hdt.core.hdfs

Examples of org.apache.hdt.core.hdfs.ResourceInformation


  public HDFSClientRelease() {
    config = new Configuration();
  }

  private ResourceInformation getResourceInformation(FileStatus fileStatus) {
    ResourceInformation fi = new ResourceInformation();
    fi.setFolder(fileStatus.isDir());
    fi.setGroup(fileStatus.getGroup());
    fi.setLastAccessedTime(fileStatus.getAccessTime());
    fi.setLastModifiedTime(fileStatus.getAccessTime());
    fi.setName(fileStatus.getPath().getName());
    fi.setOwner(fileStatus.getOwner());
    fi.setPath(fileStatus.getPath().getParent() == null ? "/" : fileStatus.getPath().getParent().toString());
    fi.setReplicationFactor(fileStatus.getReplication());
    fi.setSize(fileStatus.getLen());
    FsPermission fsPermission = fileStatus.getPermission();
    updatePermissions(fi.getUserPermissions(), fsPermission.getUserAction());
    updatePermissions(fi.getGroupPermissions(), fsPermission.getGroupAction());
    updatePermissions(fi.getOtherPermissions(), fsPermission.getOtherAction());
    return fi;
  }
View Full Code Here


  @Override
  public ResourceInformation getResourceInformation(URI uri, String user) throws IOException, InterruptedException {
    FileSystem fs = createFS(uri, user);
    Path path = new Path(uri.getPath());
    FileStatus fileStatus = null;
    ResourceInformation fi = null;
    try {
      fileStatus = fs.getFileStatus(path);
      fi = getResourceInformation(fileStatus);
    } catch (FileNotFoundException fne) {
      logger.info(fne.getMessage());
View Full Code Here

        try {
          if (".project".equals(getName())) {
            fi.setExists(getLocalFile().exists());
            fi.setLength(getLocalFile().length());
          } else {
            ResourceInformation fileInformation = getClient().getResourceInformation(uri.getURI(), server.getUserId());
            if (fileInformation != null) {
              serverResourceInfo = fileInformation;
              fi.setDirectory(fileInformation.isFolder());
              fi.setExists(true);
              fi.setLastModified(fileInformation.getLastModifiedTime());
              fi.setLength(fileInformation.getSize());
              fi.setName(fileInformation.getName());
              String userId = server.getUserId();
              List<String> groupIds = server.getGroupIds();
              if (userId == null) {
                userId = getDefaultUserId();
                groupIds = getDefaultGroupIds();
              }
              fileInformation.updateEffectivePermissions(userId, groupIds);
              this.effectivePermissions = fileInformation.getEffectivePermissions();
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_READ, fileInformation.getUserPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, fileInformation.getUserPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, fileInformation.getUserPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_READ, fileInformation.getGroupPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, fileInformation.getGroupPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInformation.getGroupPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_READ, fileInformation.getOtherPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, fileInformation.getOtherPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInformation.getOtherPermissions().execute);
            }
          }
        } catch (IOException e) {
          throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
        } catch (InterruptedException e) {
View Full Code Here

          file.setReadable(info.getAttribute(EFS.ATTRIBUTE_OWNER_READ), true);
          file.setWritable(info.getAttribute(EFS.ATTRIBUTE_OWNER_WRITE), true);
          file.setExecutable(info.getAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE), true);
        }
      } else {
        ResourceInformation ri = new ResourceInformation();
        ri.setFolder(info.isDirectory());
        if ((options & EFS.SET_LAST_MODIFIED) != 0)
          ri.setLastModifiedTime(info.getLastModified());
        HDFSServer server = getServer();
        getClient().setResourceInformation(uri.getURI(), ri, server == null ? null : server.getUserId());
      }
    } catch (IOException e) {
      throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
View Full Code Here

  public HDFSClientRelease() {
    config = new Configuration();
  }

  private ResourceInformation getResourceInformation(FileStatus fileStatus) {
    ResourceInformation fi = new ResourceInformation();
    fi.setFolder(fileStatus.isDir());
    fi.setGroup(fileStatus.getGroup());
    fi.setLastAccessedTime(fileStatus.getAccessTime());
    fi.setLastModifiedTime(fileStatus.getAccessTime());
    fi.setName(fileStatus.getPath().getName());
    fi.setOwner(fileStatus.getOwner());
    fi.setPath(fileStatus.getPath().getParent() == null ? "/" : fileStatus.getPath().getParent().toString());
    fi.setReplicationFactor(fileStatus.getReplication());
    fi.setSize(fileStatus.getLen());
    FsPermission fsPermission = fileStatus.getPermission();
    updatePermissions(fi.getUserPermissions(), fsPermission.getUserAction());
    updatePermissions(fi.getGroupPermissions(), fsPermission.getGroupAction());
    updatePermissions(fi.getOtherPermissions(), fsPermission.getOtherAction());
    return fi;
  }
View Full Code Here

  @Override
  public ResourceInformation getResourceInformation(URI uri, String user) throws IOException, InterruptedException {
    FileSystem fs = createFS(uri, user);
    Path path = new Path(uri.getPath());
    FileStatus fileStatus = null;
    ResourceInformation fi = null;
    try {
      fileStatus = fs.getFileStatus(path);
      fi = getResourceInformation(fileStatus);
    } catch (FileNotFoundException fne) {
      logger.info(fne.getMessage());
View Full Code Here

          file.setReadable(info.getAttribute(EFS.ATTRIBUTE_OWNER_READ), true);
          file.setWritable(info.getAttribute(EFS.ATTRIBUTE_OWNER_WRITE), true);
          file.setExecutable(info.getAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE), true);
        }
      } else {
        ResourceInformation ri = new ResourceInformation();
        ri.setFolder(info.isDirectory());
        if ((options & EFS.SET_LAST_MODIFIED) != 0)
          ri.setLastModifiedTime(info.getLastModified());
        HDFSServer server = getServer();
        getClient().setResourceInformation(uri.getURI(), ri, server == null ? null : server.getUserId());
      }
    } catch (IOException e) {
      throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
View Full Code Here

        try {
          if (".project".equals(getName())) {
            fi.setExists(getLocalFile().exists());
            fi.setLength(getLocalFile().length());
          } else {
            ResourceInformation fileInformation = getClient().getResourceInformation(uri.getURI(), server.getUserId());
            if (fileInformation != null) {
              serverResourceInfo = fileInformation;
              fi.setDirectory(fileInformation.isFolder());
              fi.setExists(true);
              fi.setLastModified(fileInformation.getLastModifiedTime());
              fi.setLength(fileInformation.getSize());
              fi.setName(fileInformation.getName());
              String userId = server.getUserId();
              List<String> groupIds = server.getGroupIds();
              if (userId == null) {
                userId = getDefaultUserId();
                groupIds = getDefaultGroupIds();
              }
              fileInformation.updateEffectivePermissions(userId, groupIds);
              this.effectivePermissions = fileInformation.getEffectivePermissions();
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_READ, fileInformation.getUserPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, fileInformation.getUserPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE, fileInformation.getUserPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_READ, fileInformation.getGroupPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, fileInformation.getGroupPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE, fileInformation.getGroupPermissions().execute);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_READ, fileInformation.getOtherPermissions().read);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_WRITE, fileInformation.getOtherPermissions().write);
              fi.setAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE, fileInformation.getOtherPermissions().execute);
            }
          }
        } catch (IOException e) {
          throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
        } catch (InterruptedException e) {
View Full Code Here

TOP

Related Classes of org.apache.hdt.core.hdfs.ResourceInformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.