public static String uriToDatastorePath(URI uri){
  if (uri == null) {
    return null;
  }
  if (!SCHEME_DATASTORE.equals(uri.getScheme())) {
    throw new IllegalArgumentException("Expected datastore scheme, found" + uri);
  }
  String path=uri.getSchemeSpecificPart();
  path=stripLeadingSlashes(path);
  int i;
  i=path.indexOf('/');
  if (i <= 0) {
    throw new IllegalArgumentException("Path to datastore not found:" + uri);
  }
  String ds=path.substring(0,i);
  path=path.substring(i + 1);
  return String.format("[%s] %s",ds,path);
}

public static String uriToDatastorePath ( URI uri ) { if ( uri == null ) { return null ; } if ( ! SCHEME_DATASTORE . equals ( uri . getScheme ( ) ) ) { throw new IllegalArgumentException ( "Expected datastore scheme, found" + uri ) ; } String path = uri . getSchemeSpecificPart ( ) ; path = stripLeadingSlashes ( path ) ; int i ; i = path . indexOf ( '/' ) ; if ( i <= 0 ) { throw new IllegalArgumentException ( "Path to datastore not found:" + uri ) ; } String ds = path . substring ( 0 , i ) ; path = path . substring ( i + 1 ) ; return String . format ( "[%s] %s" , ds , path ) ; }
converts an uri in the format file : / / datastorename / path / to / file to a string like " [ datastorename ] / path / to / file " .
