blob: cef3e868c90d36a540125a61ff1ef1478ec5537c [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
pankajf49b45e2014-10-07 14:24:22 -070019package org.onlab.onos.foo;
20
21import static org.onlab.onos.foo.SimpleNettyServer.startStandalone;
22
23import org.apache.karaf.shell.commands.Argument;
24import org.apache.karaf.shell.commands.Command;
25import org.onlab.onos.cli.AbstractShellCommand;
26
27/**
28 * Starts the Simple Netty server.
29 */
pankajea0acef2014-10-07 15:01:47 -070030@Command(scope = "onos", name = "simple-netty-server",
pankaj5364ca92014-10-09 14:11:58 -070031 description = "Starts simple Netty server")
pankajf49b45e2014-10-07 14:24:22 -070032public class SimpleNettyServerCommand extends AbstractShellCommand {
33
pankajea0acef2014-10-07 15:01:47 -070034 //FIXME: Replace these with parameters for
pankaj5364ca92014-10-09 14:11:58 -070035 @Argument(index = 0, name = "port", description = "listen port",
pankajf49b45e2014-10-07 14:24:22 -070036 required = false, multiValued = false)
pankaj9d7e4be2014-10-09 14:10:03 -070037 String port = "8081";
pankajf49b45e2014-10-07 14:24:22 -070038
pankajf49b45e2014-10-07 14:24:22 -070039 @Override
40 protected void execute() {
41 try {
pankaj9d7e4be2014-10-09 14:10:03 -070042 startStandalone(new String[]{port});
pankajf49b45e2014-10-07 14:24:22 -070043 } catch (Exception e) {
44 error("Unable to start server %s", e);
45 }
46 }
47
48}