Issue #2110 RequestRouter.route(req) changed the class returned.

Change-Id: I720402a177850a4ca798719aaace8bf3a42e552f

Former-commit-id: f3a1c68d40 [formerly f3a1c68d40 [formerly cda40b66492abf6a0064d28484b03e05500f7bed]]
Former-commit-id: 4443dfd11a
Former-commit-id: 7c7b1264d1
This commit is contained in:
Roger Ferrel 2013-06-18 16:09:48 -05:00
parent 73c0514c3d
commit b9244cb214

View file

@ -25,6 +25,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dissemination.OUPRequest; import com.raytheon.uf.common.dissemination.OUPRequest;
import com.raytheon.uf.common.dissemination.OUPResponse; import com.raytheon.uf.common.dissemination.OUPResponse;
@ -51,6 +52,8 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* May 10, 2012 14715 rferrel Initial creation * May 10, 2012 14715 rferrel Initial creation
* Mar 21, 2013 15375 zhao Modified to also handle AvnFPS VFT product * Mar 21, 2013 15375 zhao Modified to also handle AvnFPS VFT product
* Jun 07, 2013 1981 mpduff Add user to OUPRequest. * Jun 07, 2013 1981 mpduff Add user to OUPRequest.
* Jun 18, 2013 2110 rferrel Modified to handle the new class RequestRouter.route
* returns (SuccessfulExecution).
* *
* </pre> * </pre>
* *
@ -187,43 +190,51 @@ public class TafQueueManager implements Runnable {
OUPRequest req = new OUPRequest(); OUPRequest req = new OUPRequest();
req.setUser(new User(OUPRequest.EDEX_ORIGINATION)); req.setUser(new User(OUPRequest.EDEX_ORIGINATION));
req.setProduct(oup); req.setProduct(oup);
OUPResponse resp; OUPResponse resp = null;
boolean success = false; boolean success = false;
String additionalInfo = ""; String additionalInfo = "";
try { try {
resp = (OUPResponse) RequestRouter.route(req); Object object = RequestRouter.route(req);
success = resp.isSendLocalSuccess(); if (!(object instanceof SuccessfulExecution)) {
if (resp.hasFailure()) { statusHandler.handle(Priority.ERROR,
// check which kind of failure "Error transferring Official User Product. Unexpected response class: "
Priority p = Priority.EVENTA; + object.getClass().getName());
if (!resp.isAttempted()) { } else {
// if was never attempted to send or store even locally resp = (OUPResponse) ((SuccessfulExecution) object)
p = Priority.CRITICAL; .getResponse();
additionalInfo = "ERROR local store never attempted"; success = resp.isSendLocalSuccess();
} else if (!resp.isSendLocalSuccess()) { if (resp.hasFailure()) {
// if send/store locally failed // check which kind of failure
p = Priority.CRITICAL; Priority p = Priority.EVENTA;
additionalInfo = "ERROR store locally failed"; if (!resp.isAttempted()) {
} else if (!resp.isSendWANSuccess()) { // if was never attempted to send or store even locally
// if send to WAN failed
if (resp.getNeedAcknowledgment()) {
// if ack was needed, if it never sent then no ack
// was received
p = Priority.CRITICAL; p = Priority.CRITICAL;
additionalInfo = "ERROR send to WAN failed and no acknowledgment received"; additionalInfo = "ERROR local store never attempted";
} else { } else if (!resp.isSendLocalSuccess()) {
// if no ack was needed // if send/store locally failed
p = Priority.EVENTA; p = Priority.CRITICAL;
additionalInfo = "WARNING send to WAN failed"; additionalInfo = "ERROR store locally failed";
} else if (!resp.isSendWANSuccess()) {
// if send to WAN failed
if (resp.getNeedAcknowledgment()) {
// if ack was needed, if it never sent then no ack
// was received
p = Priority.CRITICAL;
additionalInfo = "ERROR send to WAN failed and no acknowledgment received";
} else {
// if no ack was needed
p = Priority.EVENTA;
additionalInfo = "WARNING send to WAN failed";
}
} else if (resp.getNeedAcknowledgment()
&& !resp.isAcknowledged()) {
// if sent but not acknowledged when acknowledgment is
// needed
p = Priority.CRITICAL;
additionalInfo = "ERROR no acknowledgment received";
} }
} else if (resp.getNeedAcknowledgment() statusHandler.handle(p, resp.getMessage());
&& !resp.isAcknowledged()) {
// if sent but not acknowledged when acknowledgment is
// needed
p = Priority.CRITICAL;
additionalInfo = "ERROR no acknowledgment received";
} }
statusHandler.handle(p, resp.getMessage());
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);