Skip to content
Snippets Groups Projects
Commit 09d6ca7e authored by Terry D. Norbraten's avatar Terry D. Norbraten
Browse files

[Terry N.] Hopefully a more WIN friendly dir/file naming format. Update

notes to include capability to use localhost as the IP address
parent a7ee218e
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,5 @@
/CoT Test TX/nbproject/private/
/CoT Test TX/dist/
/CoT Test TX/build/
/pduLog
/logs
\ No newline at end of file
......@@ -18,6 +18,7 @@ Application arguments:
2) Determine your machine's IP address via:
ifconfig (*nix)
ipconfig (win)
or, just state "localhost"
3) Specify port: udp -> 9999
tcp -> 9998
4) Specify unique # of entities
......
......@@ -30,6 +30,7 @@ Application arguments:
2) Determine your machine's IP address via:
ifconfig (*nix)
ipconfig (win)
or, just state "localhost"
3) Specify port: udp -> 9999
tcp -> 9998
4) Specify unique # of entities
......
......@@ -83,7 +83,7 @@ jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=CoTreceiver
junit.selected.version=3
main.class=edu.nps.moves.main.CoTMsgReceiver
main.class=edu.nps.moves.cot.main.CoTMsgReceiver
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
......
......@@ -34,6 +34,8 @@ import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -66,12 +68,20 @@ import org.jdom2.output.XMLOutputter;
*/
public class CustomCoTparser extends CoTparser {
/** Schema directory */
private static final String SCHEMAS_DIR = "lib/xsd";
/** CoT Base Event Schema path */
private static final String COT_BASE_EVENT_SCHEMA = SCHEMAS_DIR + "/CoT Base-Event Schema (PUBLIC RELEASE).xsd";
/**
* Default format for LocaDateTime objects: "E-yyyyMMdd-HHmmss-SSS"
*/
private static final String DTF_FORMAT = "E-yyyyMMdd-HHmmss-SSS";
private static final DateTimeFormatter DATE_TIME_GROUP_FORMAT = DateTimeFormatter.ofPattern(DTF_FORMAT);
/** Our SAXBuilder */
private SAXBuilder builder;
private final XMLOutputter xmlOutput;
public CustomCoTparser() {
......@@ -159,14 +169,19 @@ public class CustomCoTparser extends CoTparser {
if (!dir.exists())
dir.mkdir();
LocalDateTime ldt = new java.sql.Timestamp(cotEvent.getStart().getTime()).toLocalDateTime();
String dtgStamp = DATE_TIME_GROUP_FORMAT.format(ldt);
// File dump directory per start time
File dir2 = new File(dir, cotEvent.getStart().toString());
File dir2 = new File(dir, "CoTMsgGrp-" + dtgStamp);
if (!dir2.exists())
dir2.mkdir();
Document cotMsg = validateCotMsg(cotEvent.toXml());
File cotxml = new File(dir2, "CoT-" + cotEvent.getTime().toString() + ".xml");
ldt = new java.sql.Timestamp(cotEvent.getTime().getTime()).toLocalDateTime();
dtgStamp = DATE_TIME_GROUP_FORMAT.format(ldt);
File cotxml = new File(dir2, "CoTEvt-" + dtgStamp + ".xml");
Document cotMsg = validateCotMsg(cotEvent.toXml());
try (OutputStream out = new FileOutputStream(cotxml)) {
xmlOutput.output(cotMsg, out);
} catch (IOException ex) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment