updating checking of simplereasoner asynchronous mode

This commit is contained in:
stellamit 2011-07-14 15:15:02 +00:00
parent 5a03e842be
commit a978437a4d

View file

@ -35,33 +35,30 @@ public class SimpleReasonerRecomputeController extends FreemarkerHttpServlet {
Object simpleReasoner = vreq.getSession().getServletContext().getAttribute(SimpleReasoner.class.getName()); Object simpleReasoner = vreq.getSession().getServletContext().getAttribute(SimpleReasoner.class.getName());
if ((simpleReasoner instanceof SimpleReasoner) && !((SimpleReasoner)simpleReasoner).isABoxReasoningAsynchronous()) { if (!(simpleReasoner instanceof SimpleReasoner)) {
messageStr = "No SimpleReasoner has been set up."; messageStr = "No SimpleReasoner has been set up.";
} else if ( ((SimpleReasoner)simpleReasoner).isABoxReasoningAsynchronous() ) {
messageStr = "mostSpecificType annotations are currently being computed and so a recompute can not be started. Please try again later.";
} else { } else {
String signal = (String) vreq.getParameter("signal"); String signal = (String) vreq.getParameter("signal");
if (simpleReasoner instanceof SimpleReasoner) { if (((SimpleReasoner)simpleReasoner).isRecomputing()) {
messageStr =
if (((SimpleReasoner)simpleReasoner).isRecomputing()) { "The SimpleReasoner is currently in the process of " +
messageStr = "recomputing inferences.";
"The SimpleReasoner is currently in the process of " + } else{
"recomputing inferences."; String restart = (String)getServletContext().getAttribute("restart");
} else{ if(restart == null || restart.equals("showButton") || signal == null){
String restart = (String)getServletContext().getAttribute("restart"); body.put("link", "show");
if(restart == null || restart.equals("showButton") || signal == null){ messageStr = null;
body.put("link", "show"); getServletContext().setAttribute("restart", "yes");
messageStr = null; }
getServletContext().setAttribute("restart", "yes"); else if(signal!=null && signal.equals("Recompute")){
} new Thread(new Recomputer(((SimpleReasoner)simpleReasoner))).start();
else if(signal!=null && signal.equals("Recompute")){ messageStr = "Recomputation of inferences started";
new Thread(new Recomputer(((SimpleReasoner)simpleReasoner))).start(); getServletContext().setAttribute("restart", "showButton");
messageStr = "Recomputation of inferences started"; }
getServletContext().setAttribute("restart", "showButton"); }
}
}
} else {
log.equals("The attribute with name " + SimpleReasoner.class.getName() + " is not an instance of SimpleReasoner");
}
} }
} catch (Exception e) { } catch (Exception e) {