Skip to content

Commit

Permalink
correctly handle certain optional SOAP message fields
Browse files Browse the repository at this point in the history
- Criteria.Version
- P2PService.SymetricPath
- P2PService.SourceSTP
- P2PService.DestSTP
  • Loading branch information
hanstrompert committed Sep 17, 2024
1 parent adead3c commit 6f0532f
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser
LOG.fine(String.format("global reservation ID %s", globalReservationId));
LOG.fine(String.format("description %s", description));
LOG.fine(String.format("service type %s", soapCriteria.getServiceType()));
LOG.fine(String.format("version %d", soapCriteria.getVersion()));
if (soapCriteria.getVersion() != null)
LOG.fine(String.format("version %d", soapCriteria.getVersion()));

try {
Header pbHeader = toProtobuf(soapHeader.value);
Expand All @@ -369,20 +370,22 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser

// ReservationRequestCriteria
ReservationRequestCriteria.Builder pbReservationRequestCriteriaBuilder = ReservationRequestCriteria
.newBuilder().setVersion(soapCriteria.getVersion());
.newBuilder();
if (soapCriteria.getVersion() != null)
pbReservationRequestCriteriaBuilder.setVersion(soapCriteria.getVersion());

// Schedule
if (soapCriteria.getSchedule() != null) {
Schedule.Builder pbScheduleBuilder = Schedule.newBuilder();
if (soapCriteria.getSchedule().getStartTime() != null) {
LOG.fine(String.format("start time %s", soapCriteria.getSchedule().getStartTime()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
LOG.fine(String.format("end time %s", soapCriteria.getSchedule().getEndTime()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
pbScheduleBuilder.setStartTime(Timestamps.parse(soapCriteria.getSchedule().getStartTime()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
}
if (soapCriteria.getSchedule().getEndTime() != null) {
LOG.fine(String.format("end time %s", soapCriteria.getSchedule().getEndTime()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
pbScheduleBuilder.setEndTime(Timestamps.parse(soapCriteria.getSchedule().getEndTime()
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
}
Expand Down Expand Up @@ -422,15 +425,19 @@ public void reserve(javax.xml.ws.Holder<String> connectionId, String globalReser
pbP2PServiceBuilder.setDirectionality(directionality);
}

/* TODO Need to test each of the following SOAP elements for null. As some might not be set
/* Need to test each of the following SOAP elements for null. As some might not be set
in case of an Reserve message update. An update generally only specifies a subset. Eg
the initial Reservation included the wrong bandwidth. The update Reserve message will then
only specifies the bandwidth (with the correct value).
*/
LOG.fine(String.format("source STP %s", soapP2PService.getSourceSTP()));
LOG.fine(String.format("destination STP %s", soapP2PService.getDestSTP()));
pbP2PServiceBuilder.setSymmetricPath(soapP2PService.isSymmetricPath())
.setSourceStp(soapP2PService.getSourceSTP()).setDestStp(soapP2PService.getDestSTP());
if (soapP2PService.isSymmetricPath() != null)
pbP2PServiceBuilder.setSymmetricPath(soapP2PService.isSymmetricPath());
if (soapP2PService.getSourceSTP() != null)
pbP2PServiceBuilder.setSourceStp(soapP2PService.getSourceSTP());
if (soapP2PService.getDestSTP() != null)
pbP2PServiceBuilder.setDestStp(soapP2PService.getDestSTP());

if (soapP2PService.getEro() != null) {
List<OrderedStpType> soapOrderedSTP = soapP2PService.getEro().getOrderedSTP();
Expand Down

0 comments on commit 6f0532f

Please sign in to comment.