public void processArchivaArtifact( ArchivaArtifact artifact )
throws ConsumerException
{
try
{
ManagedRepositoryContent repoContent =
repoFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() );
File file = new File( repoContent.getRepoRoot(), repoContent.toPath( artifact ) );
if( file.getAbsolutePath().endsWith( ".jar" ) || file.getAbsolutePath().endsWith( ".war" ) ||
file.getAbsolutePath().endsWith( ".ear" ) || file.getAbsolutePath().endsWith( ".zip" ) ||
file.getAbsolutePath().endsWith( ".tar.gz" ) || file.getAbsolutePath().endsWith( ".tar.bz2" ) ||
file.getAbsolutePath().endsWith( ".car" ) || file.getAbsolutePath().endsWith( ".sar" ) ||
file.getAbsolutePath().endsWith( ".mar" ) || file.getAbsolutePath().endsWith( ".rar" ) )
{
if( file.exists() )
{
List<String> files = readFilesInArchive( file );
Map<String, List<String>> mapOfClassesAndMethods =
getPublicClassesAndMethodsFromFiles( file.getAbsolutePath(), files );
// NOTE: what about public variables? should these be indexed too?
RepositoryContentIndex bytecodeIndex = repoIndexFactory.createBytecodeIndex( repoContent.getRepository() );
artifact.getModel().setRepositoryId( repoContent.getId() );
BytecodeRecord bytecodeRecord = new BytecodeRecord();
bytecodeRecord.setFilename( file.getName() );
bytecodeRecord.setClasses( mapOfClassesAndMethods.get( CLASSES ) );
bytecodeRecord.setFiles( files );
bytecodeRecord.setMethods( mapOfClassesAndMethods.get( METHODS ) );
bytecodeRecord.setArtifact( artifact );
bytecodeRecord.setRepositoryId( repoContent.getId() );
bytecodeIndex.modifyRecord( bytecodeRecord );
}
}
}
catch ( RepositoryException e )