docs: public synchronized Metadata getMetadata( String path )
          throws IOException, MetadataNotFoundException
      {
          Metadata metadata = new Metadata();
          boolean foundMetadata = false;
          path = StringUtils.stripEnd( StringUtils.stripStart( path, "/" ), "/" );
          String groupId = path.replace( '/', '.' );
          Set<String> pluginArtifactIds = getArtifactIds( groupId );
          if ( pluginArtifactIds != null )
          {
              List<Plugin> plugins = new ArrayList<Plugin>();
              for ( String artifactId : pluginArtifactIds )
              {
                  Set<String> pluginVersions = getVersions( groupId, artifactId );
                  if ( pluginVersions == null || pluginVersions.isEmpty() )
                  {
                      continue;
                  }
                  String[] versions = pluginVersions.toArray( new String[pluginVersions.size()] );
                  Arrays.sort( versions, new VersionComparator() );
                  MavenXpp3Reader reader = new MavenXpp3Reader();
                  for ( int j = versions.length - 1; j >= 0; j-- )
                  {
                      InputStream inputStream = null;
                      try
                      {
                          inputStream = get( new Artifact( groupId, artifactId, versions[j], "pom" ) );
                          Model model = reader.read( new XmlStreamReader( inputStream ) );
                          if ( model == null || !"maven-plugin".equals( model.getPackaging() ) )
                          {
                              continue;
                          }
                          Plugin plugin = new Plugin();
                          plugin.setArtifactId( artifactId );
                          plugin.setName( model.getName() );
                          // TODO proper goal-prefix determination
                          // ugh! this is incredibly hacky and does not handle some fool that sets the goal prefix in
                          // a parent pom... ok unlikely, but stupid is as stupid does
                          boolean havePrefix = false;
                          final Build build = model.getBuild();
                          if ( build != null && build.getPlugins() != null )
                          {
                              havePrefix = setPluginGoalPrefixFromConfiguration( plugin, build.getPlugins() );
                          }
                          if ( !havePrefix && build != null && build.getPluginManagement() != null
                              && build.getPluginManagement().getPlugins() != null )
                          {
                              havePrefix = setPluginGoalPrefixFromConfiguration( plugin,
                                                                                 build.getPluginManagement().getPlugins() );
                          }
                          if ( !havePrefix && artifactId.startsWith( "maven-" ) && artifactId.endsWith( "-plugin" ) )
                          {
                              plugin.setPrefix(
                                  StringUtils.removeStart( StringUtils.removeEnd( artifactId, "-plugin" ), "maven-" ) );
                              havePrefix = true;
                          }
                          if ( !havePrefix && artifactId.endsWith( "-maven-plugin" ) )
                          {
                              plugin.setPrefix( StringUtils.removeEnd( artifactId, "-maven-plugin" ) );
                              havePrefix = true;
                          }
                          if ( !havePrefix )
                          {
                              plugin.setPrefix( artifactId );
                          }
                          plugins.add( plugin );
                          foundMetadata = true;
                          break;
                      }
                      catch ( ArtifactNotFoundException e )
                      {
                          // ignore
                      }
                      catch ( XmlPullParserException e )
                      {
                          // ignore
                      }
                      finally
                      {
                          IOUtils.closeQuietly( inputStream );
                      }
                  }
              }
              if ( !plugins.isEmpty() )
              {
                  metadata.setPlugins( plugins );
              }
          }
          int index = path.lastIndexOf( '/' );
          groupId = ( index == -1 ? groupId : groupId.substring( 0, index ) ).replace( '/', '.' );
          String artifactId = ( index == -1 ? null : path.substring( index + 1 ) );
          if ( artifactId != null )
          {
              Set<String> artifactVersions = getVersions( groupId, artifactId );
              if ( artifactVersions != null && !artifactVersions.isEmpty() )
              {
                  metadata.setGroupId( groupId );
                  metadata.setArtifactId( artifactId );
                  Versioning versioning = new Versioning();
                  List<String> versions = new ArrayList<String>( artifactVersions );
                  Collections.sort( versions, new VersionComparator() ); // sort the Maven way
                  long lastUpdated = 0;
                  for ( String version : versions )
                  {
                      try
                      {
                          long lastModified = getLastModified( new Artifact( groupId, artifactId, version, "pom" ) );
                          versioning.addVersion( version );
                          if ( lastModified >= lastUpdated )
                          {
                              lastUpdated = lastModified;
                              versioning.setLastUpdatedTimestamp( new Date( lastModified ) );
                              versioning.setLatest( version );
                              if ( !version.endsWith( "-SNAPSHOT" ) )
                              {
                                  versioning.setRelease( version );
                              }
                          }
                      }
                      catch ( ArtifactNotFoundException e )
                      {
                          // ignore
                      }
                  }
                  metadata.setVersioning( versioning );
                  foundMetadata = true;
              }
          }
  
          int index2 = index == -1 ? -1 : path.lastIndexOf( '/', index - 1 );
          groupId = index2 == -1 ? groupId : groupId.substring( 0, index2 ).replace( '/', '.' );
          artifactId = index2 == -1 ? artifactId : path.substring( index2 + 1, index );
          String version = index2 == -1 ? null : path.substring( index + 1 );
          if ( version != null && version.endsWith( "-SNAPSHOT" ) )
          {
              Map<String, Map<String, Map<Artifact, Content>>> artifactMap = contents.get( groupId );
              Map<String, Map<Artifact, Content>> versionMap = ( artifactMap == null ? null : artifactMap.get( artifactId ) );
              Map<Artifact, Content> filesMap = ( versionMap == null ? null : versionMap.get( version ) );
              if ( filesMap != null )
              {
                  List<SnapshotVersion> snapshotVersions = new ArrayList<SnapshotVersion>();
                  int maxBuildNumber = 0;
                  long lastUpdated = 0;
                  String timestamp = null;
                  boolean found = false;
                  for ( final Map.Entry<Artifact, Content> entry : filesMap.entrySet() )
                  {
                      final Artifact artifact = entry.getKey();
                      final Content content = entry.getValue();
                      SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss" );
                      fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
                      String lastUpdatedTime = fmt.format( new Date( content.getLastModified() ) );
                      try
                      {
                          Maven3.addSnapshotVersion( snapshotVersions, artifact, lastUpdatedTime );
                      }
                      catch ( LinkageError e )
                      {
                          // Maven 2
                      }
                      if ( "pom".equals( artifact.getType() ) )
                      {
                          if ( artifact.getBuildNumber() != null
                              && maxBuildNumber < artifact.getBuildNumber().intValue() )
                          {
                              maxBuildNumber = artifact.getBuildNumber().intValue();
                              timestamp = artifact.getTimestampString();
                          }
                          else
                          {
                              maxBuildNumber = Math.max( 1, maxBuildNumber );
                          }
                          lastUpdated = Math.max( lastUpdated, content.getLastModified() );
                          found = true;
                      }
                  }
  
                  if ( !snapshotVersions.isEmpty() || found )
                  {
                      Versioning versioning = metadata.getVersioning();
                      if ( versioning == null )
                      {
                          versioning = new Versioning();
                      }
                      metadata.setGroupId( groupId );
                      metadata.setArtifactId( artifactId );
                      metadata.setVersion( version );
                      try
                      {
                          Maven3.addSnapshotVersions( versioning, snapshotVersions );
                      }
                      catch ( LinkageError e )
                      {
                          // Maven 2
                      }
                      if ( maxBuildNumber > 0 )
                      {
                          Snapshot snapshot = new Snapshot();
                          snapshot.setBuildNumber( maxBuildNumber );
                          snapshot.setTimestamp( timestamp );
                          versioning.setSnapshot( snapshot );
                      }
                      versioning.setLastUpdatedTimestamp( new Date( lastUpdated ) );
                      metadata.setVersioning( versioning );
                      foundMetadata = true;
                  }
              }
  
          }
          if ( !foundMetadata )
          {
              throw new MetadataNotFoundException( path );
          }
          return metadata;
      }