}
public String browseGroup()
throws RepositoryIndexException, IOException, RepositoryIndexSearchException
{
RepositoryArtifactIndex index = getIndex();
if ( !index.exists() )
{
addActionError( "The repository is not yet indexed. Please wait, and then try again." );
return ERROR;
}
GroupTreeNode rootNode = buildGroupTree( index );
if ( StringUtils.isEmpty( groupId ) )
{
// TODO: i18n
addActionError( "You must specify a group ID to browse" );
return ERROR;
}
StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
while ( tok.hasMoreTokens() )
{
String part = tok.nextToken();
if ( !rootNode.getChildren().containsKey( part ) )
{
// TODO: i18n
getLogger().debug(
"Can't find part: " + part + " for groupId " + groupId + " in children " + rootNode.getChildren() );
addActionError( "The group specified was not found" );
return ERROR;
}
else
{
rootNode = (GroupTreeNode) rootNode.getChildren().get( part );
}
}
this.groups = collateGroups( rootNode );
this.artifactIds = index.getArtifactIds( groupId );
Collections.sort( this.artifactIds );
return SUCCESS;
}