blob: 28be1494826c294e371eef2df621b2a44a22f90c [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
pankajf49b45e2014-10-07 14:24:22 -070016package org.onlab.onos.foo;
17
18import static org.onlab.onos.foo.SimpleNettyServer.startStandalone;
19
20import org.apache.karaf.shell.commands.Argument;
21import org.apache.karaf.shell.commands.Command;
22import org.onlab.onos.cli.AbstractShellCommand;
23
24/**
25 * Starts the Simple Netty server.
26 */
pankajea0acef2014-10-07 15:01:47 -070027@Command(scope = "onos", name = "simple-netty-server",
pankaj5364ca92014-10-09 14:11:58 -070028 description = "Starts simple Netty server")
pankajf49b45e2014-10-07 14:24:22 -070029public class SimpleNettyServerCommand extends AbstractShellCommand {
30
pankajea0acef2014-10-07 15:01:47 -070031 //FIXME: Replace these with parameters for
pankaj5364ca92014-10-09 14:11:58 -070032 @Argument(index = 0, name = "port", description = "listen port",
pankajf49b45e2014-10-07 14:24:22 -070033 required = false, multiValued = false)
pankaj9d7e4be2014-10-09 14:10:03 -070034 String port = "8081";
pankajf49b45e2014-10-07 14:24:22 -070035
pankajf49b45e2014-10-07 14:24:22 -070036 @Override
37 protected void execute() {
38 try {
pankaj9d7e4be2014-10-09 14:10:03 -070039 startStandalone(new String[]{port});
pankajf49b45e2014-10-07 14:24:22 -070040 } catch (Exception e) {
41 error("Unable to start server %s", e);
42 }
43 }
44
45}