2 * Copyright (c) 2015, 2017 Cisco Systems, Inc. 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.lispflowmapping.shell;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.commands.Option;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
17 * This class implements the "mappingservice:mappings" Karaf shell command.
19 * @author Lorand Jakab
22 @Command(scope = "mappingservice", name = "mappings", description = "Print mapping database")
23 public class LispMappings extends OsgiCommandSupport {
24 @Option(name = "-d", aliases = "--debug", description = "Debug output", required = false, multiValued = false)
25 private boolean debug;
27 private IMappingServiceShell mappingServiceShell;
30 @SuppressWarnings("checkstyle:RegexpSinglelineJava")
31 protected Object doExecute() throws Exception {
32 if (mappingServiceShell != null) {
34 System.out.print(mappingServiceShell.printMappings());
36 System.out.print(mappingServiceShell.prettyPrintMappings());
42 public void setMappingServiceShell(IMappingServiceShell mappingServiceShell) {
43 this.mappingServiceShell = mappingServiceShell;