2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.aai.util;
23 import org.onap.aai.exceptions.AAIException;
26 * The script deobfuscatePW.sh needs to retrieve pws from the AAIConfig file.
27 * As AAIConfig has no main to be callable on the command line, this class helps
28 * by providing one for accessing AAIConfig that way.
29 * (AAIConfig deobfuscates pws itself, so we just need to call its .get() on the desired pw.)
31 * This could be used to get any property from AAIConfig via the command line,
32 * not just the pws, even though it was made for pw-related needs.
34 public class AAIConfigCommandLinePropGetter {
39 * @param args the arguments
43 * AAIConfigCommandLinePropGetter propertyname
45 public static void main(String[] args) {
46 if (args.length != 1) {
47 // System.out.println("only one property may be requested at a time");
48 // System.out.println("usage: AAIConfigCommandLinePropGetter propertyname");
52 String value = AAIConfig.get(args[0]);
54 System.out.println(value); // bc this utility used by a shell script so it needs the result sent to
57 System.out.println("requested property could not be found");
59 } catch (AAIException e) {
60 // System.out.println("exception:" + e.toString()); //TODO is this reasonable?