Code Review
/
dmaap
/
datarouter.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add optional API for PM Mapper
[dmaap/datarouter.git]
/
datarouter-node
/
src
/
main
/
java
/
org
/
onap
/
dmaap
/
datarouter
/
node
/
DeliveryTask.java
diff --git
a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
index
8072990
..
b2c3169
100644
(file)
--- a/
datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
+++ b/
datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/DeliveryTask.java
@@
-47,9
+47,9
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
private static Logger loggerDeliveryTask = Logger.getLogger("org.onap.dmaap.datarouter.node.DeliveryTask");
private static EELFLogger eelflogger = EELFManager.getInstance()
.getLogger(DeliveryTask.class);
private static Logger loggerDeliveryTask = Logger.getLogger("org.onap.dmaap.datarouter.node.DeliveryTask");
private static EELFLogger eelflogger = EELFManager.getInstance()
.getLogger(DeliveryTask.class);
- private DeliveryTaskHelper d
th
;
+ private DeliveryTaskHelper d
eliveryTaskHelper
;
private String pubid;
private String pubid;
- private DestInfo d
i
;
+ private DestInfo d
estInfo
;
private String spool;
private File datafile;
private File metafile;
private String spool;
private File datafile;
private File metafile;
@@
-69,25
+69,25
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
/**
* Create a delivery task for a given delivery queue and pub ID
*
/**
* Create a delivery task for a given delivery queue and pub ID
*
- * @param d
th
The delivery task helper for the queue this task is in.
+ * @param d
eliveryTaskHelper
The delivery task helper for the queue this task is in.
* @param pubid The publish ID for this file. This is used as
* the base for the file name in the spool directory and is of
* the form <milliseconds since 1970>.<fqdn of initial data router node>
*/
* @param pubid The publish ID for this file. This is used as
* the base for the file name in the spool directory and is of
* the form <milliseconds since 1970>.<fqdn of initial data router node>
*/
- public DeliveryTask(DeliveryTaskHelper d
th
, String pubid) {
- this.d
th = dth
;
+ public DeliveryTask(DeliveryTaskHelper d
eliveryTaskHelper
, String pubid) {
+ this.d
eliveryTaskHelper = deliveryTaskHelper
;
this.pubid = pubid;
this.pubid = pubid;
- d
i = dth.getDest
Info();
- subid = d
i
.getSubId();
- feedid = d
i
.getLogData();
- spool = d
i
.getSpool();
+ d
estInfo = deliveryTaskHelper.getDestination
Info();
+ subid = d
estInfo
.getSubId();
+ feedid = d
estInfo
.getLogData();
+ spool = d
estInfo
.getSpool();
String dfn = spool + "/" + pubid;
String mfn = dfn + ".M";
datafile = new File(spool + "/" + pubid);
metafile = new File(mfn);
String dfn = spool + "/" + pubid;
String mfn = dfn + ".M";
datafile = new File(spool + "/" + pubid);
metafile = new File(mfn);
- boolean monly = d
i
.isMetaDataOnly();
+ boolean monly = d
estInfo
.isMetaDataOnly();
date = Long.parseLong(pubid.substring(0, pubid.indexOf('.')));
date = Long.parseLong(pubid.substring(0, pubid.indexOf('.')));
- Vector<String[]> hdrv = new Vector<
String[]
>();
+ Vector<String[]> hdrv = new Vector<>();
try (BufferedReader br = new BufferedReader(new FileReader(metafile))) {
String s = br.readLine();
try (BufferedReader br = new BufferedReader(new FileReader(metafile))) {
String s = br.readLine();
@@
-104,7
+104,7
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
String v = s.substring(i + 1);
if ("x-dmaap-dr-routing".equalsIgnoreCase(h)) {
subid = v.replaceAll("[^ ]*/", "");
String v = s.substring(i + 1);
if ("x-dmaap-dr-routing".equalsIgnoreCase(h)) {
subid = v.replaceAll("[^ ]*/", "");
- feedid = d
th
.getFeedId(subid.replaceAll(" .*", ""));
+ feedid = d
eliveryTaskHelper
.getFeedId(subid.replaceAll(" .*", ""));
}
if (length == 0 && h.toLowerCase().startsWith("content-")) {
continue;
}
if (length == 0 && h.toLowerCase().startsWith("content-")) {
continue;
@@
-126,7
+126,7
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
loggerDeliveryTask.error("Exception "+e.getStackTrace(),e);
}
hdrs = hdrv.toArray(new String[hdrv.size()][]);
loggerDeliveryTask.error("Exception "+e.getStackTrace(),e);
}
hdrs = hdrv.toArray(new String[hdrv.size()][]);
- url = d
th
.getDestURL(fileid);
+ url = d
eliveryTaskHelper
.getDestURL(fileid);
}
/**
* Is the object a DeliveryTask with the same publication ID?
}
/**
* Is the object a DeliveryTask with the same publication ID?
@@
-171,14
+171,14
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
public void run() {
attempts++;
try {
public void run() {
attempts++;
try {
- d
i = dth.getDest
Info();
- boolean expect100 = d
i
.isUsing100();
- boolean monly = d
i
.isMetaDataOnly();
+ d
estInfo = deliveryTaskHelper.getDestination
Info();
+ boolean expect100 = d
estInfo
.isUsing100();
+ boolean monly = d
estInfo
.isMetaDataOnly();
length = 0;
if (!"DELETE".equals(method) && !monly) {
length = datafile.length();
}
length = 0;
if (!"DELETE".equals(method) && !monly) {
length = datafile.length();
}
- url = d
th
.getDestURL(fileid);
+ url = d
eliveryTaskHelper
.getDestURL(fileid);
URL u = new URL(url);
HttpURLConnection uc = (HttpURLConnection) u.openConnection();
uc.setConnectTimeout(60000);
URL u = new URL(url);
HttpURLConnection uc = (HttpURLConnection) u.openConnection();
uc.setConnectTimeout(60000);
@@
-186,7
+186,7
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
uc.setInstanceFollowRedirects(false);
uc.setRequestMethod(method);
uc.setRequestProperty("Content-Length", Long.toString(length));
uc.setInstanceFollowRedirects(false);
uc.setRequestMethod(method);
uc.setRequestProperty("Content-Length", Long.toString(length));
- uc.setRequestProperty("Authorization", d
i
.getAuth());
+ uc.setRequestProperty("Authorization", d
estInfo
.getAuth());
uc.setRequestProperty("X-DMAAP-DR-PUBLISH-ID", pubid);
for (String[] nv : hdrs) {
uc.addRequestProperty(nv[0], nv[1]);
uc.setRequestProperty("X-DMAAP-DR-PUBLISH-ID", pubid);
for (String[] nv : hdrs) {
uc.addRequestProperty(nv[0], nv[1]);
@@
-201,7
+201,7
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
try {
os = uc.getOutputStream();
} catch (ProtocolException pe) {
try {
os = uc.getOutputStream();
} catch (ProtocolException pe) {
- d
th
.reportDeliveryExtra(this, -1L);
+ d
eliveryTaskHelper
.reportDeliveryExtra(this, -1L);
// Rcvd error instead of 100-continue
loggerDeliveryTask.error("Exception "+pe.getStackTrace(),pe);
}
// Rcvd error instead of 100-continue
loggerDeliveryTask.error("Exception "+pe.getStackTrace(),pe);
}
@@
-223,7
+223,7
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
}
os.close();
} catch (IOException ioe) {
}
os.close();
} catch (IOException ioe) {
- d
th
.reportDeliveryExtra(this, sofar);
+ d
eliveryTaskHelper
.reportDeliveryExtra(this, sofar);
throw ioe;
}
}
throw ioe;
}
}
@@
-257,10
+257,10
@@
public class DeliveryTask implements Runnable, Comparable<DeliveryTask> {
}
is.close();
}
}
is.close();
}
- d
th
.reportStatus(this, rc, xpubid, rmsg);
+ d
eliveryTaskHelper
.reportStatus(this, rc, xpubid, rmsg);
} catch (Exception e) {
loggerDeliveryTask.error("Exception "+e.getStackTrace(),e);
} catch (Exception e) {
loggerDeliveryTask.error("Exception "+e.getStackTrace(),e);
- d
th
.reportException(this, e);
+ d
eliveryTaskHelper
.reportException(this, e);
}
}
}
}