Add optional API for PM Mapper
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / DestInfo.java
index 1225331..c3e0057 100644 (file)
@@ -37,6 +37,7 @@ public class DestInfo {
     private String authentication;
     private boolean metaonly;
     private boolean use100;
+    private boolean privilegedSubscriber;
 
     /**
      * Create a destination information object.
@@ -50,8 +51,9 @@ public class DestInfo {
      * @param    authentication    The credentials.
      * @param    metaonly    Is this a metadata only delivery?
      * @param    use100    Should I use expect 100-continue?
+     * @param    privilegedSubscriber   Can we wait to receive a file processed acknowledgement before deleting file
      */
-    public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100) {
+    public DestInfo(String name, String spool, String subid, String logdata, String url, String authuser, String authentication, boolean metaonly, boolean use100, boolean privilegedSubscriber) {
         this.name = name;
         this.spool = spool;
         this.subid = subid;
@@ -61,6 +63,27 @@ public class DestInfo {
         this.authentication = authentication;
         this.metaonly = metaonly;
         this.use100 = use100;
+        this.privilegedSubscriber = privilegedSubscriber;
+    }
+
+    /**
+     * Create a destination information object.
+     *
+     * @param    name    n:fqdn or s:subid
+     * @param    spool    The directory where files are spooled.
+     * @param    subscription    The subscription.
+     */
+    public DestInfo(String name, String spool, NodeConfig.ProvSubscription subscription) {
+        this.name = name;
+        this.spool = spool;
+        this.subid = subscription.getSubId();
+        this.logdata = subscription.getFeedId();
+        this.url = subscription.getURL();
+        this.authuser = subscription.getAuthUser();
+        this.authentication = subscription.getCredentials();
+        this.metaonly = subscription.isMetaDataOnly();
+        this.use100 = subscription.isUsing100();
+        this.privilegedSubscriber = subscription.isPrivilegedSubscriber();
     }
 
     public boolean equals(Object o) {
@@ -150,4 +173,11 @@ public class DestInfo {
     public boolean isUsing100() {
         return (use100);
     }
+
+    /**
+     * Should we wait to receive a file processed acknowledgement before deleting file
+     */
+    public boolean isPrivilegedSubscriber() {
+        return (privilegedSubscriber);
+    }
 }