blob: 317e93f98c91e6f652f3926c7438b49e7a882d06 [file] [log] [blame]
Thomas Vachuska90b453f2015-01-30 18:57:14 -08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * 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
7 *
8 * 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.
15 */
16package org.onosproject.cli.app;
17
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.app.ApplicationAdminService;
21import org.onosproject.cli.AbstractShellCommand;
22import org.onosproject.core.ApplicationId;
23
24/**
25 * Deactivates an installed application.
26 */
27@Command(scope = "onos", name = "app-deactivate",
28 description = "Deactivates an installed application")
29public class ApplicationDeactivateCommand extends AbstractShellCommand {
30
31 @Argument(index = 0, name = "name", description = "Application name",
32 required = true, multiValued = false)
33 String name = null;
34
35 @Override
36 protected void execute() {
37 ApplicationAdminService service = get(ApplicationAdminService.class);
38 ApplicationId appId = service.getId(name);
39 if (appId != null) {
40 service.deactivate(appId);
41 } else {
42 print("No such application: %s", name);
43 }
44 }
45
46}