</includes>
</fileSet>
+ <!-- cli -->
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>cli</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>cli/src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>cli/src/main/resources/org/opendaylight/blueprint</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+
<!-- it -->
<fileSet filtered="true" encoding="UTF-8">
<directory>it</directory>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-cli</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <!-- Project Dependencies -->
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-api</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+
+ <!-- Apache Karaf console dependency -->
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.table</artifactId>
+ <version>${karaf.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package ${package}.cli.api;
+
+public interface ${classPrefix}CliCommands {
+
+ /**
+ * Define the Karaf command method signatures and the Javadoc for each.
+ * Below method is just an example
+ */
+ Object testCommand(Object testArgument);
+}
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package ${package}.cli.commands;
+
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.console.AbstractAction;
+import ${package}.cli.api.${classPrefix}CliCommands;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is an example class. The class name can be renamed to match the command implementation that it will invoke.
+ * Specify command details by updating the fields in the Command annotation below.
+ */
+@Command(name = "test-command", scope = "add the scope of the command, usually project name", description = "add a description for the command")
+public class ${classPrefix}CliTestCommand extends AbstractAction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}CliTestCommand.class);
+ protected final ${classPrefix}CliCommands service;
+
+ public ${classPrefix}CliTestCommand(final ${classPrefix}CliCommands service) {
+ this.service = service;
+ }
+
+ /**
+ * Add the arguments required by the command.
+ * Any number of arguments can be added using the Option annotation
+ * The below argument is just an example and should be changed as per your requirements
+ */
+ @Option(name = "-tA",
+ aliases = { "--testArgument" },
+ description = "test command argument",
+ required = true,
+ multiValued = false)
+ private Object testArgument;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ /**
+ * Invoke commannd implementation here using the service instance.
+ * Implement how you want the output of the command to be displayed.
+ * Below is just an example.
+ */
+ final String testMessage = (String) service.testCommand(testArgument);
+ return testMessage;
+ }
+}
\ No newline at end of file
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package ${package}.cli.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import ${package}.cli.api.${classPrefix}CliCommands;
+
+public class ${classPrefix}CliCommandsImpl implements ${classPrefix}CliCommands {
+
+ private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}CliCommandsImpl.class);
+ private final DataBroker dataBroker;
+
+ public ${classPrefix}CliCommandsImpl(final DataBroker db) {
+ this.dataBroker = db;
+ LOG.info("${classPrefix}CliCommandImpl initialized");
+ }
+
+ @Override
+ public Object testCommand(Object testArgument) {
+ return "This is a test implementation of test-command";
+ }
+}
\ No newline at end of file
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © ${copyrightYear} ${copyright} and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <bean id="cliCommandsImpl" class="${package}.cli.impl.${classPrefix}CliCommandsImpl">
+ <argument ref="dataBroker" />
+ </bean>
+ <service ref="cliCommandsImpl" odl:type="default"
+ interface="${package}.cli.api.${classPrefix}CliCommands" />
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
+ <command name="test-command">
+ <action class="${package}.cli.commands.${classPrefix}CliTestCommand">
+ <argument ref="cliCommandsImpl"/>
+ </action>
+ </command>
+ </command-bundle>
+</blueprint>
<artifactId>${artifactId}-api</artifactId>
<version>${symbol_dollar}{project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-cli</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
</dependencies>
</project>
<feature version="${symbol_dollar}{mdsal.version}">odl-mdsal-xsql</feature>
<feature version="${symbol_dollar}{dlux.version}">odl-dlux-yangui</feature>
</feature>
+ <feature name='odl-${artifactId}-cli' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: CLI'>
+ <feature version="${symbol_dollar}{project.version}">odl-${artifactId}</feature>
+ <bundle>mvn:${groupId}/${artifactId}-cli/{{VERSION}}</bundle>
+ </feature>
</features>
<module>karaf</module>
<module>features</module>
<module>artifacts</module>
+ <module>cli</module>
<module>it</module>
</modules>