Skip to content

Commit 23f789f

Browse files
Merge pull request #49 from Trihydro/release/v2.0
v2.0 Release: ODE 2025 Q1 Integration and Other Updates
2 parents 919ebd1 + a035a84 commit 23f789f

File tree

127 files changed

+3272
-3979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3272
-3979
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,28 @@ This will create the `target` folder under each module. From here, create a new
9898
```
9999
.
100100
├── cv-data-controller
101-
│ ├── cv-data-controller-1.4.0-SNAPSHOT.jar
101+
│ ├── cv-data-controller-x.x.x.jar
102102
│ ├── Dockerfile
103103
├── cv-data-tasks
104-
│ ├── cv-data-tasks-1.4.0-SNAPSHOT.jar
104+
│ ├── cv-data-tasks-x.x.x.jar
105105
│ ├── Dockerfile
106106
├── docker-compose.yml
107107
├── ode-data-logger
108108
│ ├── Dockerfile
109-
│ ├── ode-data-logger-1.4.0-SNAPSHOT.jar
109+
│ ├── ode-data-logger-x.x.x.jar
110110
├── ode-mongo-logger
111111
│ ├── Dockerfile
112-
│ ├── ode-mongo-logger-1.4.0-SNAPSHOT.jar
112+
│ ├── ode-mongo-logger-x.x.x.jar
113113
├── ode-wrapper
114114
│ ├── Dockerfile
115-
│ ├── ode-wrapper-1.4.0-SNAPSHOT.jar
115+
│ ├── ode-wrapper-x.x.x.jar
116116
├── ode-wrapper-docs
117117
│ └── swagger-ui-master
118118
│ ├── Dockerfile
119119
│ ├── (swagger folder structure)
120120
└── tim-refresh
121121
├── Dockerfile
122-
├── tim-refresh-1.4.0-SNAPSHOT.jar
122+
├── tim-refresh-x.x.x.jar
123123

124124
```
125125

cert-expiration/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ FROM maven:3.8-eclipse-temurin-21-alpine
22

33
ADD . /home/timm/timm_applications/cert-expiration
44

5-
CMD java -jar /home/timm/timm_applications/cert-expiration/cert-expiration-1.4.0-SNAPSHOT.jar
5+
CMD java -jar /home/timm/timm_applications/cert-expiration/cert-expiration-2.0.0.jar

cert-expiration/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.timm</groupId>
77
<artifactId>tim-manager</artifactId>
8-
<version>1.4.0-SNAPSHOT</version>
8+
<version>2.0.0</version>
99
</parent>
1010

1111
<artifactId>cert-expiration</artifactId>

cv-data-controller/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ FROM maven:3.8-eclipse-temurin-21-alpine
22

33
ADD . /home/timm/timm_applications/cv-data-controller
44

5-
CMD java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/timm/timm_applications/cv-data-controller/cv-data-controller-1.4.0-SNAPSHOT.jar
5+
CMD java --add-opens java.base/java.lang=ALL-UNNAMED -jar /home/timm/timm_applications/cv-data-controller/cv-data-controller-2.0.0.jar

cv-data-controller/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ You may configure these values in `cv-data-controller/src/main/resources/applica
111111
| SERVER_SSL_KEY_STORE_TYPE | CONTROLLER_SERVER_SSL_KEY_STORE_TYPE | server.ssl.keyStoreType | **PROD ONLY** Keystore type (JKS) | JKS |
112112
| SERVER_SSL_KEY_ALIAS | CONTROLLER_SERVER_SSL_KEY_ALIAS | server.ssl.keyAlias | **PROD ONLY** Alias for Keystore | example.alias |
113113
114+
## Note on Neo4j Database
115+
The system expects a Neo4j database to be running and accessible at the address specified in the `application.properties` file or the `sample.env` file. The
116+
database should be populated with the necessary data for the system to function properly. The database should be running before starting the application.
117+
114118
## Testing
115119
To run the unit tests, follow these steps:
116120
1. Reopen the project in the provided dev container by clicking on the blue button in the bottom left corner of the window and selecting "Reopen in Container"

cv-data-controller/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.timm</groupId>
99
<artifactId>tim-manager</artifactId>
10-
<version>1.4.0-SNAPSHOT</version>
10+
<version>2.0.0</version>
1111
</parent>
1212
<dependencies>
1313
<dependency>

cv-data-controller/src/main/java/com/trihydro/cvdatacontroller/controller/ActiveTimController.java

Lines changed: 88 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.web.bind.annotation.RequestParam;
4242
import org.springframework.web.bind.annotation.RestController;
4343

44+
import org.springframework.web.client.HttpServerErrorException;
4445
import springfox.documentation.annotations.ApiIgnore;
4546
import us.dot.its.jpo.ode.plugin.j2735.timstorage.FrameType.TravelerInfoType;
4647

@@ -74,9 +75,8 @@ public void InjectDependencies(TimDbTables _timDbTables, SQLNullHandler _sqlNull
7475
* @return List of ActiveTim objects
7576
*/
7677
@RequestMapping(value = "/expiring", method = RequestMethod.GET, produces = "application/json", headers = "Accept=application/json")
77-
public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() throws SQLException {
78-
TimUpdateModel activeTim;
79-
List<TimUpdateModel> activeTims = new ArrayList<TimUpdateModel>();
78+
public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() {
79+
List<TimUpdateModel> activeTims = new ArrayList<>();
8080

8181
String selectStatement = "SELECT atim.*, tt.type as tim_type_name, tt.description as tim_type_description";
8282
selectStatement += ", t.msg_cnt, t.url_b, t.is_satellite, t.sat_record_id, t.packet_id";
@@ -100,72 +100,18 @@ public ResponseEntity<List<TimUpdateModel>> GetExpiringActiveTims() throws SQLEx
100100
try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
101101
// convert to ActiveTim object
102102
while (rs.next()) {
103-
activeTim = new TimUpdateModel();
104-
105-
// Active_Tim properties
106-
activeTim.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
107-
activeTim.setTimId(rs.getLong("TIM_ID"));
108-
activeTim.setDirection(rs.getString("DIRECTION"));
109-
activeTim.setStartDateTime(rs.getString("TIM_START"));
110-
activeTim.setEndDateTime(rs.getString("TIM_END"));
111-
activeTim.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
112-
activeTim.setSatRecordId(rs.getString("SAT_RECORD_ID"));
113-
activeTim.setClientId(rs.getString("CLIENT_ID"));
114-
activeTim.setRoute(rs.getString("ROUTE"));
115-
116-
Coordinate startPoint = null;
117-
Coordinate endPoint = null;
118-
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
119-
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
120-
if (!rs.wasNull()) {
121-
startPoint = new Coordinate(startLat, startLon);
122-
}
123-
activeTim.setStartPoint(startPoint);
124-
125-
BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
126-
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
127-
if (!rs.wasNull()) {
128-
endPoint = new Coordinate(endLat, endLon);
129-
}
130-
activeTim.setEndPoint(endPoint);
131-
132-
activeTim.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
133-
activeTim.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));
134-
135-
// Tim properties
136-
activeTim.setMsgCnt(rs.getInt("MSG_CNT"));
137-
activeTim.setUrlB(rs.getString("URL_B"));
138-
activeTim.setPacketId(rs.getString("PACKET_ID"));
139-
140-
// Tim Type properties
141-
activeTim.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
142-
activeTim.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));
143-
144-
// Region Properties
145-
activeTim.setRegionId(rs.getInt("REGION_ID"));
146-
activeTim.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
147-
activeTim.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));
148-
149-
activeTim.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
150-
activeTim.setRegionDirection(rs.getString("REGION_DIRECTION"));
151-
activeTim.setDirectionality(rs.getString("DIRECTIONALITY"));
152-
activeTim.setClosedPath(rs.getBoolean("CLOSED_PATH"));
153-
activeTim.setPathId(rs.getInt("PATH_ID"));
154-
activeTim.setRegionDescription(rs.getString("REGION_DESCRIPTION"));
155-
156-
// DataFrame properties
157-
activeTim.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
158-
activeTim.setDurationTime(rs.getInt("DURATION_TIME"));
159-
activeTim.setNotUsed1((short) 0); // as of J2735 this should be set to 0 and is ignored
160-
activeTim.setNotUsed((short) 0); // as of J2735 this should be set to 0 and is ignored
161-
activeTim.setNotUsed3((short) 0); // as of J2735 this should be set to 0 and is ignored
162-
activeTim.setNotUsed2((short) 0); // as of J2735 this should be set to 0 and is ignored
163-
activeTim.setUrl(rs.getString("URL"));
103+
var activeTim = buildTimUpdateModelFromResultSet(rs);
164104

165105
int frameTypeValue = rs.getInt("FRAME_TYPE");
166106
if (!rs.wasNull() && frameTypeValue >= 0 && frameTypeValue < TravelerInfoType.values().length) {
167107
activeTim.setFrameType(TravelerInfoType.values()[frameTypeValue]);
168108
}
109+
else {
110+
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue,
111+
activeTim.getActiveTimId());
112+
// assume advisory
113+
activeTim.setFrameType(TravelerInfoType.advisory);
114+
}
169115

170116
// set dataFrame content. it's required for the ODE, so if we didn't record it,
171117
// assume Advisory
@@ -210,72 +156,18 @@ public ResponseEntity<TimUpdateModel> GetUpdateModelFromActiveTimId(@PathVariabl
210156
try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
211157
// convert to ActiveTim object
212158
while (rs.next()) {
213-
activeTim = new TimUpdateModel();
214-
215159
// Active_Tim properties
216-
activeTim.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
217-
activeTim.setTimId(rs.getLong("TIM_ID"));
218-
activeTim.setDirection(rs.getString("DIRECTION"));
219-
activeTim.setStartDateTime(rs.getString("TIM_START"));
220-
activeTim.setEndDateTime(rs.getString("TIM_END"));
221-
activeTim.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
222-
activeTim.setSatRecordId(rs.getString("SAT_RECORD_ID"));
223-
activeTim.setClientId(rs.getString("CLIENT_ID"));
224-
activeTim.setRoute(rs.getString("ROUTE"));
225-
226-
Coordinate startPoint = null;
227-
Coordinate endPoint = null;
228-
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
229-
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
230-
if (!rs.wasNull()) {
231-
startPoint = new Coordinate(startLat, startLon);
232-
}
233-
activeTim.setStartPoint(startPoint);
234-
235-
BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
236-
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
237-
if (!rs.wasNull()) {
238-
endPoint = new Coordinate(endLat, endLon);
239-
}
240-
activeTim.setEndPoint(endPoint);
241-
242-
activeTim.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
243-
activeTim.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));
244-
245-
// Tim properties
246-
activeTim.setMsgCnt(rs.getInt("MSG_CNT"));
247-
activeTim.setUrlB(rs.getString("URL_B"));
248-
activeTim.setPacketId(rs.getString("PACKET_ID"));
249-
250-
// Tim Type properties
251-
activeTim.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
252-
activeTim.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));
253-
254-
// Region Properties
255-
activeTim.setRegionId(rs.getInt("REGION_ID"));
256-
activeTim.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
257-
activeTim.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));
258-
259-
activeTim.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
260-
activeTim.setRegionDirection(rs.getString("REGION_DIRECTION"));
261-
activeTim.setDirectionality(rs.getString("DIRECTIONALITY"));
262-
activeTim.setClosedPath(rs.getBoolean("CLOSED_PATH"));
263-
activeTim.setPathId(rs.getInt("PATH_ID"));
264-
activeTim.setRegionDescription(rs.getString("REGION_DESCRIPTION"));
265-
266-
// DataFrame properties
267-
activeTim.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
268-
activeTim.setDurationTime(rs.getInt("DURATION_TIME"));
269-
activeTim.setNotUsed1((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
270-
activeTim.setNotUsed((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
271-
activeTim.setNotUsed3((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
272-
activeTim.setNotUsed2((short) 0); // as of J2735 2020 this should be set to 0 and is ignored
273-
activeTim.setUrl(rs.getString("URL"));
160+
activeTim = buildTimUpdateModelFromResultSet(rs);
274161

275162
int frameTypeValue = rs.getInt("FRAME_TYPE");
276163
if (!rs.wasNull() && frameTypeValue >= 0 && frameTypeValue < TravelerInfoType.values().length) {
277164
activeTim.setFrameType(TravelerInfoType.values()[frameTypeValue]);
278165
}
166+
else {
167+
log.warn("Could not set frame type from value {} for active tim id {}. Assuming Advisory.", frameTypeValue, activeTimId);
168+
// assume advisory
169+
activeTim.setFrameType(TravelerInfoType.advisory);
170+
}
279171

280172
// set dataFrame content. it's required for the ODE, so if we didn't record it,
281173
// assume Advisory
@@ -373,22 +265,19 @@ public ResponseEntity<List<ActiveTim>> GetActiveTimsNotSent() {
373265
return ResponseEntity.ok(activeTims);
374266
}
375267

376-
@RequestMapping(value = "/expired", method = RequestMethod.GET)
377-
public ResponseEntity<List<ActiveTim>> GetExpiredActiveTims() {
378-
List<ActiveTim> activeTims = new ArrayList<ActiveTim>();
379-
380-
String selectStatement = "select * from ACTIVE_TIM";
381-
selectStatement += " WHERE TIM_END <= (NOW() AT TIME ZONE 'UTC')";
382-
383-
try (Connection connection = dbInteractions.getConnectionPool(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(selectStatement)) {
384-
activeTims = getActiveTimFromRS(rs, false);
385-
} catch (SQLException e) {
386-
log.error("Error getting expired active tims", e);
387-
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(activeTims);
388-
}
389-
390-
return ResponseEntity.ok(activeTims);
391-
}
268+
@RequestMapping(value = "/expired", method = RequestMethod.GET)
269+
public ResponseEntity<List<ActiveTim>> GetExpiredActiveTims(@RequestParam(required = false, defaultValue = "100") Integer limit) {
270+
String query = "SELECT * FROM ACTIVE_TIM WHERE TIM_END <= (NOW() AT TIME ZONE 'UTC') LIMIT ?";
271+
try (Connection connection = dbInteractions.getConnectionPool(); PreparedStatement preparedStatement = connection.prepareStatement(query)) {
272+
preparedStatement.setInt(1, limit);
273+
try (ResultSet rs = preparedStatement.executeQuery()) {
274+
return ResponseEntity.ok(getActiveTimFromRS(rs, false));
275+
}
276+
} catch (SQLException e) {
277+
log.error("Error retrieving expired active tims", e);
278+
throw new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "Error retrieving expired active tims");
279+
}
280+
}
392281

393282
@RequestMapping(value = "/indices-rsu/{rsuTarget}", method = RequestMethod.GET)
394283
public ResponseEntity<List<Integer>> GetActiveTimIndicesByRsu(@PathVariable String rsuTarget) {
@@ -1134,4 +1023,63 @@ public ResponseEntity<Boolean> MarkForDeletion(@PathVariable Long activeTimId) {
11341023
}
11351024
return ResponseEntity.ok(success);
11361025
}
1026+
1027+
private TimUpdateModel buildTimUpdateModelFromResultSet(ResultSet rs) throws SQLException {
1028+
TimUpdateModel timUpdateModel = new TimUpdateModel();
1029+
timUpdateModel.setActiveTimId(rs.getLong("ACTIVE_TIM_ID"));
1030+
timUpdateModel.setTimId(rs.getLong("TIM_ID"));
1031+
timUpdateModel.setDirection(rs.getString("DIRECTION"));
1032+
timUpdateModel.setStartDateTime(rs.getString("TIM_START"));
1033+
timUpdateModel.setEndDateTime(rs.getString("TIM_END"));
1034+
timUpdateModel.setExpirationDateTime(rs.getString("EXPIRATION_DATE"));
1035+
timUpdateModel.setSatRecordId(rs.getString("SAT_RECORD_ID"));
1036+
timUpdateModel.setClientId(rs.getString("CLIENT_ID"));
1037+
timUpdateModel.setRoute(rs.getString("ROUTE"));
1038+
1039+
Coordinate startPoint = null;
1040+
Coordinate endPoint = null;
1041+
BigDecimal startLat = rs.getBigDecimal("START_LATITUDE");
1042+
BigDecimal startLon = rs.getBigDecimal("START_LONGITUDE");
1043+
if (!rs.wasNull()) {
1044+
startPoint = new Coordinate(startLat, startLon);
1045+
}
1046+
timUpdateModel.setStartPoint(startPoint);
1047+
1048+
BigDecimal endLat = rs.getBigDecimal("END_LATITUDE");
1049+
BigDecimal endLon = rs.getBigDecimal("END_LONGITUDE");
1050+
if (!rs.wasNull()) {
1051+
endPoint = new Coordinate(endLat, endLon);
1052+
}
1053+
timUpdateModel.setEndPoint(endPoint);
1054+
1055+
timUpdateModel.setStartDate_Timestamp(rs.getTimestamp("TIM_START", UTCCalendar));
1056+
timUpdateModel.setEndDate_Timestamp(rs.getTimestamp("TIM_END", UTCCalendar));
1057+
1058+
// Tim properties
1059+
timUpdateModel.setMsgCnt(rs.getInt("MSG_CNT"));
1060+
timUpdateModel.setUrlB(rs.getString("URL_B"));
1061+
timUpdateModel.setPacketId(rs.getString("PACKET_ID"));
1062+
1063+
// Tim Type properties
1064+
timUpdateModel.setTimTypeName(rs.getString("TIM_TYPE_NAME"));
1065+
timUpdateModel.setTimTypeDescription(rs.getString("TIM_TYPE_DESCRIPTION"));
1066+
1067+
// Region Properties
1068+
timUpdateModel.setRegionId(rs.getInt("REGION_ID"));
1069+
timUpdateModel.setAnchorLat(rs.getBigDecimal("ANCHOR_LAT"));
1070+
timUpdateModel.setAnchorLong(rs.getBigDecimal("ANCHOR_LONG"));
1071+
1072+
timUpdateModel.setLaneWidth(rs.getBigDecimal("LANE_WIDTH"));
1073+
timUpdateModel.setRegionDirection(rs.getString("REGION_DIRECTION"));
1074+
timUpdateModel.setDirectionality(rs.getString("DIRECTIONALITY"));
1075+
timUpdateModel.setClosedPath(rs.getBoolean("CLOSED_PATH"));
1076+
timUpdateModel.setPathId(rs.getInt("PATH_ID"));
1077+
timUpdateModel.setRegionDescription(rs.getString("REGION_DESCRIPTION"));
1078+
1079+
// DataFrame properties
1080+
timUpdateModel.setDataFrameId(rs.getInt("DATA_FRAME_ID"));
1081+
timUpdateModel.setDurationTime(rs.getInt("DURATION_TIME"));
1082+
timUpdateModel.setUrl(rs.getString("URL"));
1083+
return timUpdateModel;
1084+
}
11371085
}

0 commit comments

Comments
 (0)