From a978437a4da484b1456cc4898f346e60e3ca513d Mon Sep 17 00:00:00 2001 From: stellamit Date: Thu, 14 Jul 2011 15:15:02 +0000 Subject: [PATCH] updating checking of simplereasoner asynchronous mode --- .../SimpleReasonerRecomputeController.java | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SimpleReasonerRecomputeController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SimpleReasonerRecomputeController.java index 22c764afb..17dd2d8b0 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SimpleReasonerRecomputeController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/SimpleReasonerRecomputeController.java @@ -35,33 +35,30 @@ public class SimpleReasonerRecomputeController extends FreemarkerHttpServlet { 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."; + } 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 { String signal = (String) vreq.getParameter("signal"); - - if (simpleReasoner instanceof SimpleReasoner) { - - if (((SimpleReasoner)simpleReasoner).isRecomputing()) { - messageStr = - "The SimpleReasoner is currently in the process of " + - "recomputing inferences."; - } else{ - String restart = (String)getServletContext().getAttribute("restart"); - if(restart == null || restart.equals("showButton") || signal == null){ - body.put("link", "show"); - messageStr = null; - getServletContext().setAttribute("restart", "yes"); - } - else if(signal!=null && signal.equals("Recompute")){ - new Thread(new Recomputer(((SimpleReasoner)simpleReasoner))).start(); - 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"); - } + + if (((SimpleReasoner)simpleReasoner).isRecomputing()) { + messageStr = + "The SimpleReasoner is currently in the process of " + + "recomputing inferences."; + } else{ + String restart = (String)getServletContext().getAttribute("restart"); + if(restart == null || restart.equals("showButton") || signal == null){ + body.put("link", "show"); + messageStr = null; + getServletContext().setAttribute("restart", "yes"); + } + else if(signal!=null && signal.equals("Recompute")){ + new Thread(new Recomputer(((SimpleReasoner)simpleReasoner))).start(); + messageStr = "Recomputation of inferences started"; + getServletContext().setAttribute("restart", "showButton"); + } + } } } catch (Exception e) {