private File dir;
private List<DeliveryTask> todoList = new ArrayList<>();
+ /**
+ * Create a delivery queue for a given destination info.
+ */
+ DeliveryQueue(DeliveryQueueHelper deliveryQueueHelper, DestInfo destinationInfo) {
+ this.deliveryQueueHelper = deliveryQueueHelper;
+ this.destinationInfo = destinationInfo;
+ dir = new File(destinationInfo.getSpool());
+ dir.mkdirs();
+ }
+
/**
* Try to cancel a delivery task.
*
}
}
- /**
- * Create a delivery queue for a given destination info.
- */
- DeliveryQueue(DeliveryQueueHelper deliveryQueueHelper, DestInfo destinationInfo) {
- this.deliveryQueueHelper = deliveryQueueHelper;
- this.destinationInfo = destinationInfo;
- dir = new File(destinationInfo.getSpool());
- dir.mkdirs();
- }
-
/**
* Update the destination info for this delivery queue.
*/
}
return fname2;
}
-}
+}
\ No newline at end of file
public class Feed extends Syncable {\r
\r
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
- private static int next_feedid = getMaxFeedID() + 1;\r
+ private static int nextFeedID = getMaxFeedID() + 1;\r
private static final String SQLEXCEPTION = "SQLException: ";\r
+ private static final String FEEDID = "FEEDID";\r
+ private static final String feedIDStr = "feedid";\r
+ private static final String deletedStr = "deleted";\r
+ private static final String lastModStr = "last_mod";\r
+ private static final String createdDateStr ="created_date";\r
\r
private int feedid;\r
private int groupid; //New field is added - Groups feature Rally:US708115 - 1610\r
private Date createdDate;\r
private String aafInstance;\r
\r
+ public Feed() {\r
+ this("", "", "", "");\r
+ }\r
+\r
+ /**\r
+ * Feed constructor.\r
+ * @param name feed name\r
+ * @param version feed version\r
+ * @param desc feed description\r
+ * @param businessDescription feed business description\r
+ */\r
+ public Feed(String name, String version, String desc, String businessDescription) {\r
+ this.feedid = -1;\r
+ this.groupid = -1; //New field is added - Groups feature Rally:US708115 - 1610\r
+ this.name = name;\r
+ this.version = version;\r
+ this.description = desc;\r
+ this.businessDescription = businessDescription; // New field is added - Groups feature Rally:US708102 - 1610\r
+ this.authorization = new FeedAuthorization();\r
+ this.publisher = "";\r
+ this.links = new FeedLinks();\r
+ this.deleted = false;\r
+ this.suspended = false;\r
+ this.lastMod = new Date();\r
+ this.createdDate = new Date();\r
+ this.aafInstance = "";\r
+ }\r
+\r
+ /**\r
+ * Feed Constructor from ResultSet.\r
+ * @param rs ResultSet\r
+ * @throws SQLException in case of SQL statement error\r
+ */\r
+ public Feed(ResultSet rs) throws SQLException {\r
+ this.feedid = rs.getInt(FEEDID);\r
+ //New field is added - Groups feature Rally:US708115 - 1610\r
+ this.groupid = rs.getInt("GROUPID");\r
+ this.name = rs.getString("NAME");\r
+ this.version = rs.getString("VERSION");\r
+ this.description = rs.getString("DESCRIPTION");\r
+ // New field is added - Groups feature Rally:US708102 - 1610\r
+ this.businessDescription = rs.getString("BUSINESS_DESCRIPTION");\r
+ this.authorization = new FeedAuthorization();\r
+ this.authorization.setClassification(rs.getString("AUTH_CLASS"));\r
+ this.publisher = rs.getString("PUBLISHER");\r
+ this.links = new FeedLinks();\r
+ this.links.setSelf(rs.getString("SELF_LINK"));\r
+ this.links.setPublish(rs.getString("PUBLISH_LINK"));\r
+ this.links.setSubscribe(rs.getString("SUBSCRIBE_LINK"));\r
+ this.links.setLog(rs.getString("LOG_LINK"));\r
+ this.deleted = rs.getBoolean("DELETED");\r
+ this.suspended = rs.getBoolean("SUSPENDED");\r
+ this.lastMod = rs.getDate("LAST_MOD");\r
+ this.createdDate = rs.getTimestamp("CREATED_DATE");\r
+ this.aafInstance = rs.getString("AAF_INSTANCE");\r
+ }\r
+\r
+ /**\r
+ * Feed constructor from JSONObject.\r
+ * @param jo JSONObject\r
+ * @throws InvalidObjectException in case of JSON error\r
+ */\r
+ public Feed(JSONObject jo) throws InvalidObjectException {\r
+ this("", "", "", "");\r
+ try {\r
+ // The JSONObject is assumed to contain a vnd.dmaap-dr.feed representation\r
+ this.feedid = jo.optInt(feedIDStr, -1);\r
+ this.groupid = jo.optInt("groupid");\r
+ this.name = jo.getString("name");\r
+ this.aafInstance = jo.optString("aaf_instance", "legacy");\r
+ if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
+ throw new InvalidObjectException("aaf_instance field is too long");\r
+ }\r
+ if (name.length() > 255) {\r
+ throw new InvalidObjectException("name field is too long");\r
+ }\r
+ try {\r
+ this.version = jo.getString("version");\r
+ } catch (JSONException e) {\r
+ intlogger.warn("PROV0023 Feed.Feed: " + e.getMessage(), e);\r
+ this.version = null;\r
+ }\r
+ if (version != null && version.length() > 20) {\r
+ throw new InvalidObjectException("version field is too long");\r
+ }\r
+ this.description = jo.optString("description");\r
+ this.businessDescription = jo.optString("business_description");\r
+ if (description.length() > 1000) {\r
+ throw new InvalidObjectException("technical description field is too long");\r
+ }\r
+ if (businessDescription.length() > 1000) {\r
+ throw new InvalidObjectException("business description field is too long");\r
+ }\r
+ this.authorization = new FeedAuthorization();\r
+ JSONObject jauth = jo.getJSONObject("authorization");\r
+ this.authorization.setClassification(jauth.getString("classification"));\r
+ if (this.authorization.getClassification().length() > 32) {\r
+ throw new InvalidObjectException("classification field is too long");\r
+ }\r
+ JSONArray endPointIds = jauth.getJSONArray("endpoint_ids");\r
+ for (int i = 0; i < endPointIds.length(); i++) {\r
+ JSONObject id = endPointIds.getJSONObject(i);\r
+ FeedEndpointID fid = new FeedEndpointID(id.getString("id"), id.getString("password"));\r
+ if (fid.getId().length() > 60) {\r
+ throw new InvalidObjectException("id field is too long (" + fid.getId() + ")");\r
+ }\r
+ if (fid.getPassword().length() > 32) {\r
+ //Fortify scan fixes - Privacy Violation\r
+ throw new InvalidObjectException("password field is too long (" + fid.getPassword() + ")");\r
+ }\r
+ this.authorization.getEndpointIDS().add(fid);\r
+ }\r
+ if (this.authorization.getEndpointIDS().isEmpty()) {\r
+ throw new InvalidObjectException("need to specify at least one endpoint_id");\r
+ }\r
+ endPointIds = jauth.getJSONArray("endpoint_addrs");\r
+ for (int i = 0; i < endPointIds.length(); i++) {\r
+ String addr = endPointIds.getString(i);\r
+ if (!JSONUtilities.validIPAddrOrSubnet(addr)) {\r
+ throw new InvalidObjectException("bad IP addr or subnet mask: " + addr);\r
+ }\r
+ this.authorization.getEndpointAddrs().add(addr);\r
+ }\r
+\r
+ this.publisher = jo.optString("publisher", "");\r
+ this.deleted = jo.optBoolean(deletedStr, false);\r
+ this.suspended = jo.optBoolean("suspend", false);\r
+ JSONObject jol = jo.optJSONObject("links");\r
+ this.links = (jol == null) ? (new FeedLinks()) : (new FeedLinks(jol));\r
+ } catch (InvalidObjectException e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ intlogger.warn("Invalid JSON: " + e.getMessage(), e);\r
+ throw new InvalidObjectException("Invalid JSON: " + e.getMessage());\r
+ }\r
+ }\r
+\r
/**\r
* Check if a feed ID is valid.\r
*\r
String sql = "select * from FEED_ENDPOINT_IDS";\r
try (ResultSet rs = stmt.executeQuery(sql)) {\r
while (rs.next()) {\r
- int id = rs.getInt("FEEDID");\r
+ int id = rs.getInt(FEEDID);\r
Feed feed = map.get(id);\r
if (feed != null) {\r
FeedEndpointID epi = new FeedEndpointID(rs);\r
sql = "select * from FEED_ENDPOINT_ADDRS";\r
try (ResultSet rs = stmt.executeQuery(sql)) {\r
while (rs.next()) {\r
- int id = rs.getInt("FEEDID");\r
+ int id = rs.getInt(FEEDID);\r
Feed feed = map.get(id);\r
if (feed != null) {\r
Collection<String> acoll = feed.getAuthorization().getEndpointAddrs();\r
return feed;\r
}\r
\r
- public Feed() {\r
- this("", "", "", "");\r
- }\r
-\r
- /**\r
- * Feed constructor.\r
- * @param name feed name\r
- * @param version feed version\r
- * @param desc feed description\r
- * @param businessDescription feed business description\r
- */\r
- public Feed(String name, String version, String desc, String businessDescription) {\r
- this.feedid = -1;\r
- this.groupid = -1; //New field is added - Groups feature Rally:US708115 - 1610\r
- this.name = name;\r
- this.version = version;\r
- this.description = desc;\r
- this.businessDescription = businessDescription; // New field is added - Groups feature Rally:US708102 - 1610\r
- this.authorization = new FeedAuthorization();\r
- this.publisher = "";\r
- this.links = new FeedLinks();\r
- this.deleted = false;\r
- this.suspended = false;\r
- this.lastMod = new Date();\r
- this.createdDate = new Date();\r
- this.aafInstance = "";\r
- }\r
\r
- /**\r
- * Feed Constructor from ResultSet.\r
- * @param rs ResultSet\r
- * @throws SQLException in case of SQL statement error\r
- */\r
- public Feed(ResultSet rs) throws SQLException {\r
- this.feedid = rs.getInt("FEEDID");\r
- //New field is added - Groups feature Rally:US708115 - 1610\r
- this.groupid = rs.getInt("GROUPID");\r
- this.name = rs.getString("NAME");\r
- this.version = rs.getString("VERSION");\r
- this.description = rs.getString("DESCRIPTION");\r
- // New field is added - Groups feature Rally:US708102 - 1610\r
- this.businessDescription = rs.getString("BUSINESS_DESCRIPTION");\r
- this.authorization = new FeedAuthorization();\r
- this.authorization.setClassification(rs.getString("AUTH_CLASS"));\r
- this.publisher = rs.getString("PUBLISHER");\r
- this.links = new FeedLinks();\r
- this.links.setSelf(rs.getString("SELF_LINK"));\r
- this.links.setPublish(rs.getString("PUBLISH_LINK"));\r
- this.links.setSubscribe(rs.getString("SUBSCRIBE_LINK"));\r
- this.links.setLog(rs.getString("LOG_LINK"));\r
- this.deleted = rs.getBoolean("DELETED");\r
- this.suspended = rs.getBoolean("SUSPENDED");\r
- this.lastMod = rs.getDate("LAST_MOD");\r
- this.createdDate = rs.getTimestamp("CREATED_DATE");\r
- this.aafInstance = rs.getString("AAF_INSTANCE");\r
- }\r
-\r
- /**\r
- * Feed constructor from JSONObject.\r
- * @param jo JSONObject\r
- * @throws InvalidObjectException in case of JSON error\r
- */\r
- public Feed(JSONObject jo) throws InvalidObjectException {\r
- this("", "", "", "");\r
- try {\r
- // The JSONObject is assumed to contain a vnd.dmaap-dr.feed representation\r
- this.feedid = jo.optInt("feedid", -1);\r
- this.groupid = jo.optInt("groupid");\r
- this.name = jo.getString("name");\r
- this.aafInstance = jo.optString("aaf_instance", "legacy");\r
- if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
- throw new InvalidObjectException("aaf_instance field is too long");\r
- }\r
- if (name.length() > 255) {\r
- throw new InvalidObjectException("name field is too long");\r
- }\r
- try {\r
- this.version = jo.getString("version");\r
- } catch (JSONException e) {\r
- intlogger.warn("PROV0023 Feed.Feed: " + e.getMessage(), e);\r
- this.version = null;\r
- }\r
- if (version != null && version.length() > 20) {\r
- throw new InvalidObjectException("version field is too long");\r
- }\r
- this.description = jo.optString("description");\r
- this.businessDescription = jo.optString("business_description");\r
- if (description.length() > 1000) {\r
- throw new InvalidObjectException("technical description field is too long");\r
- }\r
- if (businessDescription.length() > 1000) {\r
- throw new InvalidObjectException("business description field is too long");\r
- }\r
- this.authorization = new FeedAuthorization();\r
- JSONObject jauth = jo.getJSONObject("authorization");\r
- this.authorization.setClassification(jauth.getString("classification"));\r
- if (this.authorization.getClassification().length() > 32) {\r
- throw new InvalidObjectException("classification field is too long");\r
- }\r
- JSONArray endPointIds = jauth.getJSONArray("endpoint_ids");\r
- for (int i = 0; i < endPointIds.length(); i++) {\r
- JSONObject id = endPointIds.getJSONObject(i);\r
- FeedEndpointID fid = new FeedEndpointID(id.getString("id"), id.getString("password"));\r
- if (fid.getId().length() > 60) {\r
- throw new InvalidObjectException("id field is too long (" + fid.getId() + ")");\r
- }\r
- if (fid.getPassword().length() > 32) {\r
- //Fortify scan fixes - Privacy Violation\r
- throw new InvalidObjectException("password field is too long (" + fid.getPassword() + ")");\r
- }\r
- this.authorization.getEndpointIDS().add(fid);\r
- }\r
- if (this.authorization.getEndpointIDS().isEmpty()) {\r
- throw new InvalidObjectException("need to specify at least one endpoint_id");\r
- }\r
- endPointIds = jauth.getJSONArray("endpoint_addrs");\r
- for (int i = 0; i < endPointIds.length(); i++) {\r
- String addr = endPointIds.getString(i);\r
- if (!JSONUtilities.validIPAddrOrSubnet(addr)) {\r
- throw new InvalidObjectException("bad IP addr or subnet mask: " + addr);\r
- }\r
- this.authorization.getEndpointAddrs().add(addr);\r
- }\r
-\r
- this.publisher = jo.optString("publisher", "");\r
- this.deleted = jo.optBoolean("deleted", false);\r
- this.suspended = jo.optBoolean("suspend", false);\r
- JSONObject jol = jo.optJSONObject("links");\r
- this.links = (jol == null) ? (new FeedLinks()) : (new FeedLinks(jol));\r
- } catch (InvalidObjectException e) {\r
- throw e;\r
- } catch (Exception e) {\r
- intlogger.warn("Invalid JSON: " + e.getMessage(), e);\r
- throw new InvalidObjectException("Invalid JSON: " + e.getMessage());\r
- }\r
- }\r
\r
public int getFeedid() {\r
return feedid;\r
return aafInstance;\r
}\r
\r
- public void setAaf_instance(String aafInstance) {\r
+ public void setAafInstance(String aafInstance) {\r
this.aafInstance = aafInstance;\r
}\r
\r
}\r
\r
// New field is added - Groups feature Rally:US708102 - 1610\r
- public String getBusiness_description() {\r
+ public String getBusinessDescription() {\r
return businessDescription;\r
}\r
\r
- public void setBusiness_description(String businessDescription) {\r
+ public void setBusinessDescription(String businessDescription) {\r
this.businessDescription = businessDescription;\r
}\r
\r
@Override\r
public JSONObject asJSONObject() {\r
JSONObject jo = new JSONObject();\r
- jo.put("feedid", feedid);\r
+ jo.put(feedIDStr, feedid);\r
//New field is added - Groups feature Rally:US708115 - 1610\r
jo.put("groupid", groupid);\r
jo.put("name", name);\r
jo.put("authorization", authorization.asJSONObject());\r
jo.put("publisher", publisher);\r
jo.put("links", links.asJSONObject());\r
- jo.put("deleted", deleted);\r
+ jo.put(deletedStr, deleted);\r
jo.put("suspend", suspended);\r
- jo.put("last_mod", lastMod.getTime());\r
- jo.put("created_date", createdDate.getTime());\r
+ jo.put(lastModStr, lastMod.getTime());\r
+ jo.put(createdDateStr, createdDate.getTime());\r
jo.put("aaf_instance", aafInstance);\r
return jo;\r
}\r
public JSONObject asJSONObject(boolean hidepasswords) {\r
JSONObject jo = asJSONObject();\r
if (hidepasswords) {\r
- jo.remove("feedid"); // we no longer hide passwords, however we do hide these\r
- jo.remove("deleted");\r
- jo.remove("last_mod");\r
- jo.remove("created_date");\r
+ jo.remove(feedIDStr); // we no longer hide passwords, however we do hide these\r
+ jo.remove(deletedStr);\r
+ jo.remove(lastModStr);\r
+ jo.remove(createdDateStr);\r
}\r
return jo;\r
}\r
*/\r
public JSONObject asLimitedJSONObject() {\r
JSONObject jo = asJSONObject();\r
- jo.remove("deleted");\r
- jo.remove("feedid");\r
- jo.remove("last_mod");\r
- jo.remove("created_date");\r
+ jo.remove(deletedStr);\r
+ jo.remove(feedIDStr);\r
+ jo.remove(lastModStr);\r
+ jo.remove(createdDateStr);\r
return jo;\r
}\r
\r
boolean rv = true;\r
try {\r
if (feedid == -1) {\r
- setFeedid(next_feedid++);\r
+ setFeedid(nextFeedID++);\r
}\r
// In case we insert a feed from synchronization\r
- if (feedid > next_feedid) {\r
- next_feedid = feedid + 1;\r
+ if (feedid > nextFeedID) {\r
+ nextFeedID = feedid + 1;\r
}\r
\r
// Create FEED_ENDPOINT_IDS rows\r
ps2.setString(10, getLinks().getLog());\r
ps2.setBoolean(11, isDeleted());\r
ps2.setBoolean(12, isSuspended());\r
- ps2.setString(13, getBusiness_description());\r
+ ps2.setString(13, getBusinessDescription());\r
ps2.setInt(14, groupid);\r
ps2.setString(15, getAafInstance());\r
ps2.executeUpdate();\r
ps.setString(2, getAuthorization().getClassification());\r
ps.setInt(3, deleted ? 1 : 0);\r
ps.setInt(4, suspended ? 1 : 0);\r
- ps.setString(5, getBusiness_description());\r
+ ps.setString(5, getBusinessDescription());\r
ps.setInt(6, groupid);\r
ps.setInt(7, feedid);\r
ps.executeUpdate();\r
* @throws IOException in case of I/O error\r
*/\r
private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");\r
-\r
- /**\r
- * Get Log Records.\r
- * @param os outputstream\r
- * @param bs RLEBitSet object\r
- * @throws IOException in case of I/O error\r
- */\r
- public static void printLogRecords(OutputStream os, RLEBitSet bs) throws IOException {\r
- final String sql = "select * from LOG_RECORDS where RECORD_ID >= ? AND RECORD_ID <= ?";\r
- DB db = new DB();\r
- try (Connection conn = db.getConnection()) {\r
- Iterator<Long[]> iter = bs.getRangeIterator();\r
- try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
- while (iter.hasNext()) {\r
- Long[] nxt = iter.next();\r
- ps.setLong(1, nxt[0]);\r
- ps.setLong(2, nxt[1]);\r
- try (ResultSet rs = ps.executeQuery()) {\r
- while (rs.next()) {\r
- LogRecord lr = new LogRecord(rs);\r
- os.write(lr.toString().getBytes());\r
- }\r
- ps.clearParameters();\r
- }\r
- }\r
- }\r
- } catch (SQLException e) {\r
- intlogger.error("PROV0001 printLogRecords: " + e.getMessage(), e);\r
- }\r
- }\r
-\r
private final String type;\r
- private final String feedFileid;\r
+ private final String feedFileID;\r
private final String remoteAddr;\r
private final String user;\r
private final int status;\r
- private final int subid;\r
- private final String fileid;\r
+ private final int subID;\r
+ private final String fileID;\r
private final int result;\r
private final int attempts;\r
private final String reason;\r
public LogRecord(ResultSet rs) throws SQLException {\r
super(rs);\r
this.type = rs.getString("TYPE");\r
- this.feedFileid = rs.getString("FEED_FILEID");\r
+ this.feedFileID = rs.getString("FEED_FILEID");\r
this.remoteAddr = rs.getString("REMOTE_ADDR");\r
this.user = rs.getString("USER");\r
this.status = rs.getInt("STATUS");\r
\r
- this.subid = rs.getInt("DELIVERY_SUBID");\r
- this.fileid = rs.getString("DELIVERY_FILEID");\r
+ this.subID = rs.getInt("DELIVERY_SUBID");\r
+ this.fileID = rs.getString("DELIVERY_FILEID");\r
this.result = rs.getInt("RESULT");\r
\r
this.attempts = rs.getInt("ATTEMPTS");\r
public LogRecord(String[] pp) throws ParseException {\r
super(pp);\r
this.type = pp[8];\r
- this.feedFileid = pp[9];\r
+ this.feedFileID = pp[9];\r
this.remoteAddr = pp[10];\r
this.user = pp[11];\r
this.status = Integer.parseInt(pp[12]);\r
\r
- this.subid = Integer.parseInt(pp[13]);\r
- this.fileid = pp[14];\r
+ this.subID = Integer.parseInt(pp[13]);\r
+ this.fileID = pp[14];\r
this.result = Integer.parseInt(pp[15]);\r
\r
this.attempts = Integer.parseInt(pp[16]);\r
this.fileName = pp[20];\r
}\r
\r
+ /**\r
+ * Get Log Records.\r
+ * @param os outputstream\r
+ * @param bs RLEBitSet object\r
+ * @throws IOException in case of I/O error\r
+ */\r
+ public static void printLogRecords(OutputStream os, RLEBitSet bs) throws IOException {\r
+ final String sql = "select * from LOG_RECORDS where RECORD_ID >= ? AND RECORD_ID <= ?";\r
+ DB db = new DB();\r
+ try (Connection conn = db.getConnection()) {\r
+ Iterator<Long[]> iter = bs.getRangeIterator();\r
+ try (PreparedStatement ps = conn.prepareStatement(sql)) {\r
+ while (iter.hasNext()) {\r
+ Long[] nxt = iter.next();\r
+ ps.setLong(1, nxt[0]);\r
+ ps.setLong(2, nxt[1]);\r
+ try (ResultSet rs = ps.executeQuery()) {\r
+ while (rs.next()) {\r
+ LogRecord lr = new LogRecord(rs);\r
+ os.write(lr.toString().getBytes());\r
+ }\r
+ ps.clearParameters();\r
+ }\r
+ }\r
+ }\r
+ } catch (SQLException e) {\r
+ intlogger.error("PROV0001 printLogRecords: " + e.getMessage(), e);\r
+ }\r
+ }\r
+\r
public long getRecordId() {\r
return recordId;\r
}\r
+ getContentType() + "|"\r
+ getContentLength() + "|"\r
+ type + "|"\r
- + feedFileid + "|"\r
+ + feedFileID + "|"\r
+ remoteAddr + "|"\r
+ user + "|"\r
+ status + "|"\r
- + subid + "|"\r
- + fileid + "|"\r
+ + subID + "|"\r
+ + fileID + "|"\r
+ result + "|"\r
+ attempts + "|"\r
+ reason + "|"\r
ps.setString(1, type);\r
super.load(ps); // loads fields 2-8\r
if (type.equals("pub")) {\r
- ps.setString(9, feedFileid);\r
+ ps.setString(9, feedFileID);\r
ps.setString(10, remoteAddr);\r
ps.setString(11, user);\r
ps.setInt(12, status);\r
ps.setNull(10, Types.VARCHAR);\r
ps.setString(11, user);\r
ps.setNull(12, Types.INTEGER);\r
- ps.setInt(13, subid);\r
- ps.setString(14, fileid);\r
+ ps.setInt(13, subID);\r
+ ps.setString(14, fileID);\r
ps.setInt(15, result);\r
ps.setNull(16, Types.INTEGER);\r
ps.setNull(17, Types.VARCHAR);\r
ps.setNull(10, Types.VARCHAR);\r
ps.setNull(11, Types.VARCHAR);\r
ps.setNull(12, Types.INTEGER);\r
- ps.setInt(13, subid);\r
- ps.setString(14, fileid);\r
+ ps.setInt(13, subID);\r
+ ps.setString(14, fileID);\r
ps.setNull(15, Types.INTEGER);\r
ps.setInt(16, attempts);\r
ps.setString(17, reason);\r
ps.setNull(19, Types.BIGINT);\r
ps.setString(20, fileName);\r
} else if (type.equals("pbf")) {\r
- ps.setString(9, feedFileid);\r
+ ps.setString(9, feedFileID);\r
ps.setString(10, remoteAddr);\r
ps.setString(11, user);\r
ps.setNull(12, Types.INTEGER);\r
ps.setNull(10, Types.VARCHAR);\r
ps.setNull(11, Types.VARCHAR);\r
ps.setNull(12, Types.INTEGER);\r
- ps.setInt(13, subid);\r
+ ps.setInt(13, subID);\r
ps.setNull(14, Types.VARCHAR);\r
ps.setNull(15, Types.INTEGER);\r
ps.setNull(16, Types.INTEGER);\r
private String aafInstance;\r
private boolean decompress;\r
\r
+ public Subscription() {\r
+ this("", "", "");\r
+ }\r
+\r
+ /**\r
+ * Subscription constructor.\r
+ * @param url url string\r
+ * @param user user string\r
+ * @param password password string\r
+ */\r
+ public Subscription(String url, String user, String password) {\r
+ this.subid = -1;\r
+ this.feedid = -1;\r
+ this.groupid = -1; //New field is added - Groups feature Rally:US708115 - 1610\r
+ this.delivery = new SubDelivery(url, user, password, false);\r
+ this.metadataOnly = false;\r
+ this.followRedirect = false;\r
+ this.subscriber = "";\r
+ this.links = new SubLinks();\r
+ this.suspended = false;\r
+ this.lastMod = new Date();\r
+ this.createdDate = new Date();\r
+ this.privilegedSubscriber = false;\r
+ this.aafInstance = "";\r
+ this.decompress = false;\r
+ }\r
+\r
+ /**\r
+ * Subscription constructor.\r
+ * @param rs resultset from SQL\r
+ * @throws SQLException in case of SQL error\r
+ */\r
+ public Subscription(ResultSet rs) throws SQLException {\r
+ this.subid = rs.getInt(SUBID_COL);\r
+ this.feedid = rs.getInt("FEEDID");\r
+ this.groupid = rs.getInt("GROUPID"); //New field is added - Groups feature Rally:US708115 - 1610\r
+ this.delivery = new SubDelivery(rs);\r
+ this.metadataOnly = rs.getBoolean("METADATA_ONLY");\r
+ this.followRedirect = rs.getBoolean("FOLLOW_REDIRECTS");\r
+ this.subscriber = rs.getString("SUBSCRIBER");\r
+ this.links = new SubLinks(rs.getString("SELF_LINK"), URLUtilities.generateFeedURL(feedid),\r
+ rs.getString("LOG_LINK"));\r
+ this.suspended = rs.getBoolean("SUSPENDED");\r
+ this.lastMod = rs.getDate("LAST_MOD");\r
+ this.createdDate = rs.getDate("CREATED_DATE");\r
+ this.privilegedSubscriber = rs.getBoolean("PRIVILEGED_SUBSCRIBER");\r
+ this.aafInstance = rs.getString("AAF_INSTANCE");\r
+ this.decompress = rs.getBoolean("DECOMPRESS");\r
+ }\r
+\r
+ /**\r
+ * Subscription constructor.\r
+ * @param jo JSONObject\r
+ * @throws InvalidObjectException in case of object error\r
+ */\r
+ public Subscription(JSONObject jo) throws InvalidObjectException {\r
+ this("", "", "");\r
+ try {\r
+ // The JSONObject is assumed to contain a vnd.dmaap-dr.subscription representation\r
+ this.subid = jo.optInt(SUBID_KEY, -1);\r
+ this.feedid = jo.optInt(FEEDID_KEY, -1);\r
+ this.groupid = jo.optInt(GROUPID_KEY, -1); //New field is added - Groups feature Rally:US708115 - 1610\r
+ this.aafInstance = jo.optString("aaf_instance", "legacy");\r
+ if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
+ throw new InvalidObjectException("aaf_instance field is too long");\r
+ }\r
+ JSONObject jdeli = jo.getJSONObject("delivery");\r
+ String url = jdeli.getString("url");\r
+ String user = jdeli.getString("user");\r
+ final String password = jdeli.getString("password");\r
+ final boolean use100 = jdeli.getBoolean("use100");\r
+\r
+ //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.\r
+ Properties prop = (new DB()).getProperties();\r
+ if (!url.startsWith("https://") && isHttpsRelaxationFalseAndHasSyncKey(jo, prop)) {\r
+ throw new InvalidObjectException("delivery URL is not HTTPS");\r
+ }\r
+\r
+ if (url.length() > 256) {\r
+ throw new InvalidObjectException("delivery url field is too long");\r
+ }\r
+ if (user.length() > 60) {\r
+ throw new InvalidObjectException("delivery user field is too long");\r
+ }\r
+ if (password.length() > 32) {\r
+ throw new InvalidObjectException("delivery password field is too long");\r
+ }\r
+ this.delivery = new SubDelivery(url, user, password, use100);\r
+ this.metadataOnly = jo.getBoolean("metadataOnly");\r
+ this.followRedirect = jo.optBoolean("follow_redirect", false);\r
+ this.suspended = jo.optBoolean("suspend", false);\r
+ this.privilegedSubscriber = jo.optBoolean("privilegedSubscriber", false);\r
+ this.decompress = jo.optBoolean("decompress", false);\r
+ this.subscriber = jo.optString("subscriber", "");\r
+ JSONObject jol = jo.optJSONObject("links");\r
+ this.links = (jol == null) ? (new SubLinks()) : (new SubLinks(jol));\r
+ } catch (InvalidObjectException e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ intlogger.warn("Invalid JSON: " + e.getMessage(), e);\r
+ throw new InvalidObjectException("Invalid JSON: " + e.getMessage());\r
+ }\r
+ }\r
+\r
/**\r
* Get specific subscription.\r
* @param sub subscription object\r
return count;\r
}\r
\r
- public Subscription() {\r
- this("", "", "");\r
- }\r
-\r
- /**\r
- * Subscription constructor.\r
- * @param url url string\r
- * @param user user string\r
- * @param password password string\r
- */\r
- public Subscription(String url, String user, String password) {\r
- this.subid = -1;\r
- this.feedid = -1;\r
- this.groupid = -1; //New field is added - Groups feature Rally:US708115 - 1610\r
- this.delivery = new SubDelivery(url, user, password, false);\r
- this.metadataOnly = false;\r
- this.followRedirect = false;\r
- this.subscriber = "";\r
- this.links = new SubLinks();\r
- this.suspended = false;\r
- this.lastMod = new Date();\r
- this.createdDate = new Date();\r
- this.privilegedSubscriber = false;\r
- this.aafInstance = "";\r
- this.decompress = false;\r
- }\r
-\r
- /**\r
- * Subscription constructor.\r
- * @param rs resultset from SQL\r
- * @throws SQLException in case of SQL error\r
- */\r
- public Subscription(ResultSet rs) throws SQLException {\r
- this.subid = rs.getInt(SUBID_COL);\r
- this.feedid = rs.getInt("FEEDID");\r
- this.groupid = rs.getInt("GROUPID"); //New field is added - Groups feature Rally:US708115 - 1610\r
- this.delivery = new SubDelivery(rs);\r
- this.metadataOnly = rs.getBoolean("METADATA_ONLY");\r
- this.followRedirect = rs.getBoolean("FOLLOW_REDIRECTS");\r
- this.subscriber = rs.getString("SUBSCRIBER");\r
- this.links = new SubLinks(rs.getString("SELF_LINK"), URLUtilities.generateFeedURL(feedid),\r
- rs.getString("LOG_LINK"));\r
- this.suspended = rs.getBoolean("SUSPENDED");\r
- this.lastMod = rs.getDate("LAST_MOD");\r
- this.createdDate = rs.getDate("CREATED_DATE");\r
- this.privilegedSubscriber = rs.getBoolean("PRIVILEGED_SUBSCRIBER");\r
- this.aafInstance = rs.getString("AAF_INSTANCE");\r
- this.decompress = rs.getBoolean("DECOMPRESS");\r
- }\r
-\r
- /**\r
- * Subscription constructor.\r
- * @param jo JSONObject\r
- * @throws InvalidObjectException in case of object error\r
- */\r
- public Subscription(JSONObject jo) throws InvalidObjectException {\r
- this("", "", "");\r
- try {\r
- // The JSONObject is assumed to contain a vnd.dmaap-dr.subscription representation\r
- this.subid = jo.optInt(SUBID_KEY, -1);\r
- this.feedid = jo.optInt(FEEDID_KEY, -1);\r
- this.groupid = jo.optInt(GROUPID_KEY, -1); //New field is added - Groups feature Rally:US708115 - 1610\r
- this.aafInstance = jo.optString("aaf_instance", "legacy");\r
- if (!(aafInstance.equalsIgnoreCase("legacy")) && aafInstance.length() > 255) {\r
- throw new InvalidObjectException("aaf_instance field is too long");\r
- }\r
- JSONObject jdeli = jo.getJSONObject("delivery");\r
- String url = jdeli.getString("url");\r
- String user = jdeli.getString("user");\r
- final String password = jdeli.getString("password");\r
- final boolean use100 = jdeli.getBoolean("use100");\r
-\r
- //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.\r
- Properties prop = (new DB()).getProperties();\r
- if (!url.startsWith("https://") && isHttpsRelaxationFalseAndHasSyncKey(jo, prop)) {\r
- throw new InvalidObjectException("delivery URL is not HTTPS");\r
- }\r
-\r
- if (url.length() > 256) {\r
- throw new InvalidObjectException("delivery url field is too long");\r
- }\r
- if (user.length() > 60) {\r
- throw new InvalidObjectException("delivery user field is too long");\r
- }\r
- if (password.length() > 32) {\r
- throw new InvalidObjectException("delivery password field is too long");\r
- }\r
- this.delivery = new SubDelivery(url, user, password, use100);\r
- this.metadataOnly = jo.getBoolean("metadataOnly");\r
- this.followRedirect = jo.optBoolean("follow_redirect", false);\r
- this.suspended = jo.optBoolean("suspend", false);\r
- this.privilegedSubscriber = jo.optBoolean("privilegedSubscriber", false);\r
- this.decompress = jo.optBoolean("decompress", false);\r
- this.subscriber = jo.optString("subscriber", "");\r
- JSONObject jol = jo.optJSONObject("links");\r
- this.links = (jol == null) ? (new SubLinks()) : (new SubLinks(jol));\r
- } catch (InvalidObjectException e) {\r
- throw e;\r
- } catch (Exception e) {\r
- intlogger.warn("Invalid JSON: " + e.getMessage(), e);\r
- throw new InvalidObjectException("Invalid JSON: " + e.getMessage());\r
- }\r
- }\r
-\r
private boolean isHttpsRelaxationFalseAndHasSyncKey(JSONObject jo, Properties prop) {\r
return prop.get("org.onap.dmaap.datarouter.provserver.https.relaxation").toString().equals("false") && !jo\r
.has("sync");\r
\r
private static EELFLogger logger = EELFManager.getInstance().getLogger("InternalLog");\r
private static Map<String, Counter> map = new HashMap<>();\r
+ private Map<String, List<Continuation>> suspendedRequests = new HashMap<>();\r
private static final Timer rolex = new Timer();\r
\r
@Override\r
}\r
}\r
\r
- private Map<String, List<Continuation>> suspendedRequests = new HashMap<>();\r
-\r
private void register(String id, Continuation continuation) {\r
synchronized (suspendedRequests) {\r
List<Continuation> list = suspendedRequests.get(id);\r
feed.setVersion("v1.0");
feed.setGroupid(1);
feed.setDescription("test feed");
- feed.setBusiness_description("test feed");
+ feed.setBusinessDescription("test feed");
feed.setSuspended(false);
feed.setPublisher("publish");
Assert.assertEquals(feed.getVersion(), "v1.0");
Assert.assertEquals(feed.getGroupid(), 1);
Assert.assertEquals(feed.getDescription(), "test feed");
- Assert.assertEquals(feed.getBusiness_description(), "test feed");
+ Assert.assertEquals(feed.getBusinessDescription(), "test feed");
Assert.assertEquals(feed.isSuspended(), false);
Assert.assertEquals(feed.getPublisher(), "publish");
}