List of usage examples for org.apache.hadoop.hdfs.web.resources XAttrNameParam XAttrNameParam
public XAttrNameParam(final String str)
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public void setXAttr(Path p, String name, byte[] value, EnumSet<XAttrSetFlag> flag) throws IOException { statistics.incrementWriteOps(1);//from ww w . ja va2 s.c o m final HttpOpParam.Op op = PutOpParam.Op.SETXATTR; if (value != null) { new FsPathRunner(op, p, new XAttrNameParam(name), new XAttrValueParam(XAttrCodec.encodeValue(value, XAttrCodec.HEX)), new XAttrSetFlagParam(flag)) .run(); } else { new FsPathRunner(op, p, new XAttrNameParam(name), new XAttrSetFlagParam(flag)).run(); } }
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public byte[] getXAttr(Path p, final String name) throws IOException { final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS; return new FsPathResponseRunner<byte[]>(op, p, new XAttrNameParam(name), new XAttrEncodingParam(XAttrCodec.HEX)) { @Override/*from www .ja va 2 s . co m*/ byte[] decodeResponse(Map<?, ?> json) throws IOException { return JsonUtil.getXAttr(json, name); } }.run(); }
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public Map<String, byte[]> getXAttrs(Path p, final List<String> names) throws IOException { Preconditions.checkArgument(names != null && !names.isEmpty(), "XAttr names cannot be null or empty."); Param<?, ?>[] parameters = new Param<?, ?>[names.size() + 1]; for (int i = 0; i < parameters.length - 1; i++) { parameters[i] = new XAttrNameParam(names.get(i)); }/* www .ja va 2 s . c o m*/ parameters[parameters.length - 1] = new XAttrEncodingParam(XAttrCodec.HEX); final HttpOpParam.Op op = GetOpParam.Op.GETXATTRS; return new FsPathResponseRunner<Map<String, byte[]>>(op, parameters, p) { @Override Map<String, byte[]> decodeResponse(Map<?, ?> json) throws IOException { return JsonUtil.toXAttrs(json); } }.run(); }
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
@Override public void removeXAttr(Path p, String name) throws IOException { statistics.incrementWriteOps(1);//www . j a v a 2s . c o m final HttpOpParam.Op op = PutOpParam.Op.REMOVEXATTR; new FsPathRunner(op, p, new XAttrNameParam(name)).run(); }