/** @return the absolute path. */ public final String getAbsolutePath() { final String path = getValue(); //The first / has been stripped out. return path == null? null: "/" + path; } }
/** Validate all required params. */ @SuppressWarnings("rawtypes") protected void validateOpParams(HttpOpParam<?> op, Param... params) { for (Param param : params) { if (param.getValue() == null || param.getValueString() == null || param .getValueString().isEmpty()) { throw new IllegalArgumentException("Required param " + param.getName() + " for op: " + op.getValueString() + " is null or empty"); } } }
public WebHdfsHandler(Configuration conf, Configuration confForCreate) throws IOException { this.conf = conf; this.confForCreate = confForCreate; /** set user pattern based on configuration file */ UserParam.setUserPattern( conf.get(HdfsClientConfigKeys.DFS_WEBHDFS_USER_PATTERN_KEY, HdfsClientConfigKeys.DFS_WEBHDFS_USER_PATTERN_DEFAULT)); AclPermissionParam.setAclPermissionPattern( conf.get(HdfsClientConfigKeys.DFS_WEBHDFS_ACL_PERMISSION_PATTERN_KEY, HdfsClientConfigKeys.DFS_WEBHDFS_ACL_PERMISSION_PATTERN_DEFAULT)); }
int bufferSize() { return new BufferSizeParam(param(BufferSizeParam.NAME)).getValue(conf); }
long blockSize() { return new BlockSizeParam(param(BlockSizeParam.NAME)).getValue(conf); }
short replication() { return new ReplicationParam(param(ReplicationParam.NAME)).getValue(conf); }
long offset() { return new OffsetParam(param(OffsetParam.NAME)).getOffset(); }
boolean overwrite() { return new OverwriteParam(param(OverwriteParam.NAME)).getValue(); }
long length() { return new LengthParam(param(LengthParam.NAME)).getLength(); }
public boolean createParent() { return new CreateParentParam(param(CreateParentParam.NAME)).getValue(); }
FsPermission permission() { return new PermissionParam(param(PermissionParam.NAME)). getFileFsPermission(); }
String namenodeId() { return new NamenodeAddressParam(param(NamenodeAddressParam.NAME)) .getValue(); }
@Override public Response run() throws IOException, URISyntaxException { return put(ugi, delegation, username, doAsUser, path.getAbsolutePath(), op, destination, owner, group, permission, unmaskedPermission, overwrite, bufferSize, replication, blockSize, modificationTime, accessTime, renameOptions, createParent, delegationTokenArgument, aclPermission, xattrName, xattrValue, xattrSetFlag, snapshotName, oldSnapshotName, excludeDatanodes, createFlagParam, noredirect, policyName); } });
/** * Constructor. * @param str a string representation of the parameter value. */ public NamenodeAddressParam(final String str) { super(DOMAIN, str == null || str.equals(DEFAULT)? null: DOMAIN.parse(str)); }
FsPermission unmaskedPermission() { String value = param(UnmaskedPermissionParam.NAME); return value == null ? null : new UnmaskedPermissionParam(value).getFileFsPermission(); }
boolean noredirect() { return new NoRedirectParam(param(NoRedirectParam.NAME)).getValue(); }
@Override public Response run() throws IOException, URISyntaxException { return post(ugi, delegation, username, doAsUser, path.getAbsolutePath(), op, concatSrcs, bufferSize, excludeDatanodes, newLength, noredirect); } });
@Override public Response run() throws IOException { return delete(ugi, delegation, username, doAsUser, path.getAbsolutePath(), op, recursive, snapshotName); } });