From: John W. <jwe...@us...> - 2007-06-28 21:02:03
|
Update of /cvsroot/dlsciences/dlese-tools-project/src/org/dlese/dpc/dds/action In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv1820/src/org/dlese/dpc/dds/action Modified Files: DDSAdminAction.java DDSQueryAction.java Log Message: removed cvs $Id: directives for easier branching/merging Index: DDSQueryAction.java =================================================================== RCS file: /cvsroot/dlsciences/dlese-tools-project/src/org/dlese/dpc/dds/action/DDSQueryAction.java,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** DDSQueryAction.java 3 Nov 2006 01:00:11 -0000 1.121 --- DDSQueryAction.java 28 Jun 2007 21:01:54 -0000 1.122 *************** *** 1,1498 **** ! /** ! * Copyright 2002, 2003 DLESE Program Center/University Corporation for ! * Atmospheric Research (UCAR), P.O. Box 3000, Boulder, CO 80307, ! * su...@dl....<p> ! * ! * This file is part of the DLESE Discovery Project.<p> ! * ! * The DLESE Discovery Project 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 [...4463 lines suppressed...] ! /** ! ! * Print a line to error out. ! ! * ! ! * @param s The String to print. ! ! */ ! ! private static void prtlnErr( String s ) { ! ! System.err.println( "DDSQueryAction error: " + s ); ! ! } ! ! } ! ! ! Index: DDSAdminAction.java =================================================================== RCS file: /cvsroot/dlsciences/dlese-tools-project/src/org/dlese/dpc/dds/action/DDSAdminAction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DDSAdminAction.java 6 May 2005 23:39:18 -0000 1.6 --- DDSAdminAction.java 28 Jun 2007 21:01:54 -0000 1.7 *************** *** 1,143 **** ! ! /** ! * Copyright 2002, 2003 DLESE Program Center/University Corporation for Atmospheric Research (UCAR), P.O. Box ! * 3000, Boulder, CO 80307, su...@dl.... This file is part of the DLESE Discovery Project. The DLESE ! * Discovery Project 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. The DLESE Discovery Project 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 The DLESE System; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ ! ! package org.dlese.dpc.dds.action; ! ! import org.dlese.dpc.index.*; ! import org.dlese.dpc.dds.*; ! import org.dlese.dpc.dds.action.form.*; ! import org.dlese.dpc.vocab.*; ! import org.dlese.dpc.vocab.MetadataVocab; ! import org.dlese.dpc.repository.*; ! ! import java.util.*; ! import java.io.*; ! import java.util.Hashtable; ! import java.util.Locale; ! import javax.servlet.*; ! import javax.servlet.http.*; ! import org.apache.struts.action.Action; ! import org.apache.struts.action.ActionError; ! import org.apache.struts.action.ActionErrors; ! import org.apache.struts.action.ActionForm; ! import org.apache.struts.action.ActionForward; ! import org.apache.struts.action.ActionMapping; ! import org.apache.struts.action.ActionServlet; ! import org.apache.struts.util.MessageResources; ! ! /** ! * Implementation of <strong>Action</strong> that handles administration of the DDS. ! * ! * @author John Weatherley ! * @version $Id$ ! */ ! public final class DDSAdminAction extends Action { ! ! // --------------------------------------------------------- Public Methods ! ! /** ! * Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web ! * component that will create it). Return an <code>ActionForward</code> instance describing where and how ! * control should be forwarded, or <code>null</code> if the response has already been completed. ! * ! * @param mapping The ActionMapping used to select this instance ! * @param request The HTTP request we are processing ! * @param response The HTTP response we are creating ! * @param form The ActionForm for the given page ! * @return The ActionForward instance describing where and how control should be ! * forwarded ! * @exception IOException if an input/output error occurs ! * @exception ServletException if a servlet exception occurs ! */ ! public ActionForward execute( ! ActionMapping mapping, ! ActionForm form, ! HttpServletRequest request, ! HttpServletResponse response) ! throws IOException, ServletException { ! /* ! * Design note: ! * Only one instance of this class gets created for the app and shared by ! * all threads. To be thread-safe, use only local variables, not instance ! * variables (the JVM will handle these properly using the stack). Pass ! * all variables via method signatures rather than instance vars. ! */ ! // Extract attributes we will need ! //Locale locale = getLocale(request); ! //MessageResources messages = getResources(); ! ! ! RepositoryManager rm = ! (RepositoryManager) servlet.getServletContext().getAttribute("repositoryManager"); ! SimpleLuceneIndex index = ! (SimpleLuceneIndex) servlet.getServletContext().getAttribute("index"); ! MetadataVocab vocab = (MetadataVocab) servlet.getServletContext().getAttribute("MetadataVocab"); ! ! DDSAdminForm adminForm = (DDSAdminForm) form; ! ! adminForm.setIndex(index); ! adminForm.setMetadataVocab(vocab); ! ! String paramVal = null; ! try { ! ! // Handle admin actions: ! if (request.getParameter("command") != null) { ! paramVal = request.getParameter("command"); ! ! if (paramVal.equals("Update index")) { ! rm.indexFiles(null,false); ! adminForm.setShowNumChanged(true); ! adminForm.setMessage( ! DDSServlet.getDateStamp() + ! ". Discovery is synchronizing it's index with the metadata files..."); ! return mapping.findForward("admin.index"); ! } ! if (paramVal.equals("Start File Tester")) { ! adminForm.setMessage("Stoped moving files"); ! //fileIndexingService.startTester(servlet.getServletContext().getRealPath("/")); ! return mapping.findForward("admin.index"); ! } ! if (paramVal.equals("Stop File Tester")) { ! adminForm.setMessage("Stoped moving files"); ! //fileIndexingService.stopTester(); ! return mapping.findForward("admin.index"); ! } ! } ! ! // No recognizable param existed: ! else if (request.getParameterNames().hasMoreElements()) { ! adminForm.setMessage("The request is not valid in this context."); ! return mapping.findForward("admin.index"); ! } ! ! // If there were no parameters at all: ! return mapping.findForward("admin.index"); ! } catch (Throwable t) { ! adminForm.setMessage("There was a server problem: " + t.getMessage()); ! return mapping.findForward("admin.index"); ! } ! ! } ! ! ! /** ! * DESCRIPTION ! * ! * @param s DESCRIPTION ! */ ! private void prtln(String s) { ! System.out.println(s); ! } ! } ! --- 1,284 ---- ! ! ! /** ! ! * Copyright 2002, 2003 DLESE Program Center/University Corporation for Atmospheric Research (UCAR), P.O. Box ! ! * 3000, Boulder, CO 80307, su...@dl.... This file is part of the DLESE Discovery Project. The DLESE ! ! * Discovery Project 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. The DLESE Discovery Project 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 The DLESE System; if not, write to the Free Software ! ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! ! */ ! ! ! ! package org.dlese.dpc.dds.action; ! ! ! ! import org.dlese.dpc.index.*; ! ! import org.dlese.dpc.dds.*; ! ! import org.dlese.dpc.dds.action.form.*; ! ! import org.dlese.dpc.vocab.*; ! ! import org.dlese.dpc.vocab.MetadataVocab; ! ! import org.dlese.dpc.repository.*; ! ! ! ! import java.util.*; ! ! import java.io.*; ! ! import java.util.Hashtable; ! ! import java.util.Locale; ! ! import javax.servlet.*; ! ! import javax.servlet.http.*; ! ! import org.apache.struts.action.Action; ! ! import org.apache.struts.action.ActionError; ! ! import org.apache.struts.action.ActionErrors; ! ! import org.apache.struts.action.ActionForm; ! ! import org.apache.struts.action.ActionForward; ! ! import org.apache.struts.action.ActionMapping; ! ! import org.apache.struts.action.ActionServlet; ! ! import org.apache.struts.util.MessageResources; ! ! ! ! /** ! ! * Implementation of <strong>Action</strong> that handles administration of the DDS. ! ! * ! ! * @author John Weatherley ! ! */ ! ! public final class DDSAdminAction extends Action { ! ! ! ! // --------------------------------------------------------- Public Methods ! ! ! ! /** ! ! * Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web ! ! * component that will create it). Return an <code>ActionForward</code> instance describing where and how ! ! * control should be forwarded, or <code>null</code> if the response has already been completed. ! ! * ! ! * @param mapping The ActionMapping used to select this instance ! ! * @param request The HTTP request we are processing ! ! * @param response The HTTP response we are creating ! ! * @param form The ActionForm for the given page ! ! * @return The ActionForward instance describing where and how control should be ! ! * forwarded ! ! * @exception IOException if an input/output error occurs ! ! * @exception ServletException if a servlet exception occurs ! ! */ ! ! public ActionForward execute( ! ! ActionMapping mapping, ! ! ActionForm form, ! ! HttpServletRequest request, ! ! HttpServletResponse response) ! ! throws IOException, ServletException { ! ! /* ! ! * Design note: ! ! * Only one instance of this class gets created for the app and shared by ! ! * all threads. To be thread-safe, use only local variables, not instance ! ! * variables (the JVM will handle these properly using the stack). Pass ! ! * all variables via method signatures rather than instance vars. ! ! */ ! ! // Extract attributes we will need ! ! //Locale locale = getLocale(request); ! ! //MessageResources messages = getResources(); ! ! ! ! ! ! RepositoryManager rm = ! ! (RepositoryManager) servlet.getServletContext().getAttribute("repositoryManager"); ! ! SimpleLuceneIndex index = ! ! (SimpleLuceneIndex) servlet.getServletContext().getAttribute("index"); ! ! MetadataVocab vocab = (MetadataVocab) servlet.getServletContext().getAttribute("MetadataVocab"); ! ! ! ! DDSAdminForm adminForm = (DDSAdminForm) form; ! ! ! ! adminForm.setIndex(index); ! ! adminForm.setMetadataVocab(vocab); ! ! ! ! String paramVal = null; ! ! try { ! ! ! ! // Handle admin actions: ! ! if (request.getParameter("command") != null) { ! ! paramVal = request.getParameter("command"); ! ! ! ! if (paramVal.equals("Update index")) { ! ! rm.indexFiles(null,false); ! ! adminForm.setShowNumChanged(true); ! ! adminForm.setMessage( ! ! DDSServlet.getDateStamp() + ! ! ". Discovery is synchronizing it's index with the metadata files..."); ! ! return mapping.findForward("admin.index"); ! ! } ! ! if (paramVal.equals("Start File Tester")) { ! ! adminForm.setMessage("Stoped moving files"); ! ! //fileIndexingService.startTester(servlet.getServletContext().getRealPath("/")); ! ! return mapping.findForward("admin.index"); ! ! } ! ! if (paramVal.equals("Stop File Tester")) { ! ! adminForm.setMessage("Stoped moving files"); ! ! //fileIndexingService.stopTester(); ! ! return mapping.findForward("admin.index"); ! ! } ! ! } ! ! ! ! // No recognizable param existed: ! ! else if (request.getParameterNames().hasMoreElements()) { ! ! adminForm.setMessage("The request is not valid in this context."); ! ! return mapping.findForward("admin.index"); ! ! } ! ! ! ! // If there were no parameters at all: ! ! return mapping.findForward("admin.index"); ! ! } catch (Throwable t) { ! ! adminForm.setMessage("There was a server problem: " + t.getMessage()); ! ! return mapping.findForward("admin.index"); ! ! } ! ! ! ! } ! ! ! ! ! ! /** ! ! * DESCRIPTION ! ! * ! ! * @param s DESCRIPTION ! ! */ ! ! private void prtln(String s) { ! ! System.out.println(s); ! ! } ! ! } ! ! ! |