summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'datarouter-prov/src/main')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java22
-rwxr-xr-xdatarouter-prov/src/main/resources/misc/sql_init_01.sql32
2 files changed, 35 insertions, 19 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java
index e1b24c53..230df756 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Subscription.java
@@ -68,6 +68,7 @@ public class Subscription extends Syncable {
private boolean suspended;
private Date lastMod;
private Date createdDate;
+ private boolean privilegedSubscriber;
public static Subscription getSubscriptionMatching(Subscription sub) {
SubDelivery deli = sub.getDelivery();
@@ -200,6 +201,7 @@ public class Subscription extends Syncable {
this.suspended = false;
this.lastMod = new Date();
this.createdDate = new Date();
+ this.privilegedSubscriber = false;
}
public Subscription(ResultSet rs) throws SQLException {
@@ -214,6 +216,7 @@ public class Subscription extends Syncable {
this.suspended = rs.getBoolean("SUSPENDED");
this.lastMod = rs.getDate("LAST_MOD");
this.createdDate = rs.getDate("CREATED_DATE");
+ this.privilegedSubscriber = rs.getBoolean("PRIVILEGED_SUBSCRIBER");
}
public Subscription(JSONObject jo) throws InvalidObjectException {
@@ -249,7 +252,7 @@ public class Subscription extends Syncable {
this.metadataOnly = jo.getBoolean("metadataOnly");
this.suspended = jo.optBoolean("suspend", false);
-
+ this.privilegedSubscriber = jo.optBoolean("privilegedSubscriber", false);
this.subscriber = jo.optString("subscriber", "");
JSONObject jol = jo.optJSONObject("links");
this.links = (jol == null) ? (new SubLinks()) : (new SubLinks(jol));
@@ -323,6 +326,14 @@ public class Subscription extends Syncable {
this.suspended = suspended;
}
+ public boolean isPrivilegedSubscriber() {
+ return privilegedSubscriber;
+ }
+
+ public void setPrivilegedSubscriber(boolean privilegedSubscriber) {
+ this.privilegedSubscriber = privilegedSubscriber;
+ }
+
public String getSubscriber() {
return subscriber;
}
@@ -357,6 +368,7 @@ public class Subscription extends Syncable {
jo.put("suspend", suspended);
jo.put(LAST_MOD_KEY, lastMod.getTime());
jo.put(CREATED_DATE, createdDate.getTime());
+ jo.put("privilegedSubscriber", privilegedSubscriber);
return jo;
}
@@ -394,7 +406,7 @@ public class Subscription extends Syncable {
}
// Create the SUBSCRIPTIONS row
- String sql = "insert into SUBSCRIPTIONS (SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ String sql = "insert into SUBSCRIPTIONS (SUBID, FEEDID, DELIVERY_URL, DELIVERY_USER, DELIVERY_PASSWORD, DELIVERY_USE100, METADATA_ONLY, SUBSCRIBER, SUSPENDED, GROUPID, PRIVILEGED_SUBSCRIBER) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
ps = c.prepareStatement(sql, new String[]{SUBID_COL});
ps.setInt(1, subid);
ps.setInt(2, feedid);
@@ -406,6 +418,7 @@ public class Subscription extends Syncable {
ps.setString(8, getSubscriber());
ps.setBoolean(9, isSuspended());
ps.setInt(10, groupid); //New field is added - Groups feature Rally:US708115 - 1610
+ ps.setBoolean(11, isPrivilegedSubscriber());
ps.execute();
ps.close();
// Update the row to set the URLs
@@ -436,7 +449,7 @@ public class Subscription extends Syncable {
boolean rv = true;
PreparedStatement ps = null;
try {
- String sql = "update SUBSCRIPTIONS set DELIVERY_URL = ?, DELIVERY_USER = ?, DELIVERY_PASSWORD = ?, DELIVERY_USE100 = ?, METADATA_ONLY = ?, SUSPENDED = ?, GROUPID = ? where SUBID = ?";
+ String sql = "update SUBSCRIPTIONS set DELIVERY_URL = ?, DELIVERY_USER = ?, DELIVERY_PASSWORD = ?, DELIVERY_USE100 = ?, METADATA_ONLY = ?, SUSPENDED = ?, GROUPID = ?, PRIVILEGED_SUBSCRIBER = ? where SUBID = ?";
ps = c.prepareStatement(sql);
ps.setString(1, delivery.getUrl());
ps.setString(2, delivery.getUser());
@@ -445,7 +458,8 @@ public class Subscription extends Syncable {
ps.setInt(5, isMetadataOnly() ? 1 : 0);
ps.setInt(6, suspended ? 1 : 0);
ps.setInt(7, groupid); //New field is added - Groups feature Rally:US708115 - 1610
- ps.setInt(8, subid);
+ ps.setInt(8, privilegedSubscriber ? 1 : 0);
+ ps.setInt(9, subid);
ps.executeUpdate();
} catch (SQLException e) {
rv = false;
diff --git a/datarouter-prov/src/main/resources/misc/sql_init_01.sql b/datarouter-prov/src/main/resources/misc/sql_init_01.sql
index 01258320..60b638a0 100755
--- a/datarouter-prov/src/main/resources/misc/sql_init_01.sql
+++ b/datarouter-prov/src/main/resources/misc/sql_init_01.sql
@@ -31,20 +31,21 @@ CREATE TABLE FEED_ENDPOINT_ADDRS (
);
CREATE TABLE SUBSCRIPTIONS (
- SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
- FEEDID INT UNSIGNED NOT NULL,
- GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
- DELIVERY_URL VARCHAR(256),
- DELIVERY_USER VARCHAR(20),
- DELIVERY_PASSWORD VARCHAR(32),
- DELIVERY_USE100 BOOLEAN DEFAULT FALSE,
- METADATA_ONLY BOOLEAN DEFAULT FALSE,
- SUBSCRIBER VARCHAR(8) NOT NULL,
- SELF_LINK VARCHAR(256),
- LOG_LINK VARCHAR(256),
- LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- SUSPENDED BOOLEAN DEFAULT FALSE,
- CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ SUBID INT UNSIGNED NOT NULL PRIMARY KEY,
+ FEEDID INT UNSIGNED NOT NULL,
+ GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0,
+ DELIVERY_URL VARCHAR(256),
+ DELIVERY_USER VARCHAR(20),
+ DELIVERY_PASSWORD VARCHAR(32),
+ DELIVERY_USE100 BOOLEAN DEFAULT FALSE,
+ METADATA_ONLY BOOLEAN DEFAULT FALSE,
+ SUBSCRIBER VARCHAR(8) NOT NULL,
+ SELF_LINK VARCHAR(256),
+ LOG_LINK VARCHAR(256),
+ LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ SUSPENDED BOOLEAN DEFAULT FALSE,
+ PRIVILEGED_SUBSCRIBER BOOLEAN DEFAULT FALSE,
+ CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
@@ -134,6 +135,7 @@ INSERT INTO PARAMETERS VALUES
('DELIVERY_INIT_RETRY_INTERVAL', '10'),
('DELIVERY_MAX_AGE', '86400'),
('DELIVERY_MAX_RETRY_INTERVAL', '3600'),
+ ('DELIVERY_FILE_PROCESS_INTERVAL', '600'),
('DELIVERY_RETRY_RATIO', '2'),
('LOGROLL_INTERVAL', '30'),
('PROV_AUTH_ADDRESSES', 'dmaap-dr-prov|dmaap-dr-node'),
@@ -142,5 +144,5 @@ INSERT INTO PARAMETERS VALUES
('PROV_MAXSUB_COUNT', '100000'),
('PROV_REQUIRE_CERT', 'false'),
('PROV_REQUIRE_SECURE', 'false'),
- ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE')
+ ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE|DELIVERY_FILE_PROCESS_INTERVAL')
;