9f0266c19db76b2cc7ea829742eb81b4a605dabf
[controller.git] / opendaylight / md-sal / sal-karaf-xsql / src / main / java / org / opendaylight / controller / xsql / xsql.java
1 package org.opendaylight.controller.xsql;
2
3 import org.apache.karaf.shell.commands.Argument;
4 import org.apache.karaf.shell.commands.Command;
5 import org.apache.karaf.shell.commands.Option;
6 import org.apache.karaf.shell.console.OsgiCommandSupport;
7 import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
8
9 @Command(scope = "odl", name = "xsql", description = "XSQL Karaf Command")
10 public class xsql extends OsgiCommandSupport {
11
12     @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false)
13     private String option;
14
15     @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false)
16     private String argument;
17
18     protected Object doExecute() throws Exception {
19         if(argument==null){
20             System.out.println("Nothing to do..., please specify a command.");
21             return null;
22         }
23         XSQLAdapter.getInstance().processCommand(new StringBuffer(argument),
24                 System.out);
25         return null;
26     }
27 }