]> source.dussan.org Git - archiva.git/commitdiff
add search for osgi: Import-Package and Require-Bundle are now searchable
authorOlivier Lamy <olamy@apache.org>
Mon, 5 Mar 2012 15:52:56 +0000 (15:52 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 5 Mar 2012 15:52:56 +0000 (15:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1297102 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NexusRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchFields.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/SearchRequest.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html

index 58cfea4cf3856c1374454dcdde90249c52582715..3d84602aeeab4b4c7590641560b12c31db76a9fa 100644 (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(
index d7d00093b70e6862818b4bc65e179a306d5bcb3e..cd34f701eeacbd9d604a079da75077334345e359 100644 (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( '}' );
index 6d82b5b44ee4caef21d4de1b4a3707908f6b91b0..b391650e227d89211b90682eb01a3c0ea92732f9 100644 (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( '}' );
index 9d53f29d7bd94452174b70734aa8c27d27d7c50f..19dc750d405161d1ee4e25ee970a69089d87b78d 100644 (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
index 19b07c23f23dd40edff30ef474f0b62fbab6a23d..9f372f277f11585d0ae69101d988e317a7425e6a 100644 (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();
 
index 04941d1d74c5eac7a47b5b6bc03b5edbce3aebcd..4405a214dd4d06a55fbb1b38fc9c91b0dd4d5169 100644 (file)
                                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>