diff options
Diffstat (limited to 'framework/src/main')
3 files changed, 21 insertions, 22 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java index ca875b35..56f04e16 100644 --- a/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java +++ b/framework/src/main/java/org/onap/cli/fw/OnapCommandRegistrar.java @@ -52,6 +52,8 @@ public class OnapCommandRegistrar { private Set<String> availableProductVersions = new HashSet<>(); + private String enabledProductVersion = OnapCommandConfg.getEnabledProductVersion(); + private static OnapCommandRegistrar registrar = null; /** @@ -105,7 +107,7 @@ public class OnapCommandRegistrar { * @return set */ public Set<String> listCommandsForEnabledProductVersion() { - String version = OnapCommandConfg.getEnabledProductVersion(); + String version = this.getEnabledProductVersion(); Set<String> cmds = new HashSet<>(); if (!this.availableProductVersions.contains(version)) { @@ -120,30 +122,27 @@ public class OnapCommandRegistrar { return cmds; } + public Set<String> getAvailableProductVersions() { + return this.availableProductVersions; + } + + public void setEnabledProductVersion(String version) { + this.enabledProductVersion = version; + } + + public String getEnabledProductVersion() { + return this.enabledProductVersion; + } + /** - * Returns map of command to schema. + * Returns command details. * * @return map * @throws OnapCommandException * exception */ - public Map<String, String> getAllCommandToSchemaMap() throws OnapCommandException { - Map<String, String> map = new HashMap<>(); - List<ExternalSchema> schemas = OnapCommandUtils.findAllExternalSchemas(); - if (schemas != null) { - for (ExternalSchema schema : schemas) { - map.put(schema.getCmdName() + ":" + schema.getCmdVersion(), schema.getSchemaName()); - } - } - if (this.registry != null) { - for (String cmd : this.registry.keySet()) { - if (!map.containsKey(cmd) && registry.get(cmd) != null) { - map.put(cmd, this.getSchemaFileName(registry.get(cmd))); - } - } - } - - return map; + public List<ExternalSchema> listCommandInfo() throws OnapCommandException { + return OnapCommandUtils.findAllExternalSchemas(); } /** @@ -156,7 +155,7 @@ public class OnapCommandRegistrar { * Exception */ public OnapCommand get(String cmdName) throws OnapCommandException { - return this.get(cmdName, OnapCommandConfg.getEnabledProductVersion()); + return this.get(cmdName, this.getEnabledProductVersion()); } private OnapCommand get(String cmdName, String version) throws OnapCommandException { diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java index 7a156cac..823f0d77 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaRefreshCommand.java @@ -30,7 +30,7 @@ import java.util.List; * Refresh external schema. * */ -@OnapCommandSchema(name = "schema-refresh", version="cli-1.0", schema = "schema-refresh.yaml") +@OnapCommandSchema(name = "schema-refresh", version = "cli-1.0", schema = "schema-refresh.yaml") public class OnapSchemaRefreshCommand extends OnapCommand { @Override diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java index 3119f9c7..4028cc94 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommand.java @@ -29,7 +29,7 @@ import java.util.Map; /** * Validate schema command. */ -@OnapCommandSchema(name = "schema-validate", version="cli-1.0", schema = "schema-validate.yaml") +@OnapCommandSchema(name = "schema-validate", version = "cli-1.0", schema = "schema-validate.yaml") public class OnapSchemaValidateCommand extends OnapCommand { @Override |