diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java index 01b3e9a1e..a189384dd 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java @@ -322,6 +322,10 @@ public class NexusRepositorySearch //hit.setRepositoryId( artifactInfo.repository ); hit.setUrl( artifactInfo.repository + "/" + artifactInfo.fname ); hit.addVersion( artifactInfo.version ); + hit.setBundleExportPackage( artifactInfo.bundleExportPackage ); + hit.setBundleExportService( artifactInfo.bundleExportService ); + hit.setBundleSymbolicName( artifactInfo.bundleSymbolicName ); + hit.setBundleVersion( artifactInfo.bundleVersion ); } results.addHit( id, hit ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java index 253a43c94..8ffd79f95 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java @@ -48,6 +48,35 @@ public class SearchResultHit private List versions = new ArrayList(); + + /** + * contains osgi metadata Bundle-Version if available + * + * @since 1.4 + */ + private String bundleVersion; + + /** + * contains osgi metadata Bundle-SymbolicName if available + * + * @since 1.4 + */ + private String bundleSymbolicName; + + /** + * contains osgi metadata Export-Package if available + * + * @since 1.4 + */ + private String bundleExportPackage; + + /** + * contains osgi metadata Export-Service if available + * + * @since 1.4 + */ + private String bundleExportService; + public String getContext() { return context; @@ -128,6 +157,46 @@ public class SearchResultHit versions.add( version ); } + public String getBundleVersion() + { + return bundleVersion; + } + + public void setBundleVersion( String bundleVersion ) + { + this.bundleVersion = bundleVersion; + } + + public String getBundleSymbolicName() + { + return bundleSymbolicName; + } + + public void setBundleSymbolicName( String bundleSymbolicName ) + { + this.bundleSymbolicName = bundleSymbolicName; + } + + public String getBundleExportPackage() + { + return bundleExportPackage; + } + + public void setBundleExportPackage( String bundleExportPackage ) + { + this.bundleExportPackage = bundleExportPackage; + } + + public String getBundleExportService() + { + return bundleExportService; + } + + public void setBundleExportService( String bundleExportService ) + { + this.bundleExportService = bundleExportService; + } + @Override public String toString() { diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchOSGITest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchOSGITest.java index dfc530625..f38638249 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchOSGITest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchOSGITest.java @@ -19,7 +19,6 @@ package org.apache.archiva.indexer.search; * under the License. */ -import junit.framework.TestCase; import org.junit.Test; import java.io.File; @@ -48,7 +47,7 @@ public class NexusRepositorySearchOSGITest archivaConfigControl.replay(); - SearchFields searchFields = new SearchFields( ); + SearchFields searchFields = new SearchFields(); searchFields.setBundleSymbolicName( "org.apache.felix.bundlerepository" ); searchFields.setBundleVersion( "1.6.6" ); searchFields.setRepositories( selectedRepos ); @@ -65,6 +64,12 @@ public class NexusRepositorySearchOSGITest assertEquals( "org.apache.felix.bundlerepository", hit.getArtifactId() ); assertEquals( "1.6.6", hit.getVersions().get( 0 ) ); + assertEquals( "org.apache.felix.bundlerepository;uses:=\"org.osgi.framework\";version=\"2.0\"", + hit.getBundleExportPackage() ); + assertEquals( "org.apache.felix.bundlerepository.RepositoryAdmin,org.osgi.service.obr.RepositoryAdmin", + hit.getBundleExportService() ); + assertEquals( "org.apache.felix.bundlerepository", hit.getBundleSymbolicName() ); + assertEquals( "1.6.6", hit.getBundleVersion() ); } }