diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-03-27 11:39:49 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2018-03-27 11:39:49 +0530 |
commit | f5609349ba12f9bcdccc202c57a9438f22996c26 (patch) | |
tree | a71f56fdf034214819848541c7b42328a1153510 /framework/src/main/java/org/onap | |
parent | b2fe6db81ec2893d671fb02eb473f747885e40c8 (diff) |
Discover command state and persist
Issue-ID: CLI-100
Change-Id: I828f860ab5994796ceb692dbf12a7323ebd4d07a
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main/java/org/onap')
5 files changed, 35 insertions, 1 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java index 6f1741e5..7ea4ddaa 100644 --- a/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java +++ b/framework/src/main/java/org/onap/cli/fw/conf/OnapCommandConstants.java @@ -58,6 +58,7 @@ public class OnapCommandConstants { public static final String INFO_TYPE = "type"; public static final String INFO_AUTHOR = "author"; public static final String INFO_IGNORE = "ignore"; + public static final String INFO_STATE = "state"; //parameters public static final String PARAMETERS = "parameters"; diff --git a/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java index 1496bcbb..55009a49 100644 --- a/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java +++ b/framework/src/main/java/org/onap/cli/fw/info/OnapCommandInfo.java @@ -31,6 +31,8 @@ public class OnapCommandInfo { private OnapCommandType type = OnapCommandType.CMD; + private OnapCommandState state = OnapCommandState.STABLE; + private boolean ignore = false; public String getProduct() { @@ -73,5 +75,12 @@ public class OnapCommandInfo { this.ignore = ignore; } + public OnapCommandState getState() { + return state; + } + + public void setState(OnapCommandState state) { + this.state = state; + } }
\ No newline at end of file diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java index af444b8f..df30a240 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaInfo.java @@ -18,6 +18,7 @@ package org.onap.cli.fw.schema; import org.onap.cli.fw.cmd.OnapCommandType; import org.onap.cli.fw.conf.OnapCommandConstants; +import org.onap.cli.fw.info.OnapCommandState; import java.util.ArrayList; import java.util.List; @@ -55,6 +56,8 @@ public class OnapCommandSchemaInfo { private String ignore = OnapCommandConstants.BOOLEAN_FALSE; + private String state = OnapCommandState.STABLE.name(); + public String getSchemaName() { return schemaName; } @@ -126,4 +129,14 @@ public class OnapCommandSchemaInfo { public List<String> getSampleFiles() { return sampleFiles; } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + } diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java index 628ddf3a..06d688b4 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java @@ -30,6 +30,7 @@ import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_LIST; import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PARAMS_MANDATORY_LIST; import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_PRODUCT; import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_SERVICE; +import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_STATE; import static org.onap.cli.fw.conf.OnapCommandConstants.INFO_TYPE; import static org.onap.cli.fw.conf.OnapCommandConstants.INPUT_PARAMS_LIST; import static org.onap.cli.fw.conf.OnapCommandConstants.INPUT_PARAMS_MANDATORY_LIST; @@ -67,7 +68,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.io.FileUtils; import org.onap.cli.fw.cmd.OnapCommand; import org.onap.cli.fw.cmd.OnapCommandType; import org.onap.cli.fw.conf.OnapCommandConfig; @@ -79,6 +79,7 @@ import org.onap.cli.fw.error.OnapCommandParameterNameConflict; import org.onap.cli.fw.error.OnapCommandParameterOptionConflict; import org.onap.cli.fw.error.OnapCommandSchemaNotFound; import org.onap.cli.fw.info.OnapCommandInfo; +import org.onap.cli.fw.info.OnapCommandState; import org.onap.cli.fw.input.OnapCommandParameter; import org.onap.cli.fw.input.OnapCommandParameterType; import org.onap.cli.fw.output.OnapCommandPrintDirection; @@ -248,6 +249,11 @@ public class OnapCommandSchemaLoader { info.setCommandType(OnapCommandType.get(obj.toString())); break; + case INFO_STATE: + Object state = infoMap.get(key1); + info.setState(OnapCommandState.get(state.toString())); + break; + case INFO_AUTHOR: Object mode = infoMap.get(key1); info.setAuthor(mode.toString()); diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java index d0789d74..9bdd8a51 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java @@ -278,6 +278,11 @@ public class OnapCommandDiscoveryUtils { if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_IGNORE) != null) { schema.setIgnore(infoMap.get(OnapCommandConstants.INFO_IGNORE).toString()); } + + if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_STATE) != null) { + schema.setState(infoMap.get(OnapCommandConstants.INFO_STATE).toString()); + } + schema.setSchemaProfile(identitySchemaProfileType(resourceMap)); extSchemas.add(schema); |