karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [07/15] git commit: [KARAF-2756] Use @Completer for kar commands
Date Fri, 14 Feb 2014 12:44:17 GMT
[KARAF-2756] Use @Completer for kar commands


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/edfae484
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/edfae484
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/edfae484

Branch: refs/heads/master
Commit: edfae484f05dafa4d76d0731a14daebed7b68282
Parents: 2a12fbb
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Wed Feb 12 23:00:54 2014 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Fri Feb 14 13:43:57 2014 +0100

----------------------------------------------------------------------
 .../OSGI-INF/blueprint/features-command.xml     |  6 +-----
 kar/command/pom.xml                             |  4 ++++
 .../karaf/kar/command/CreateKarCommand.java     |  3 +++
 .../karaf/kar/command/UninstallKarCommand.java  |  3 +++
 .../OSGI-INF/blueprint/kar-command.xml          | 21 +++++++-------------
 5 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/edfae484/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
----------------------------------------------------------------------
diff --git a/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml b/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
index 9b4afb3..b7789e5 100644
--- a/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
+++ b/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
@@ -98,10 +98,6 @@
     <bean id="installedRepoNameCompleter" class="org.apache.karaf.features.command.completers.InstalledRepoNameCompleter">
         <property name="featuresService" ref="featuresService"/>
     </bean>
-    <service ref="installedRepoNameCompleter" auto-export="all-classes">
-        <service-properties>
-            <entry key="name" value="installedRepoNameCompleter"/>
-        </service-properties>
-    </service>
+    <service ref="installedRepoNameCompleter" auto-export="all-classes"/>
 
 </blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/edfae484/kar/command/pom.xml
----------------------------------------------------------------------
diff --git a/kar/command/pom.xml b/kar/command/pom.xml
index d6762ef..c4cdab5 100644
--- a/kar/command/pom.xml
+++ b/kar/command/pom.xml
@@ -57,6 +57,10 @@
             <artifactId>org.apache.karaf.shell.table</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf.features</groupId>
+            <artifactId>org.apache.karaf.features.command</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/karaf/blob/edfae484/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
b/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
index 58562f4..96c99c7 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
@@ -18,13 +18,16 @@ package org.apache.karaf.kar.command;
 
 import java.util.List;
 
+import org.apache.karaf.features.command.completers.InstalledRepoNameCompleter;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Completer;
 
 @Command(scope = "kar", name = "create", description = "Create a kar file for a list of feature
repos")
 public class CreateKarCommand extends KarCommandSupport {
     
     @Argument(index = 0, name = "repoName", description = "Repository name. The kar will
contain all features of the named repository by default", required = true, multiValued = false)
+    @Completer(InstalledRepoNameCompleter.class)
     private String repoName;
     
     @Argument(index = 1, name = "features", description = "Names of the features to include.
If set then only these features will be added", required = false, multiValued = true)

http://git-wip-us.apache.org/repos/asf/karaf/blob/edfae484/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
b/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
index e3f4dca..a02efb5 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
@@ -16,13 +16,16 @@
  */
 package org.apache.karaf.kar.command;
 
+import org.apache.karaf.kar.command.completers.KarCompleter;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Completer;
 
 @Command(scope = "kar", name = "uninstall", description = "Uninstall a KAR file.")
 public class UninstallKarCommand extends KarCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the KAR file to uninstall.",
required = true, multiValued = false)
+    @Completer(KarCompleter.class)
     private String name;
 
     public Object doExecute() throws Exception {

http://git-wip-us.apache.org/repos/asf/karaf/blob/edfae484/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
----------------------------------------------------------------------
diff --git a/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml b/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
index 2997601..17acba1 100644
--- a/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
+++ b/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
@@ -17,14 +17,6 @@
     -->
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
 
-    <reference id="karService" interface="org.apache.karaf.kar.KarService"/>
-    
-    <bean id="karCompleter" class="org.apache.karaf.kar.command.completers.KarCompleter">
-        <property name="karService" ref="karService"/>
-    </bean>
-
-    <reference id="installedRepoNameCompleter" interface="org.apache.karaf.shell.console.Completer"
filter="(name=installedRepoNameCompleter)"/>
-
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
         <command>
             <action class="org.apache.karaf.kar.command.ListKarCommand">
@@ -40,18 +32,19 @@
             <action class="org.apache.karaf.kar.command.UninstallKarCommand">
                 <property name="karService" ref="karService"/>
             </action>
-            <completers>
-                <ref component-id="karCompleter"/>
-            </completers>
         </command>
         <command>
             <action class="org.apache.karaf.kar.command.CreateKarCommand">
                 <property name="karService" ref="karService"/>
             </action>
-            <completers>
-                <ref component-id="installedRepoNameCompleter"/>
-            </completers>
         </command>
     </command-bundle>
 
+    <reference id="karService" interface="org.apache.karaf.kar.KarService"/>
+
+    <bean id="karCompleter" class="org.apache.karaf.kar.command.completers.KarCompleter">
+        <property name="karService" ref="karService"/>
+    </bean>
+    <service ref="karCompleter" auto-export="all-classes"/>
+
 </blueprint>
\ No newline at end of file


Mime
View raw message