add search for osgi: Import-Package and Require-Bundle are now searchable

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1297102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-05 15:52:56 +00:00
parent 96cb1978d9
commit 3332083d45
6 changed files with 93 additions and 1 deletions

View File

@ -223,6 +223,20 @@ public class NexusRepositorySearch
Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
{
q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
new StringSearchExpression( searchFields.getBundleImportPackage() ) ),
Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) )
{
q.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE,
new StringSearchExpression( searchFields.getBundleRequireBundle() ) ),
Occur.MUST );
}
if ( StringUtils.isNotBlank( searchFields.getClassifier() ) )
{
q.add(

View File

@ -97,8 +97,17 @@ public class SearchFields
*/
private String bundleExportService;
/**
* contains osgi metadata Require-Bundle if available
*
* @since 1.4-M3
*/
private String bundleRequireBundle;
/**
* not return artifact with file extension pom
*
* @since 1.4-M2
*/
private boolean includePomArtifacts = false;
@ -262,6 +271,16 @@ public class SearchFields
this.includePomArtifacts = includePomArtifacts;
}
public String getBundleRequireBundle()
{
return bundleRequireBundle;
}
public void setBundleRequireBundle( String bundleRequireBundle )
{
this.bundleRequireBundle = bundleRequireBundle;
}
@Override
public String toString()
{
@ -279,6 +298,7 @@ public class SearchFields
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
sb.append( ", bundleName='" ).append( bundleName ).append( '\'' );
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
sb.append( ", includePomArtifacts=" ).append( includePomArtifacts );
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
sb.append( '}' );

View File

@ -28,7 +28,7 @@ public class SearchRequest
/**
* @since 1.4-M3
* to be able to search with a query on selected repositories
* to be able to search with a query on selected repositories
*/
private String queryTerms;
@ -91,10 +91,26 @@ public class SearchRequest
*/
private String bundleExportService;
/**
* contains osgi metadata Import-Package if available
*
* @since 1.4-M3
*/
private String bundleImportPackage;
/**
* contains osgi metadata Require-Bundle if available
*
* @since 1.4-M3
*/
private String bundleRequireBundle;
private String classifier;
/**
* not return artifact with file extension pom
*
* @since 1.4-M2
*/
private boolean includePomArtifacts = false;
@ -246,6 +262,26 @@ public class SearchRequest
this.queryTerms = queryTerms;
}
public String getBundleImportPackage()
{
return bundleImportPackage;
}
public void setBundleImportPackage( String bundleImportPackage )
{
this.bundleImportPackage = bundleImportPackage;
}
public String getBundleRequireBundle()
{
return bundleRequireBundle;
}
public void setBundleRequireBundle( String bundleRequireBundle )
{
this.bundleRequireBundle = bundleRequireBundle;
}
@Override
public String toString()
{
@ -262,6 +298,8 @@ public class SearchRequest
sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
sb.append( ", includePomArtifacts=" ).append( includePomArtifacts );
sb.append( '}' );

View File

@ -236,6 +236,8 @@ search.artifact.search.form.query.bundleSymbolicName=Symbolic Name
search.artifact.search.form.query.bundleVersion=Bundle Version
search.artifact.search.form.query.bundleExportPackage=Export Package
search.artifact.search.form.query.bundleExportService=Export Service
search.artifact.search.form.query.bundleImportPackage=Import Package
search.artifact.search.form.query.bundleRequireBundle=Require Bundle
#login
login.username.placehoder=Username

View File

@ -652,6 +652,10 @@ $(function() {
//private String bundleExportService;
this.bundleExportService=ko.observable();
this.bundleImportPackage=ko.observable();
this.bundleRequireBundle=ko.observable();
//private String classifier;
this.classifier=ko.observable();

View File

@ -302,6 +302,20 @@
data-bind="value: searchRequest().bundleExportService"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="groupId">${$.i18n.prop('search.artifact.search.form.query.bundleImportPackage')}</label>
<div class="controls">
<input type="text" class="input-medium search-query" id="bundleImportPackage" name="bundleImportPackage" size="50"
data-bind="value: searchRequest().bundleImportPackage"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="groupId">${$.i18n.prop('search.artifact.search.form.query.bundleRequireBundle')}</label>
<div class="controls">
<input type="text" class="input-medium search-query" id="bundleRequireBundle" name="bundleRequireBundle" size="50"
data-bind="value: searchRequest().bundleRequireBundle"/>
</div>
</div>
</fieldset>
<button type="submit" id="btn-osgi-search" class="btn btn-primary"
data-bind="click: advancedSearch">${$.i18n.prop('search.artifact.search.form.btn.search')}</button>