Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 30 Dec 2005 14:31:16 -0000 1.1 @@ -0,0 +1,111 @@ +/* *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License + *along with this program; if not, write to the Free Software + *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + *USA + * + *http://www.gnu.org/licenses/gpl.txt + */ +package org.lamsfoundation.lams.tool.mc.web; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.mc.McAppConstants; +import org.lamsfoundation.lams.tool.mc.McApplicationException; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; + +/** + * * @author Ozgur Demirtas + * + *
Action class that controls the logic of tool behavior.
+ * + *Note that Struts action class only has the responsibility to navigate + * page flow. All database operation should go to service layer and data + * transformation from domain model to struts form bean should go to form + * bean class. This ensure clean and maintainable code. + *
+ * + *SystemException
is thrown whenever an known error condition is
+ * identified. No system exception error handling code should appear in the
+ * Struts action class as all of them are handled in
+ * CustomStrutsExceptionHandler.
+ *
+*/
+public class McMonitoringAction extends LamsDispatchAction implements McAppConstants
+{
+ static Logger logger = Logger.getLogger(McMonitoringAction.class.getName());
+
+ /**
+ * Default struts dispatch method.
+ *
+ * It is assuming that progress engine should pass in the tool access
+ * mode and the tool session id as http parameters.
+ *
+ * @param mapping An ActionMapping class that will be used by the Action class to tell
+ * the ActionServlet where to send the end-user.
+ *
+ * @param form The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param request A standard Servlet HttpServletRequest class.
+ * @param response A standard Servlet HttpServletResponse class.
+ * @return An ActionForward class that will be returned to the ActionServlet indicating where
+ * the user is to go next.
+ * @throws IOException
+ * @throws ServletException
+ * @throws McApplicationException the known runtime exception
+ *
+ * unspecified(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+
+ * main content/question content management and workflow logic
+ *
+ */
+ public ActionForward unspecified(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ McMonitoringForm mcMonitoringForm = (McMonitoringForm) form;
+ return null;
+ }
+
+
+ /**
+ * persists error messages to request scope
+ * @param request
+ * @param message
+ */
+ public void persistError(HttpServletRequest request, String message)
+ {
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY, new ActionMessage(message));
+ logger.debug("add " + message +" to ActionMessages:");
+ saveErrors(request,errors);
+ }
+}
+
\ No newline at end of file