public InstrumentedWebHDFSFileSystem() { super(SCHEME, new WebHdfsFileSystem()); } }
/** Convert a token object to a Json string. */ public static String toJsonString(final Token<? extends TokenIdentifier> token ) throws IOException { return toJsonString(Token.class, toJsonMap(token)); }
public static String toJsonString(final DirectoryListing listing) throws IOException { if (listing == null) { return null; } return toJsonString(DirectoryListing.class, toJson(listing)); }
/** * returns a Json String. * * @return String * * @throws IOException */ public String toJson() throws IOException { return JsonUtil.toJsonString(this); }
/** Convert a DatanodeInfo[] to a Json array. */ private static Object[] toJsonArray(final DatanodeInfo[] array) { if (array == null) { return null; } else if (array.length == 0) { return EMPTY_OBJECT_ARRAY; } else { final Object[] a = new Object[array.length]; for(int i = 0; i < array.length; i++) { a[i] = toJsonMap(array[i]); } return a; } }
public DFSck(Configuration conf, PrintStream out) throws IOException { super(conf); this.ugi = UserGroupInformation.getCurrentUser(); this.out = out; this.connectionFactory = URLConnectionFactory .newDefaultURLConnectionFactory(conf); this.isSpnegoEnabled = UserGroupInformation.isSecurityEnabled(); }
@Override public String[] getParameterValues(String name) { return getParameterMap().get(name); }
@Override public ContainerRequest filter(final ContainerRequest request) { final MultivaluedMap<String, String> parameters = request.getQueryParameters(); if (containsUpperCase(parameters.keySet())) { //rebuild URI final URI lower = rebuildQuery(request.getRequestUri(), parameters); request.setUris(request.getBaseUri(), lower); } return request; } };
public static String toJsonString( SnapshottableDirectoryStatus[] snapshottableDirectoryList) { if (snapshottableDirectoryList == null) { return toJsonString("SnapshottableDirectoryList", null); } Object[] a = new Object[snapshottableDirectoryList.length]; for (int i = 0; i < snapshottableDirectoryList.length; i++) { a[i] = toJsonMap(snapshottableDirectoryList[i]); } return toJsonString("SnapshottableDirectoryList", a); }
/** * returns a serialized json string. * * @return String - json * @throws IOException */ public String toJson() throws IOException { return JsonUtil.toJsonString(this); }
private static Object[] toJsonArray(final List<XAttr> array, final XAttrCodec encoding) throws IOException { if (array == null) { return null; } else if (array.size() == 0) { return EMPTY_OBJECT_ARRAY; } else { final Object[] a = new Object[array.size()]; for(int i = 0; i < array.size(); i++) { a[i] = toJsonMap(array.get(i), encoding); } return a; } }
public static String toJsonString(BlockStoragePolicy storagePolicy) { return toJsonString(BlockStoragePolicy.class, toJsonMap(storagePolicy)); }
private static String toJsonString(final Class<?> clazz, final Object value) { return toJsonString(clazz.getSimpleName(), value); }
/** Convert a LocatedBlock[] to a Json array. */ private static Object[] toJsonArray(final List<LocatedBlock> array ) throws IOException { if (array == null) { return null; } else if (array.size() == 0) { return EMPTY_OBJECT_ARRAY; } else { final Object[] a = new Object[array.size()]; for(int i = 0; i < array.size(); i++) { a[i] = toJsonMap(array.get(i)); } return a; } }
public static String toJsonString(FsServerDefaults serverDefaults) { return toJsonString(FsServerDefaults.class, toJsonMap(serverDefaults)); }
/** * Return the JSON formatted ContentSummary of the specified path. * @param path a path specifies a file or directory * @return JSON formatted ContentSummary * @throws IOException if failed to serialize ContentSummary to JSON. */ String getContentSummary(String path) throws IOException { return "{\"ContentSummary\":\n" + JsonUtil.toJsonString(getContentSummaryMap(path)) + "\n}\n"; }
public static String toJsonString(SnapshotDiffReport diffReport) { return toJsonString(SnapshotDiffReport.class.getSimpleName(), toJsonMap(diffReport)); }
/** * Return the JSON formatted XAttrNames of the specified file. * * @param path * a path specifies a file * @return JSON formatted XAttrNames * @throws IOException * if failed to serialize fileStatus to JSON. */ String listXAttrs(String path) throws IOException { return JsonUtil.toJsonString(getXAttrList(path)); }
/** Convert a HdfsFileStatus object to a Json string. */ public static String toJsonString(final HdfsFileStatus status, boolean includeType) { if (status == null) { return null; } final Map<String, Object> m = toJsonMap(status); try { return includeType ? toJsonString(FileStatus.class, m) : MAPPER.writeValueAsString(m); } catch (IOException ignored) { } return null; }
/** * Return the JSON formatted FileStatus of the specified file. * @param path a path specifies a file * @return JSON formatted FileStatus * @throws IOException if failed to serialize fileStatus to JSON. */ String getFileStatus(String path) throws IOException { FsImageProto.INodeSection.INode inode = fromINodeId(lookup(path)); return "{\"FileStatus\":\n" + JsonUtil.toJsonString(getFileStatus(inode, false)) + "\n}\n"; }