Skip to content

Commit

Permalink
Merge pull request #96 from CDOT-CV/asn1-preservation
Browse files Browse the repository at this point in the history
ASN1 Bytes Preservation
  • Loading branch information
payneBrandon authored Aug 16, 2024
2 parents f643e45 + 39beed6 commit 75b469c
Show file tree
Hide file tree
Showing 35 changed files with 214 additions and 67 deletions.
Binary file modified docs/ODE_Output_Schema_Reference.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion jpo-ode-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>jpo-ode-common</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions jpo-ode-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>

<artifactId>jpo-ode-core</artifactId>
Expand All @@ -23,12 +23,12 @@
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-common</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>usdot.jpo.ode</groupId>
<artifactId>jpo-ode-plugins</artifactId>
<version>2.1.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
******************************************************************************/
package us.dot.its.jpo.ode.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import us.dot.its.jpo.ode.util.DateTimeUtils;
import us.dot.its.jpo.ode.util.JsonUtils;

@JsonPropertyOrder({ "logFileName", "recordType", "receivedMessageDetails", "payloadType", "serialId",
"odeReceivedAt", "schemaVersion", "maxDurationTime", "recordGeneratedAt", "recordGeneratedBy", "sanitized" })
"odeReceivedAt", "schemaVersion", "maxDurationTime", "recordGeneratedAt", "recordGeneratedBy", "sanitized", "asn1" })
public class OdeMsgMetadata extends OdeObject {

public enum GeneratedBy {
Expand All @@ -42,6 +44,9 @@ public enum GeneratedBy {
private GeneratedBy recordGeneratedBy;
private boolean sanitized = false;

@JsonInclude(JsonInclude.Include.NON_NULL)
private String asn1 = null;

public OdeMsgMetadata() {
this(OdeMsgPayload.class.getName(), new SerialId(), DateTimeUtils.now());
}
Expand All @@ -52,6 +57,7 @@ public OdeMsgMetadata(OdeMsgPayload payload) {

private OdeMsgMetadata(OdeMsgPayload payload, SerialId serialId, String receivedAt) {
this(payload.getClass().getName(), serialId, receivedAt);
setAsn1(payload);
}

public OdeMsgMetadata(String payloadType, SerialId serialId, String receivedAt) {
Expand Down Expand Up @@ -156,6 +162,21 @@ public static void setStaticSchemaVersion(int aSchemaVersion) {
staticSchemaVersion = aSchemaVersion;
}

public String getAsn1() {
return asn1;
}

public void setAsn1(String asn1) {
this.asn1 = asn1;
}

public void setAsn1(OdeMsgPayload payload) {
if (payload != null && payload.getData() != null ) {
if (JsonUtils.getJsonNode(payload.getData().toString(), "bytes") != null)
this.asn1 = JsonUtils.getJsonNode(payload.getData().toString(), "bytes").asText();
}
}

@Override
public int hashCode() {
final int prime = 31;
Expand All @@ -167,6 +188,7 @@ public int hashCode() {
result = prime * result + (sanitized ? 1231 : 1237);
result = prime * result + schemaVersion;
result = prime * result + ((serialId == null) ? 0 : serialId.hashCode());
result = prime * result + ((asn1 == null) ? 0 : asn1.hashCode());
return result;
}

Expand Down Expand Up @@ -205,6 +227,11 @@ public boolean equals(Object obj) {
return false;
} else if (!serialId.equals(other.serialId))
return false;
if (asn1 == null) {
if (other.asn1 != null)
return false;
} else if (!asn1.equals(other.asn1))
return false;
return true;
}

Expand Down
11 changes: 9 additions & 2 deletions jpo-ode-core/src/main/resources/schemas/schema-bsm.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"type": "boolean"
},
"schemaVersion": {
"const": 6,
"const": 7,
"type": "integer"
},
"securityResultCode": {
Expand Down Expand Up @@ -225,6 +225,12 @@
"serialNumber"
],
"type": "object"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -238,7 +244,8 @@
"odeReceivedAt",
"schemaVersion",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
],
"type": "object"
},
Expand Down
10 changes: 9 additions & 1 deletion jpo-ode-core/src/main/resources/schemas/schema-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"type": "boolean"
},
"schemaVersion": {
"const": 7,
"type": "integer"
},
"securityResultCode": {
Expand Down Expand Up @@ -94,6 +95,12 @@
"serialNumber"
],
"type": "object"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -111,7 +118,8 @@
"odePacketID",
"odeTimStartDateTime",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
],
"type": "object"
},
Expand Down
10 changes: 9 additions & 1 deletion jpo-ode-core/src/main/resources/schemas/schema-psm.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"type": "string"
},
"schemaVersion": {
"const": 7,
"type": "integer"
},
"maxDurationTime": {
Expand All @@ -104,6 +105,12 @@
},
"sanitized": {
"type": "boolean"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -120,7 +127,8 @@
"odePacketID",
"odeTimStartDateTime",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
]
},
"payload": {
Expand Down
11 changes: 9 additions & 2 deletions jpo-ode-core/src/main/resources/schemas/schema-spat.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"odeReceivedAt",
"schemaVersion",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
],
"properties": {
"spatSource": {
Expand Down Expand Up @@ -213,7 +214,7 @@
},
"schemaVersion": {
"type": "integer",
"const": 6
"const": 7
},
"maxDurationTime": {
"type": [
Expand Down Expand Up @@ -256,6 +257,12 @@
},
"sanitized": {
"type": "boolean"
},
"asn1": {
"type": [
"string",
"null"
]
}
}
},
Expand Down
10 changes: 9 additions & 1 deletion jpo-ode-core/src/main/resources/schemas/schema-srm.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"type": "string"
},
"schemaVersion": {
"const": 7,
"type": "integer"
},
"maxDurationTime": {
Expand All @@ -90,6 +91,12 @@
},
"sanitized": {
"type": "boolean"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -106,7 +113,8 @@
"odePacketID",
"odeTimStartDateTime",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
]
},
"payload": {
Expand Down
10 changes: 9 additions & 1 deletion jpo-ode-core/src/main/resources/schemas/schema-ssm.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"type": "string"
},
"schemaVersion": {
"const": 7,
"type": "integer"
},
"maxDurationTime": {
Expand All @@ -99,6 +100,12 @@
},
"sanitized": {
"type": "boolean"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -115,7 +122,8 @@
"odePacketID",
"odeTimStartDateTime",
"recordGeneratedAt",
"sanitized"
"sanitized",
"asn1"
]
},
"payload": {
Expand Down
10 changes: 9 additions & 1 deletion jpo-ode-core/src/main/resources/schemas/schema-tim.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"type": "string"
},
"schemaVersion": {
"const": 7,
"type": "string"
},
"securityResultCode": {
Expand Down Expand Up @@ -71,6 +72,12 @@
"bundleId"
],
"type": "object"
},
"asn1": {
"type": [
"string",
"null"
]
}
},
"required": [
Expand All @@ -88,7 +95,8 @@
"serialId",
"logFileName",
"odeReceivedAt",
"originIp"
"originIp",
"asn1"
],
"type": "object"
},
Expand Down
Loading

0 comments on commit 75b469c

Please sign in to comment.