summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java2
-rw-r--r--client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java4
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java28
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java72
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java15
-rw-r--r--client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java2
-rw-r--r--client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java4
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java2
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java8
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java4
10 files changed, 70 insertions, 71 deletions
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
index 7e305788f..d56e05d29 100644
--- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
+++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexDeploymentRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
index fb18a002f..5026c5162 100644
--- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
+++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
@@ -178,9 +178,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
index ea4f206ce..4d0959977 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
@@ -65,20 +65,6 @@ public class ApexEditorMain {
private final PrintStream outStream;
/**
- * Main method, main entry point for command.
- *
- * @param args The command line arguments for the editor
- */
- public static void main(final String[] args) {
- try {
- final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
- editorMain.init();
- } catch (final Exception e) {
- LOGGER.error("start failed", e);
- }
- }
-
- /**
* Constructor, kicks off the editor.
*
* @param args The command line arguments for the editor
@@ -212,4 +198,18 @@ public class ApexEditorMain {
}
}
}
+
+ /**
+ * Main method, main entry point for command.
+ *
+ * @param args The command line arguments for the editor
+ */
+ public static void main(final String[] args) {
+ try {
+ final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
+ editorMain.init();
+ } catch (final Exception e) {
+ LOGGER.error("start failed", e);
+ }
+ }
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
index 72c294169..fed1a50ce 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
@@ -536,10 +536,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -646,10 +646,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -690,10 +690,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -728,10 +728,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -849,10 +849,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -893,10 +893,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -931,10 +931,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1037,8 +1037,8 @@ public class ApexEditorRestResource {
final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateEvent");
return ret;
@@ -1085,10 +1085,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1124,10 +1124,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1171,10 +1171,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1374,8 +1374,8 @@ public class ApexEditorRestResource {
final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateTask");
return ret;
@@ -1422,10 +1422,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1466,10 +1466,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1511,10 +1511,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1777,8 +1777,8 @@ public class ApexEditorRestResource {
final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdatePolicy");
return ret;
@@ -1839,10 +1839,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1884,10 +1884,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
index 2bd47238a..2888b0376 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
@@ -49,6 +49,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public abstract class RestUtils {
+ // Regular expressions for checking input types
+ private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
+ /**
+ * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
+ */
+ private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
/**
* Constructor, block inheritance.
@@ -77,7 +83,7 @@ public abstract class RestUtils {
}
if (val.isJsonPrimitive() && ((JsonPrimitive) val).isString()) {
final String v = ((JsonPrimitive) val).getAsString();
- if (v == null || v.equals("")) {
+ if (v == null || "".equals(v)) {
return JsonNull.INSTANCE;
}
}
@@ -137,13 +143,6 @@ public abstract class RestUtils {
return gb.create().fromJson(jsonObject, clz);
}
- // Regular expressions for checking input types
- private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
- /**
- * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
- */
- private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
-
/**
* Gets the concept from JSON.
*
diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
index bb27943d6..5812ebdb3 100644
--- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
+++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexServicesRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
index d0b374fd4..301b19f38 100644
--- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
+++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
@@ -173,9 +173,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\" of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
index f5c8ad8c0..a72fbe0a7 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexMonitoringRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
index f8cee7741..6b7f12061 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
@@ -195,9 +195,9 @@ public class ApexMonitoringRestResource {
parameterMap.put("AxArtifactKey#" + engineId, new String[]
{ startStop });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startEngine(engineKey);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopEngine(engineKey);
}
} catch (final Exception e) {
@@ -241,10 +241,10 @@ public class ApexMonitoringRestResource {
parameterMap.put("period", new String[]
{ Long.toString(period) });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startPerioidicEvents(engineKey, period);
setPeriodicEventsState(host, true);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopPerioidicEvents(engineKey);
setPeriodicEventsState(host, false);
}
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
index 90527751e..46e1452a5 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
@@ -173,9 +173,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);