You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2011/12/15 17:20:07 UTC
svn commit: r1214838 - in /karaf/trunk/archetypes/command: pom.xml
src/main/resources/archetype-resources/pom.xml
src/main/resources/archetype-resources/src/main/java/__command__.java
Author: jbonofre
Date: Thu Dec 15 16:20:07 2011
New Revision: 1214838
URL: http://svn.apache.org/viewvc?rev=1214838&view=rev
Log:
[KARAF-1109] Fix and cleanup the karaf-command-archetype
Modified:
karaf/trunk/archetypes/command/pom.xml
karaf/trunk/archetypes/command/src/main/resources/archetype-resources/pom.xml
karaf/trunk/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java
Modified: karaf/trunk/archetypes/command/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/archetypes/command/pom.xml?rev=1214838&r1=1214837&r2=1214838&view=diff
==============================================================================
--- karaf/trunk/archetypes/command/pom.xml (original)
+++ karaf/trunk/archetypes/command/pom.xml Thu Dec 15 16:20:07 2011
@@ -29,7 +29,7 @@
</parent>
<groupId>org.apache.karaf.archetypes</groupId>
- <artifactId>archetypes-command</artifactId>
+ <artifactId>karaf-command-archetype</artifactId>
<name>Apache Karaf :: Archetypes :: Command Archetype</name>
<build>
Modified: karaf/trunk/archetypes/command/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/archetypes/command/src/main/resources/archetype-resources/pom.xml?rev=1214838&r1=1214837&r2=1214838&view=diff
==============================================================================
--- karaf/trunk/archetypes/command/src/main/resources/archetype-resources/pom.xml (original)
+++ karaf/trunk/archetypes/command/src/main/resources/archetype-resources/pom.xml Thu Dec 15 16:20:07 2011
@@ -21,13 +21,14 @@
<artifactId>${artifactId}</artifactId>
<packaging>bundle</packaging>
<version>${version}</version>
- <name>Apache Karaf :: Shell ${scope} Commands</name>
+ <name>Apache Karaf :: Shell ${scope}/${command} Commands</name>
<description>Provides the OSGi ${scope} commands</description>
<properties>
- <junit.version>^junit.bundle.version^</junit.version>
+ <junit.bundle.version>^junit.bundle.version^</junit.bundle.version>
<osgi.version>^osgi.version^</osgi.version>
+ <osgi.compendium.version>^osgi.compendium.version^</osgi.compendium.version>
<karaf.version>^project.version^</karaf.version>
<maven-bundle-plugin.version>^felix.plugin.version^</maven-bundle-plugin.version>
</properties>
@@ -49,14 +50,14 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
- <version>${osgi.version}</version>
+ <version>${osgi.compendium.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.junit</artifactId>
- <version>${junit.version}</version>
+ <version>${junit.bundle.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -66,6 +67,7 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
+ <version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
@@ -80,7 +82,8 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>${package}*;version=${project.version}</Export-Package>
- <Import-Package>!${project.artifactId}*,
+ <Import-Package>
+ !${package}*,
org.apache.aries.blueprint,
org.osgi.service.blueprint.container,
org.osgi.service.blueprint.reflect,
@@ -95,4 +98,5 @@
</plugin>
</plugins>
</build>
+
</project>
Modified: karaf/trunk/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java
URL: http://svn.apache.org/viewvc/karaf/trunk/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java?rev=1214838&r1=1214837&r2=1214838&view=diff
==============================================================================
--- karaf/trunk/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java (original)
+++ karaf/trunk/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java Thu Dec 15 16:20:07 2011
@@ -21,18 +21,24 @@
package ${package};
-import org.apache.felix.gogo.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.commands.Argument;
-
-/**
- * Displays the last log entries
- */
@Command(scope = "${scope}", name = "${cmd}", description = "${description}")
public class ${command} extends OsgiCommandSupport {
+ @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
+ private String option;
+
+ @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
+ private String argument;
+
protected Object doExecute() throws Exception {
System.out.println("Executing command ${cmd}");
+ System.out.println("Option: " + option);
+ System.out.println("Argument: " + argument);
return null;
}
}