2 * Copyright (c) 2016, 2017 Inocybe Technologies. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.aaa.cli.dmstore;
11 import org.apache.karaf.shell.api.action.Command;
12 import org.apache.karaf.shell.api.action.Option;
13 import org.apache.karaf.shell.api.action.lifecycle.Service;
14 import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
15 import org.opendaylight.aaa.cli.utils.DataStoreUtils;
23 @Command(name = "remove-domain", scope = "aaa", description = "Remove domain.")
24 public class RemoveDomain extends AaaCliAbstractCommand {
25 @Option(name = "-name",
26 aliases = { "--domainName" },
27 description = "The domain name",
30 private String domainName;
33 public Object execute() throws Exception {
34 if (super.execute() == null) {
35 return LOGIN_FAILED_MESS;
37 final String domainId = DataStoreUtils.getDomainId(identityStore, domainName);
38 if (domainId == null) {
39 return "User does not exist";
41 if (identityStore.deleteDomain(domainId) == null) {
42 return "Failed to delete domain " + domainName;
44 return "Domain " + domainName + "has been deleted.";