mirror of https://github.com/apache/archiva.git
[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
This commit is contained in:
parent
c1abddcaf9
commit
7a354f09ed
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
@ -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() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue