예제 #1
0
 /**
  * HDFS Path에서 IP주소를 추출한다.
  *
  * @param path HDFS Path
  * @return IP Address
  */
 public static String getIpAddressFromPath(String path) {
   if (!path.startsWith(HDFS_URL_PREFIX)) {
     throw new FileSystemException(ExceptionUtils.getMessage("Invalid path '{}'", path));
   }
   String[] split = org.springframework.util.StringUtils.delete(path, HDFS_URL_PREFIX).split(":");
   return split[0];
 }
예제 #2
0
 /**
  * HDFS Path에서 Port를 추출한다.
  *
  * @param path HDFS Path
  * @return Port
  */
 public static String getPortFromPath(String path) {
   if (!path.startsWith(HDFS_URL_PREFIX)) {
     throw new FileSystemException(ExceptionUtils.getMessage("Invalid path '{}'", path));
   }
   String[] split = org.springframework.util.StringUtils.delete(path, HDFS_URL_PREFIX).split(":");
   if (split.length != 2) {
     throw new FileSystemException(
         "Invalid path pattern. Path pattern must be \"hdfs://IP:PORT\".");
   }
   return split[1];
 }