Keystore Plaintext Storage API and Local File implementation
[netconf.git] / keystore / plaintext-cli / src / main / java / org / opendaylight / netconf / keystore / plaintext / cli / Get.java
1 /*
2  * Copyright (c) 2024 PANTHEON.tech s.r.o. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.keystore.plaintext.cli;
9
10 import org.apache.karaf.shell.api.action.Argument;
11 import org.apache.karaf.shell.api.action.Command;
12 import org.apache.karaf.shell.api.action.lifecycle.Service;
13
14 @Service
15 @Command(scope = AbstractCommand.SCOPE, name = "get", description = "Gets property value by name")
16 public class Get extends AbstractCommand {
17
18     @Argument(name = "name", required = true)
19     String key;
20
21     @Override
22     @SuppressWarnings("RegexpSinglelineJava")
23     void executeCommand() {
24         final var result = storage.lookup(toBytes(key));
25         System.out.println(result == null ? notFound(key) : toString(result));
26     }
27 }