public static String makeRelative(URI cache, Configuration conf)
    throws IOException {
    String host = cache.getHost();
    if (host == null) {
      host = cache.getScheme();
    }
    if (host == null) {
      URI defaultUri = FileSystem.get(conf).getUri();
      host = defaultUri.getHost();
      if (host == null) {
        host = defaultUri.getScheme();
      }
    }
    String path = host + cache.getPath();
    path = path.replace(":/","/");                // remove windows device colon
    return path;
  }
public static String makeRelative ( URI cache , Configuration conf ) throws IOException { String host = cache . getHost ( ) ; if ( host == null ) { host = cache . getScheme ( ) ; } if ( host == null ) { URI defaultUri = FileSystem . get ( conf ) . getUri ( ) ; host = defaultUri . getHost ( ) ; if ( host == null ) { host = defaultUri . getScheme ( ) ; } } String path = host + cache . getPath ( ) ; path = path . replace ( ":/" , "/" ) ; return path ; }
/*
Returns the relative path of the dir this cache will be localized in
relative path that this cache will be localized in. For
hdfs://hostname:port/absolute_path -- the relative path is
hostname/absolute path -- if it is just /absolute_path -- then the
relative path is hostname of DFS this mapred cluster is running
on/absolute_path