summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-08-15 21:28:13 +0000
committerOlivier Lamy <olamy@apache.org>2011-08-15 21:28:13 +0000
commit7a354f09edd42e88033f36cc75394e7e11549900 (patch)
tree37a04d6eb4788f44c36d797821602037bb6f5c48 /archiva-modules
parentc1abddcaf9427b95ad98f53b5da6bdb7492d0ca6 (diff)
downloadarchiva-7a354f09edd42e88033f36cc75394e7e11549900.tar.gz
archiva-7a354f09edd42e88033f36cc75394e7e11549900.zip
[MRM-1501] search on artifacts with OSGI Metadatas fields
modify SearchResultSearchResultHitSearchResultHit to return osgi metadata git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1158023 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java4
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java69
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchOSGITest.java9
3 files changed, 80 insertions, 2 deletions
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<String> versions = new ArrayList<String>();
+
+ /**
+ * 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() );
}
}