+ /**\r
+ * Ingress route constructor.\r
+ * @param seq squence number\r
+ * @param feedid id for feed\r
+ * @param user user name\r
+ * @param subnet subnet string\r
+ * @param nodes collection of nodes\r
+ */\r
+ public IngressRoute(int seq, int feedid, String user, String subnet, Collection<String> nodes) {\r
+ this(seq, feedid, user, subnet);\r
+ this.nodelist = -1;\r
+ this.nodes = new TreeSet<>(nodes);\r
+ }\r
+\r
+ private IngressRoute(int seq, int feedid, String user, String subnet, int nodeset) {\r
+ this(seq, feedid, user, subnet);\r
+ this.nodelist = nodeset;\r
+ this.nodes = new TreeSet<>(readNodes());\r
+ }\r
+\r
+ private IngressRoute(int seq, int feedid, String user, String subnet) {\r
+ this.seq = seq;\r
+ this.feedid = feedid;\r
+ this.userid = (user == null) ? "-" : user;\r
+ this.subnet = (subnet == null) ? "-" : subnet;\r
+ this.nodelist = -1;\r
+ this.nodes = null;\r
+ if (Feed.getFeedById(feedid) == null) {\r
+ throw new IllegalArgumentException("No such feed: " + feedid);\r
+ }\r
+ if (!"-".equals(this.subnet)) {\r
+ SubnetMatcher sm = new SubnetMatcher(subnet);\r
+ if (!sm.isValid()) {\r
+ throw new IllegalArgumentException("Invalid subnet: " + subnet);\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Ingress route constructor.\r
+ * @param jo JSONObject\r
+ */\r
+ public IngressRoute(JSONObject jo) {\r
+ this.seq = jo.optInt("seq");\r
+ this.feedid = jo.optInt("feedid");\r
+ String user = jo.optString("user");\r
+ this.userid = "".equals(user) ? "-" : user;\r
+ user = jo.optString("subnet");\r
+ this.subnet = "".equals(user) ? "-" : user;\r
+ this.nodelist = -1;\r
+ this.nodes = new TreeSet<>();\r
+ JSONArray ja = jo.getJSONArray("node");\r
+ for (int i = 0; i < ja.length(); i++) {\r
+ this.nodes.add(ja.getString(i));\r
+ }\r
+ }\r
+\r
+\r