code: public static String escapeInstancePath( String instancePath ) {
  
  		String result;
  		if( Utils.isEmptyOrWhitespaces( instancePath ))
  			result = "";
  		else
  			result = instancePath.replaceFirst( "^/*", "" ).replaceFirst( "/*$", "" ).replaceAll( "/+", "." );
  
  		return result;
  	}
docs: Removes unnecessary slashes and transforms the others into dots.
  @param instancePath an instance path
  @return a non-null string