aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main/java
diff options
context:
space:
mode:
authorEmmettCox <emmett.cox@est.tech>2019-02-05 16:16:40 +0000
committerEmmettCox <emmett.cox@est.tech>2019-02-05 16:16:40 +0000
commit5da50e90e6c78700d48d7468849d4a1599a249b3 (patch)
treeb39a8c24044de6eb0aafe511e21c252e1764f836 /datarouter-prov/src/main/java
parent14b8d9552808063686e0c22760cec6e35b960b59 (diff)
adding FILENAME value to LOG_RECORDS table.
Change-Id: Iea49d196f324b3a03a18d3d2084e5f6c7ad226ea Issue-ID: DMAAP-1022 Signed-off-by: EmmettCox <emmett.cox@est.tech>
Diffstat (limited to 'datarouter-prov/src/main/java')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java1
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryRecord.java1
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java1
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java10
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java1
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PublishRecord.java22
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java2
7 files changed, 28 insertions, 10 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java
index 5aa51302..2a959f3d 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java
@@ -64,5 +64,6 @@ public class DeliveryExtraRecord extends BaseLogRecord {
ps.setNull(16, Types.INTEGER);
ps.setNull(17, Types.VARCHAR);
ps.setLong(19, contentLength2);
+ ps.setNull(20, Types.VARCHAR);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryRecord.java
index aa7f5d0b..929c6f90 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryRecord.java
@@ -145,5 +145,6 @@ public class DeliveryRecord extends BaseLogRecord {
ps.setNull(16, Types.INTEGER);
ps.setNull(17, Types.VARCHAR);
ps.setNull(19, Types.BIGINT);
+ ps.setNull(20, Types.VARCHAR);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java
index 3f85aec6..9e6987a5 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java
@@ -141,5 +141,6 @@ public class ExpiryRecord extends BaseLogRecord {
ps.setInt(16, getAttempts());
ps.setString(17, getReason());
ps.setNull(19, Types.BIGINT);
+ ps.setNull(20, Types.VARCHAR);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java
index 1791bdc8..b7b82729 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/LogRecord.java
@@ -91,6 +91,7 @@ public class LogRecord extends BaseLogRecord {
private final String reason;
private final long record_id;
private final long clength2;
+ private final String fileName;
public LogRecord(ResultSet rs) throws SQLException {
super(rs);
@@ -109,6 +110,7 @@ public class LogRecord extends BaseLogRecord {
this.record_id = rs.getLong("RECORD_ID");
this.clength2 = rs.getLong("CONTENT_LENGTH_2");
+ this.fileName = rs.getString("FILENAME");
}
public LogRecord(String[] pp) throws ParseException {
@@ -127,7 +129,8 @@ public class LogRecord extends BaseLogRecord {
this.reason = pp[17];
this.record_id = Long.parseLong(pp[18]);
- this.clength2 = (pp.length == 20) ? Long.parseLong(pp[19]) : 0;
+ this.clength2 = (pp.length == 21) ? Long.parseLong(pp[19]) : 0;
+ this.fileName = pp[20];
}
public long getRecordId() {
@@ -176,6 +179,7 @@ public class LogRecord extends BaseLogRecord {
ps.setNull(17, Types.VARCHAR);
ps.setLong(18, record_id);
ps.setNull(19, Types.BIGINT);
+ ps.setString(20, fileName);
} else if (type.equals("del")) {
ps.setNull(9, Types.VARCHAR);
ps.setNull(10, Types.VARCHAR);
@@ -188,6 +192,7 @@ public class LogRecord extends BaseLogRecord {
ps.setNull(17, Types.VARCHAR);
ps.setLong(18, record_id);
ps.setNull(19, Types.BIGINT);
+ ps.setString(20, fileName);
} else if (type.equals("exp")) {
ps.setNull(9, Types.VARCHAR);
ps.setNull(10, Types.VARCHAR);
@@ -200,6 +205,7 @@ public class LogRecord extends BaseLogRecord {
ps.setString(17, reason);
ps.setLong(18, record_id);
ps.setNull(19, Types.BIGINT);
+ ps.setString(20, fileName);
} else if (type.equals("pbf")) {
ps.setString(9, feedFileid);
ps.setString(10, remoteAddr);
@@ -212,6 +218,7 @@ public class LogRecord extends BaseLogRecord {
ps.setNull(17, Types.VARCHAR);
ps.setLong(18, record_id);
ps.setLong(19, clength2);
+ ps.setString(20, fileName);
} else if (type.equals("dlx")) {
ps.setNull(9, Types.VARCHAR);
ps.setNull(10, Types.VARCHAR);
@@ -224,6 +231,7 @@ public class LogRecord extends BaseLogRecord {
ps.setNull(17, Types.VARCHAR);
ps.setLong(18, record_id);
ps.setLong(19, clength2);
+ ps.setString(20, fileName);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java
index cead8b05..88d48826 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java
@@ -88,5 +88,6 @@ public class PubFailRecord extends BaseLogRecord {
ps.setNull(16, Types.INTEGER);
ps.setNull(17, Types.VARCHAR);
ps.setLong(19, getContentLengthReceived());
+ ps.setNull(20, Types.VARCHAR);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PublishRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PublishRecord.java
index e7575ff3..2cde3971 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PublishRecord.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PublishRecord.java
@@ -30,6 +30,7 @@ import java.sql.Types;
import java.text.ParseException;
import java.util.LinkedHashMap;
+import org.apache.commons.lang3.StringUtils;
import org.onap.dmaap.datarouter.provisioning.utils.LOGJSONObject;
@@ -44,14 +45,10 @@ public class PublishRecord extends BaseLogRecord {
private String remoteAddr;
private String user;
private int status;
+ private String fileName;
public PublishRecord(String[] pp) throws ParseException {
super(pp);
-// This is too slow!
-// Matcher m = Pattern.compile(".*/publish/(\\d+)/(.*)$").matcher(pp[4]);
-// if (!m.matches())
-// throw new ParseException("bad pattern", 0);
-// this.feedFileid = m.group(2);
int ix = pp[4].indexOf("/publish/");
if (ix < 0)
throw new ParseException("bad pattern", 0);
@@ -62,6 +59,7 @@ public class PublishRecord extends BaseLogRecord {
this.remoteAddr = pp[8];
this.user = pp[9];
this.status = Integer.parseInt(pp[10]);
+ this.fileName = StringUtils.substringAfterLast(this.getRequestUri(), "/");
}
public PublishRecord(ResultSet rs) throws SQLException {
@@ -70,6 +68,7 @@ public class PublishRecord extends BaseLogRecord {
this.remoteAddr = rs.getString("REMOTE_ADDR");
this.user = rs.getString("USER");
this.status = rs.getInt("STATUS");
+ this.fileName = StringUtils.substringAfterLast(this.getRequestUri(), "/");
}
public String getFeedFileid() {
@@ -104,6 +103,10 @@ public class PublishRecord extends BaseLogRecord {
this.status = status;
}
+ public String getFileName() { return fileName;}
+
+ public void setFileName(String fileName) { this.fileName = fileName; }
+
public LOGJSONObject reOrderObject(LOGJSONObject jo) {
LinkedHashMap<String, Object> logrecordObj = new LinkedHashMap<String, Object>();
@@ -119,6 +122,7 @@ public class PublishRecord extends BaseLogRecord {
logrecordObj.put("type", jo.get("type"));
logrecordObj.put("date", jo.get("date"));
logrecordObj.put("contentLength", jo.get("contentLength"));
+ logrecordObj.put("fileName", jo.get("fileName"));
LOGJSONObject newjo = new LOGJSONObject(logrecordObj);
return newjo;
@@ -128,12 +132,13 @@ public class PublishRecord extends BaseLogRecord {
public LOGJSONObject asJSONObject() {
LOGJSONObject jo = super.asJSONObject();
jo.put("type", "pub");
-// jo.put("feedFileid", feedFileid);
-// jo.put("remoteAddr", remoteAddr);
-// jo.put("user", user);
+ jo.put("feedFileid", feedFileid);
+ jo.put("remoteAddr", remoteAddr);
+ jo.put("user", user);
jo.put("sourceIP", remoteAddr);
jo.put("endpointId", user);
jo.put("statusCode", status);
+ jo.put("fileName", fileName);
LOGJSONObject newjo = this.reOrderObject(jo);
@@ -154,5 +159,6 @@ public class PublishRecord extends BaseLogRecord {
ps.setNull(16, Types.INTEGER);
ps.setNull(17, Types.VARCHAR);
ps.setNull(19, Types.BIGINT);
+ ps.setString(20, getFileName());
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java
index b6ad8e43..ab1a3a78 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java
@@ -100,7 +100,7 @@ public class LogfileLoader extends Thread {
/**
* The PreparedStatement which is loaded by a <i>Loadable</i>.
*/
- public static final String INSERT_SQL = "insert into LOG_RECORDS values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ public static final String INSERT_SQL = "insert into LOG_RECORDS values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
/**
* Each server can assign this many IDs
*/