diff options
author | Zlatko Murgoski <zlatko.murgoski@nokia.com> | 2018-07-13 15:56:21 +0200 |
---|---|---|
committer | Zlatko Murgoski <zlatko.murgoski@nokia.com> | 2018-07-18 11:12:09 +0200 |
commit | 129240ca4c0f10cf4916882f99e91072db048a4c (patch) | |
tree | 15c0f78fdd11743ce46b3ceec6a12efcf683b795 /src/main/java/org/onap/dcae/CLIUtils.java | |
parent | cd66181b35300f020f197bb411d6bdf6ad2514fb (diff) |
VES collector application settings provider
Extract application settings to diferent class
First step to remove nsaServerLibrary
Change-Id: Ib4fb236ac4683d241c7841ba66f1afbcfb10c92a
Signed-off-by: ZlatkoMurgoski <zlatko.murgoski@nokia.com>
Issue-ID: DCAEGEN2-566
Diffstat (limited to 'src/main/java/org/onap/dcae/CLIUtils.java')
-rw-r--r-- | src/main/java/org/onap/dcae/CLIUtils.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/main/java/org/onap/dcae/CLIUtils.java b/src/main/java/org/onap/dcae/CLIUtils.java new file mode 100644 index 00000000..6450d2e5 --- /dev/null +++ b/src/main/java/org/onap/dcae/CLIUtils.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START======================================================= + * PROJECT + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.dcae; + +import java.util.HashMap; + +/** + * CLIUtils extracted from nsaServerLibrary this implementation will be removed once we switch to different API library + */ +public class CLIUtils { + + public static io.vavr.collection.HashMap<String, String> processCmdLine (String[] args) { + final HashMap<String,String> map = new HashMap<String,String> (); + + String lastKey = null; + for ( String arg : args ) + { + if ( arg.startsWith ( "-" ) ) + { + if ( lastKey != null ) + { + map.put ( lastKey.substring(1), "" ); + } + lastKey = arg; + } + else + { + if ( lastKey != null ) + { + map.put ( lastKey.substring(1), arg ); + } + lastKey = null; + } + } + if ( lastKey != null ) + { + map.put ( lastKey.substring(1), "" ); + } + return io.vavr.collection.HashMap.ofAll(map); + } +} |