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

Change-Id: I720402a177850a4ca798719aaace8bf3a42e552f

Former-commit-id: cda40b66492abf6a0064d28484b03e05500f7bed
This commit is contained in:
Roger Ferrel 2013-06-18 16:09:48 -05:00
parent c4283b0336
commit 4443dfd11a

View file

@ -25,6 +25,7 @@ import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dissemination.OUPRequest;
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
* Mar 21, 2013 15375 zhao Modified to also handle AvnFPS VFT product
* 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>
*
@ -187,43 +190,51 @@ public class TafQueueManager implements Runnable {
OUPRequest req = new OUPRequest();
req.setUser(new User(OUPRequest.EDEX_ORIGINATION));
req.setProduct(oup);
OUPResponse resp;
OUPResponse resp = null;
boolean success = false;
String additionalInfo = "";
try {
resp = (OUPResponse) RequestRouter.route(req);
success = resp.isSendLocalSuccess();
if (resp.hasFailure()) {
// check which kind of failure
Priority p = Priority.EVENTA;
if (!resp.isAttempted()) {
// if was never attempted to send or store even locally
p = Priority.CRITICAL;
additionalInfo = "ERROR local store never attempted";
} else if (!resp.isSendLocalSuccess()) {
// if send/store locally failed
p = Priority.CRITICAL;
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
Object object = RequestRouter.route(req);
if (!(object instanceof SuccessfulExecution)) {
statusHandler.handle(Priority.ERROR,
"Error transferring Official User Product. Unexpected response class: "
+ object.getClass().getName());
} else {
resp = (OUPResponse) ((SuccessfulExecution) object)
.getResponse();
success = resp.isSendLocalSuccess();
if (resp.hasFailure()) {
// check which kind of failure
Priority p = Priority.EVENTA;
if (!resp.isAttempted()) {
// if was never attempted to send or store even locally
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";
additionalInfo = "ERROR local store never attempted";
} else if (!resp.isSendLocalSuccess()) {
// if send/store locally failed
p = Priority.CRITICAL;
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()
&& !resp.isAcknowledged()) {
// if sent but not acknowledged when acknowledgment is
// needed
p = Priority.CRITICAL;
additionalInfo = "ERROR no acknowledgment received";
statusHandler.handle(p, resp.getMessage());
}
statusHandler.handle(p, resp.getMessage());
}
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);