List of usage examples for org.apache.hadoop.fs.permission PermissionStatus read
public static PermissionStatus read(DataInput in) throws IOException
From source file:io.hops.metadata.adaptor.INodeDALAdaptor.java
License:Apache License
@Override public org.apache.hadoop.hdfs.server.namenode.INode convertDALtoHDFS(INode hopINode) throws StorageException { org.apache.hadoop.hdfs.server.namenode.INode inode = null; if (hopINode != null) { DataInputBuffer buffer = new DataInputBuffer(); buffer.reset(hopINode.getPermission(), hopINode.getPermission().length); PermissionStatus ps = null;/* w w w .jav a 2 s . c o m*/ try { ps = PermissionStatus.read(buffer); } catch (IOException e) { throw new StorageException(e); } if (hopINode.isDir()) { if (hopINode.isDirWithQuota()) { inode = new INodeDirectoryWithQuota(hopINode.getName(), ps); } else { String iname = (hopINode.getName().length() == 0) ? INodeDirectory.ROOT_NAME : hopINode.getName(); inode = new INodeDirectory(iname, ps); } inode.setAccessTimeNoPersistance(hopINode.getAccessTime()); inode.setModificationTimeNoPersistance(hopINode.getModificationTime()); } else if (hopINode.getSymlink() != null) { inode = new INodeSymlink(hopINode.getSymlink(), hopINode.getModificationTime(), hopINode.getAccessTime(), ps); } else { if (hopINode.isUnderConstruction()) { DatanodeID dnID = (hopINode.getClientNode() == null || hopINode.getClientNode().isEmpty()) ? null : new DatanodeID(hopINode.getClientNode()); inode = new INodeFileUnderConstruction(ps, INodeFile.getBlockReplication(hopINode.getHeader()), INodeFile.getPreferredBlockSize(hopINode.getHeader()), hopINode.getModificationTime(), hopINode.getClientName(), hopINode.getClientMachine(), dnID); inode.setAccessTimeNoPersistance(hopINode.getAccessTime()); } else { inode = new INodeFile(ps, hopINode.getHeader(), hopINode.getModificationTime(), hopINode.getAccessTime()); } ((INodeFile) inode).setGenerationStampNoPersistence(hopINode.getGenerationStamp()); } inode.setIdNoPersistance(hopINode.getId()); inode.setLocalNameNoPersistance(hopINode.getName()); inode.setParentIdNoPersistance(hopINode.getParentId()); inode.setSubtreeLocked(hopINode.isSubtreeLocked()); inode.setSubtreeLockOwner(hopINode.getSubtreeLockOwner()); } return inode; }