aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java2
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java82
2 files changed, 65 insertions, 19 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
index c853782..14bacc4 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/database/DatabaseClass.java
@@ -109,7 +109,7 @@ public class DatabaseClass extends BaseLoggingClass {
break;
}
- dmaap.init(new Dmaap("0", "", "", "", "", "", "", ""));
+ dmaap.init(new Dmaap.DmaapBuilder().setVer("0").setTnr("").setDn("").setDpu("").setLu("").setBat("").setNk("").setAko("").createDmaap());
// force initial read from DB, if it exists
@SuppressWarnings("unused")
Dmaap dmx = dmaap.get();
diff --git a/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java b/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
index ba7fd42..96248f3 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/model/Dmaap.java
@@ -22,8 +22,6 @@ package org.onap.dmaap.dbcapi.model;
import javax.xml.bind.annotation.XmlRootElement;
-import org.apache.log4j.Logger;
-
@XmlRootElement
public class Dmaap extends DmaapObject {
@@ -42,26 +40,74 @@ public class Dmaap extends DmaapObject {
}
- public Dmaap( String ver,
- String tnr,
- String dn,
- String dpu,
- String lu,
- String bat,
- String nk,
- String ako ) {
- this.version = ver;
- this.topicNsRoot = tnr;
- this.dmaapName = dn;
- this.drProvUrl = dpu;
- this.bridgeAdminTopic = bat;
- this.loggingUrl = lu;
- this.nodeKey = nk;
- this.accessKeyOwner = ako;
+ public Dmaap( DmaapBuilder builder ) {
+ this.version = builder.ver;
+ this.topicNsRoot = builder.tnr;
+ this.dmaapName = builder.dn;
+ this.drProvUrl = builder.dpu;
+ this.bridgeAdminTopic = builder.bat;
+ this.loggingUrl = builder.lu;
+ this.nodeKey = builder.nk;
+ this.accessKeyOwner = builder.ako;
this.setStatus( DmaapObject_Status.NEW );
}
+ public static class DmaapBuilder {
+ private String ver;
+ private String tnr;
+ private String dn;
+ private String dpu;
+ private String lu;
+ private String bat;
+ private String nk;
+ private String ako;
+
+ public DmaapBuilder setVer(String ver) {
+ this.ver = ver;
+ return this;
+ }
+
+ public DmaapBuilder setTnr(String tnr) {
+ this.tnr = tnr;
+ return this;
+ }
+
+ public DmaapBuilder setDn(String dn) {
+ this.dn = dn;
+ return this;
+ }
+
+ public DmaapBuilder setDpu(String dpu) {
+ this.dpu = dpu;
+ return this;
+ }
+
+ public DmaapBuilder setLu(String lu) {
+ this.lu = lu;
+ return this;
+ }
+
+ public DmaapBuilder setBat(String bat) {
+ this.bat = bat;
+ return this;
+ }
+
+ public DmaapBuilder setNk(String nk) {
+ this.nk = nk;
+ return this;
+ }
+
+ public DmaapBuilder setAko(String ako) {
+ this.ako = ako;
+ return this;
+ }
+
+ public Dmaap createDmaap() {
+ return new Dmaap(this);
+ }
+ }
+
public String getVersion() {
return version;
}