summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArindam Mondal <arind.mondal@samsung.com>2019-04-09 15:03:28 +0900
committerarindamm <arind.mondal@samsung.com>2019-04-09 15:03:43 +0900
commit0dacd16c2f7bcffc7ceec929687d2dd38f9bf2f5 (patch)
treea1c1569f5174be58b6388262000607f532a13b45
parent976775a6d9877d5df437f6b06073dee32198a10d (diff)
too many constructor param
Issue-ID: DCAEGEN2-1379 Change-Id: I6c4297b3edfd50375b5f32b7af93b5297a408da0 Signed-off-by: arindamm <arind.mondal@samsung.com>
-rw-r--r--src/main/java/org/onap/dcae/controller/AccessController.java31
-rw-r--r--src/main/java/org/onap/dcae/controller/ControllerConfigInfo.java94
2 files changed, 91 insertions, 34 deletions
diff --git a/src/main/java/org/onap/dcae/controller/AccessController.java b/src/main/java/org/onap/dcae/controller/AccessController.java
index 1c78d99..c77772e 100644
--- a/src/main/java/org/onap/dcae/controller/AccessController.java
+++ b/src/main/java/org/onap/dcae/controller/AccessController.java
@@ -60,16 +60,18 @@ public class AccessController {
ControllerActivationState state;
public AccessController(JSONObject controller,
- ApplicationSettings properties) {
- this.cfgInfo = new ControllerConfigInfo(controller.get("controller_name").toString(),
- controller.get("controller_restapiUrl").toString(),
- controller.get("controller_restapiUser").toString(),
- controller.get("controller_restapiPassword").toString(),
- controller.get("controller_accessTokenUrl").toString(),
- controller.get("controller_accessTokenFile").toString(),
- controller.get("controller_subscriptionUrl").toString(),
- controller.get("controller_accessTokenMethod").toString(),
- controller.get("controller_subsMethod").toString());
+ ApplicationSettings properties) {
+ this.cfgInfo = new ControllerConfigInfo.ControllerConfigInfoBuilder()
+ .setController_name(controller.get("controller_name").toString())
+ .setController_restapiUrl(controller.get("controller_restapiUrl").toString())
+ .setController_restapiUser(controller.get("controller_restapiUser").toString())
+ .setController_restapiPassword(controller.get("controller_restapiPassword").toString())
+ .setController_accessTokenUrl(controller.get("controller_accessTokenUrl").toString())
+ .setController_accessTokenFile(controller.get("controller_accessTokenFile").toString())
+ .setController_subscriptionUrl(controller.get("controller_subscriptionUrl").toString())
+ .setController_accessTokenMethod(controller.get("controller_accessTokenMethod").toString())
+ .setController_subsMethod(controller.get("controller_subsMethod").toString())
+ .createControllerConfigInfo();
this.properties = properties;
this.ctx = new RestConfContext();
this.restApiCallNode = new RestapiCallNode();
@@ -77,12 +79,9 @@ public class AccessController {
this.state = ControllerActivationState.INIT;
prepareControllerParamMap();
- log.info("AccesController Created {} {} {} {} {} {}",
- this.cfgInfo.getController_name(),
- this.cfgInfo.getController_restapiUrl(),
- this.cfgInfo.getController_restapiPassword(),
- this.cfgInfo.getController_restapiUser(),
- this.cfgInfo.getController_accessTokenUrl(),
+ log.info("AccesController Created {} {} {} {} {} {}", this.cfgInfo.getController_name(),
+ this.cfgInfo.getController_restapiUrl(), this.cfgInfo.getController_restapiPassword(),
+ this.cfgInfo.getController_restapiUser(), this.cfgInfo.getController_accessTokenUrl(),
this.cfgInfo.getController_accessTokenFile());
}
diff --git a/src/main/java/org/onap/dcae/controller/ControllerConfigInfo.java b/src/main/java/org/onap/dcae/controller/ControllerConfigInfo.java
index 2941b9b..52cfc83 100644
--- a/src/main/java/org/onap/dcae/controller/ControllerConfigInfo.java
+++ b/src/main/java/org/onap/dcae/controller/ControllerConfigInfo.java
@@ -30,26 +30,84 @@ public class ControllerConfigInfo {
private String controller_accessTokenMethod;
private String controller_subsMethod;
- public ControllerConfigInfo(String controller_name,
- String controller_restapiUrl,
- String controller_restapiUser,
- String controller_restapiPassword,
- String controller_accessTokenUrl,
- String controller_accessTokenFile,
- String controller_subscriptionUrl,
- String controller_accessTokenMethod,
- String controller_subsMethod) {
- this.controller_name = controller_name;
- this.controller_restapiUrl = controller_restapiUrl;
- this.controller_restapiUser = controller_restapiUser;
- this.controller_restapiPassword = controller_restapiPassword;
- this.controller_accessTokenUrl = controller_accessTokenUrl;
- this.controller_accessTokenFile = controller_accessTokenFile;
- this.controller_subscriptionUrl = controller_subscriptionUrl;
- this.controller_accessTokenMethod = controller_accessTokenMethod;
- this.controller_subsMethod = controller_subsMethod;
+
+
+ public static class ControllerConfigInfoBuilder {
+ private String controller_name;
+ private String controller_restapiUrl;
+ private String controller_restapiUser;
+ private String controller_restapiPassword;
+ private String controller_accessTokenUrl;
+ private String controller_accessTokenFile;
+ private String controller_subscriptionUrl;
+ private String controller_accessTokenMethod;
+ private String controller_subsMethod;
+
+ public ControllerConfigInfoBuilder setController_name(String controller_name) {
+ this.controller_name = controller_name;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_restapiUrl(String controller_restapiUrl) {
+ this.controller_restapiUrl = controller_restapiUrl;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_restapiUser(String controller_restapiUser) {
+ this.controller_restapiUser = controller_restapiUser;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_restapiPassword(String controller_restapiPassword) {
+ this.controller_restapiPassword = controller_restapiPassword;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_accessTokenUrl(String controller_accessTokenUrl) {
+ this.controller_accessTokenUrl = controller_accessTokenUrl;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_accessTokenFile(String controller_accessTokenFile) {
+ this.controller_accessTokenFile = controller_accessTokenFile;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_subscriptionUrl(String controller_subscriptionUrl) {
+ this.controller_subscriptionUrl = controller_subscriptionUrl;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_accessTokenMethod(String controller_accessTokenMethod) {
+ this.controller_accessTokenMethod = controller_accessTokenMethod;
+ return this;
+ }
+
+ public ControllerConfigInfoBuilder setController_subsMethod(String controller_subsMethod) {
+ this.controller_subsMethod = controller_subsMethod;
+ return this;
+ }
+
+ public ControllerConfigInfo createControllerConfigInfo() {
+ return new ControllerConfigInfo(this);
+ }
+ }
+
+
+ public ControllerConfigInfo(ControllerConfigInfoBuilder controllerConfigInfoBuilder) {
+ this.controller_name = controllerConfigInfoBuilder.controller_name;
+ this.controller_restapiUrl = controllerConfigInfoBuilder.controller_restapiUrl;
+ this.controller_restapiUser = controllerConfigInfoBuilder.controller_restapiUser;
+ this.controller_restapiPassword = controllerConfigInfoBuilder.controller_restapiPassword;
+ this.controller_accessTokenUrl = controllerConfigInfoBuilder.controller_accessTokenUrl;
+ this.controller_accessTokenFile = controllerConfigInfoBuilder.controller_accessTokenFile;
+ this.controller_subscriptionUrl = controllerConfigInfoBuilder.controller_subscriptionUrl;
+ this.controller_accessTokenMethod = controllerConfigInfoBuilder.controller_accessTokenMethod;
+ this.controller_subsMethod = controllerConfigInfoBuilder.controller_subsMethod;
+
}
+
public String getController_name() {
return controller_name;
}