Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Maintainer Class Reference

List of all members.

Detailed Description

Administrator (privileged) access to the data base, for job submission & retrieval.

Author:
Jon & Susanna Butterworth $date$ $version$

Definition at line 32 of file Maintainer.java.


Public Member Functions

void init (ServletConfig config) throws ServletException
void destroy ()
String getServletInfo ()

Protected Member Functions

void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException

Member Function Documentation

void destroy  ) 
 

Destroys the servlet. Does nothing.

Definition at line 58 of file Maintainer.java.

00058                           {
00059     }

void doGet HttpServletRequest  request,
HttpServletResponse  response
throws ServletException, java.io.IOException [protected]
 

Handles the HTTP GET method.

Parameters:
request servlet request
response servlet response

Definition at line 65 of file Maintainer.java.

References HTMLWriter.close(), MCProcessType.delete(), HTMLWriter.endForm(), PlotSelection.fitIsEmpty(), PlotSelection.setFitDefault(), PlotSelection.setSumDefault(), HTMLWriter.startControlForm(), MCProcessType.store(), PlotSelection.sumIsEmpty(), and HTMLFitWriter.writeFitEditForm().

Referenced by Maintainer.doPost().

00067                                                  {
00068 
00069     String servletPath = JetWebConfig.mainServletPath;
00070 
00071     String title = "Control Screen";
00072     response.setContentType("text/html");
00073     PrintWriter out = response.getWriter();
00074     ResultSearchPattern pattern; 
00075     PlotSelection selection;
00076     
00077 
00078     JetWebConfig.setPrintWriter(out);
00079 
00080     // Build a search pattern from the page.
00081     try {
00082         // Methods not requiring a pattern or a selection
00083         if ((request.getParameter("MORERESULTS")!=null)){
00084 
00085         boolean verbose = Boolean.parseBoolean(request.getParameter("VERBOSE"));
00086         boolean modifiable = Boolean.parseBoolean(request.getParameter("MODIFIABLE"));
00087         HTMLUtils.displayListContinued(out,servletPath,verbose,modifiable,
00088                            request.getParameter("RESULTKEY"));
00089         return;
00090         }
00091 
00092         pattern = ServletUtils.makePattern(request);
00093 
00094         // Build a paper selection from the page.
00095         selection = ServletUtils.makePlotSelection(request);
00096         if (selection.fitIsEmpty()) { selection.setFitDefault(); }
00097         if (selection.sumIsEmpty()) { selection.setSumDefault(); }
00098         
00099         System.out.println("ACCESS FROM: "+request.getRemoteHost()+" = "+request.getRemoteAddr());
00100         String requestingHost = request.getRemoteHost();
00101         System.out.println(request.getContentType());
00102 
00103         Enumeration enmrt = request.getParameterNames();
00104         while (enmrt.hasMoreElements()){
00105         System.out.println("-----");
00106         System.out.println((String)enmrt.nextElement());
00107         System.out.println("-----");
00108         }   
00109         
00110         if (request.getParameter("CONFIG") != null) {
00111         // Submit a job (first pass) //////////////////////
00112         ServletUtils.updateConfig(request);
00113         HTMLUtils.writeControlScreen(" ",pattern,selection,out,servletPath);
00114         return;
00115 
00116         } else if ((request.getParameter("SUBMITFITEDIT") != null)) {
00117         System.out.println("Submitted edit request");
00118         ServletUtils.editFit(request,out,servletPath);
00119         return;
00120 
00121         } else if ((request.getParameter("PROCESSTYPE") != null)) {
00122         System.out.println("ProcessType management");
00123         // Write out all the MCProcessTypes, modifiable
00124         List<MCProcessType> list = new Vector<MCProcessType>();
00125         // Write out all the MCProcessTypes.
00126         list.addAll(MCProcessType.getAll(false));
00127         HTMLUtils.displayList(out,servletPath,true,true,list);
00128         return;
00129 
00130         } else if ((request.getParameter("MODIFYPROC") != null)) {
00131         System.out.println("Modifying ProcessType");
00132         MCProcessType proc = ServletUtils.buildProc(request);
00133         proc.store();
00134         // Write out all the MCProcessTypes, modifiable
00135         List<MCProcessType> list = new Vector<MCProcessType>();
00136         // Write out all the MCProcessTypes.
00137         list.addAll(MCProcessType.getAll(false));
00138         HTMLUtils.displayList(out,servletPath,true,true,list);
00139         return;
00140 
00141         } else if ((request.getParameter("DELETEPROC") != null)) {
00142         System.out.println("Deleting ProcessType");
00143         MCProcessType proc 
00144             = new MCProcessType(Integer.parseInt(request.getParameter("PROCESSID")));
00145         proc.delete();
00146         // Write out all the MCProcessTypes, modifiable
00147         List<MCProcessType> list = new Vector<MCProcessType>();
00148         // Write out all the MCProcessTypes.
00149         list.addAll(MCProcessType.getAll(false));
00150         HTMLUtils.displayList(out,servletPath,true,true,list);
00151         return;
00152         
00153         } else if ( (request.getParameter("FITID") != null) &&
00154             (!request.getParameter("FITID").trim().equals("")) 
00155             && request.getParameter("FITFIX")!=null) {
00156 
00157         String fitId = request.getParameter("FITID");
00158         HTMLFitWriter op = new HTMLFitWriter(out,servletPath);
00159 
00160         op.startControlForm("<p>Editing fit number "
00161                     +fitId
00162                     +" <em>If you are not an expert, go away!</em></p>");
00163         
00164         op.writeFitEditForm(fitId);
00165         op.endForm();
00166         op.close();
00167         return;
00168         
00169         } else  if ((request.getParameter("CHANGEPAPER") != null)) {
00170         // Modify or add a paper //////////////////////////////////////////
00171         ServletUtils.changePaper(request,out);
00172         HTMLPaperWriter.writePaperScreen(request.getParameter("PAPERID"),out,servletPath);
00173         return;
00174 
00175         } else  if ((request.getParameter("DELETEPAPER") != null)) {
00176         // Modify or add a paper //////////////////////////////////////////
00177         ServletUtils.deletePaper(request);
00178         HTMLUtils.writeControlScreen("Paper deleted",pattern,selection,out,servletPath);
00179         return;
00180         
00181         } else  if ((request.getParameter("PAPERID") != null)
00182                 && ( !request.getParameter("PAPERID").trim().equals(""))&& request.getParameter("PAPERMOD")!=null) {
00183         // Modify or add a paper //////////////////////////////////////////
00184         HTMLPaperWriter.writePaperScreen(request.getParameter("PAPERID"),out,servletPath);
00185         return;
00186         
00187         } else  if ((request.getParameter("PAPERADD") != null)) {
00188         // Modify or add a paper //////////////////////////////////////////
00189         HTMLPaperWriter.writePaperScreen(request.getParameter("PAPERID"),out,servletPath);
00190         return;
00191         
00192         } else  if ((request.getParameter("PROCESSNEW") != null)) {
00193         // Assimilate any new results //////////////////////////////////////////////
00194         JobUtils.updateJobs();
00195         HTMLUtils.writeControlScreen("Successfully run new results.",
00196                         pattern,selection,out,servletPath);
00197         return;
00198         }else if (request.getParameter("DEFAULTSMOD") != null){
00199         ServletUtils.generatorDefaults(request);
00200         HTMLUtils.writeControlScreen("Successfully updated Jetweb database",
00201                         pattern,selection,out,servletPath);
00202 
00203         System.out.println("Value of XMLDEFAULTS is "+request.getParameter("XMLDEFAULTS"));
00204 
00205         return;
00206 
00207         } else  if ((request.getParameter("FINISHED") != null)) {
00208         // Modify or add a paper //////////////////////////////////////////
00209         HTMLUtils.writeControlScreen(" ",pattern,selection,out,servletPath);
00210         return;
00211         
00212         } else if ((request.getParameter("CANCEL") != null)) {
00213         // Cancel. //////////////////////////////////////////////
00214         pattern  = new ResultSearchPattern();
00215         selection= new PlotSelection();
00216         HTMLUtils.writeControlScreen("Cancelled operation",
00217                         pattern,selection,out,servletPath);
00218         return;
00219         
00220         } else if ((request.getParameter("SEARCH") != null)) {
00221         // Search //////////////////////////////////////////////
00222         HTMLUtils.writeQueryScreen(" ",pattern,selection,out,JetWebConfig.searchServletPath);
00223         return;
00224         
00225         } else if ((request.getParameter("PENDING") != null)) {
00226         HTMLUtils.listPendingJobs(out,servletPath);
00227         return;
00228         
00229         } else {
00230         // If we get here, just write a new control page.
00231         HTMLUtils.writeControlScreen(" ",pattern,selection,out,servletPath);
00232         }
00233 
00234     } catch (JetWebException e){
00235         HTMLErrorWriter.write(out,e);
00236         return;
00237     }
00238 
00239 
00240     }

void doPost HttpServletRequest  request,
HttpServletResponse  response
throws ServletException, java.io.IOException [protected]
 

Handles the HTTP POST method.

Parameters:
request servlet request
response servlet response

Definition at line 245 of file Maintainer.java.

References Maintainer.doGet().

00246                                                  {
00247         doGet(request,response);
00248     }

String getServletInfo  ) 
 

Returns a short description of the servlet.

Definition at line 252 of file Maintainer.java.

00252                                    {
00253         return "Test servlet. Do not use.";
00254     }

void init ServletConfig  config  )  throws ServletException
 

Initializes the servlet, does DB configuration, gets DB connection.

Parameters:
ServletConfig 
Exceptions:
ServletException 

Definition at line 40 of file Maintainer.java.

00040                                                                    {
00041         super.init(config);
00042 
00043     // Set up configuration with servlet mode on. 
00044     JetWebConfig.init();
00045 
00046     // Read in all papers from the database.
00047     try {
00048         PaperBank.getConfig();
00049     } catch (JetWebException e){
00050         System.out.println(e.getMessage());
00051         e.printStackTrace(System.out);
00052     }
00053     }


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007