Index: src/edu/ucsb/nceas/metacat/workflow/WorkflowEngineClient.java
===================================================================
--- src/edu/ucsb/nceas/metacat/workflow/WorkflowEngineClient.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/workflow/WorkflowEngineClient.java	(nonexistent)
@@ -1,49 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that implements system utility methods 
- *  Copyright: 2008 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
- * '$Revision: 4854 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.workflow;
-
-import java.util.Hashtable;
-
-import org.apache.log4j.Logger;
-
-public class WorkflowEngineClient implements WorkflowClientInterface {
-
-	private static Logger logMetacat = Logger.getLogger(WorkflowEngineClient.class);
-	
-	public void execute(String workflowName, Hashtable<String, String> additionalParams) {
-		// do execution stuff here
-	}
-	
-	public String getStatus(String workflowId) {
-		String statusXML = "";
-		
-		// do status stuff here
-		
-		return statusXML;
-	}
-
- }

Property changes on: src/edu/ucsb/nceas/metacat/workflow/WorkflowEngineClient.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/workflow/WorkflowClientInterface.java
===================================================================
--- src/edu/ucsb/nceas/metacat/workflow/WorkflowClientInterface.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/workflow/WorkflowClientInterface.java	(nonexistent)
@@ -1,43 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that loads eml-access.xml file containing ACL 
- *             for a metadata document into relational DB
- *  Copyright: 2000 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Jivka Bojilova
- *
- *   '$Author: daigle $'
- *     '$Date: 2009-03-25 14:04:06 -0800 (Wed, 25 Mar 2009) $'
- * '$Revision: 4863 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.workflow;
-
-import java.util.Hashtable;
-
-/**
- * This interface will handle the access control for different documents:
- * the package-orented, single eml2 document and other single file
- */
-public interface WorkflowClientInterface
-{
-
-	public void execute(String workflowName, Hashtable<String, String> additionalParams);
-	
-	public String getStatus(String workflowId); 
- 
-}

Property changes on: src/edu/ucsb/nceas/metacat/workflow/WorkflowClientInterface.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/util/ErrorUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/ErrorUtil.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/util/ErrorUtil.java	(nonexistent)
@@ -1,137 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that implements administrative methods 
- *  Copyright: 2008 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2008-08-22 16:26:10 -0700 (Fri, 22 Aug 2008) $'
- * '$Revision: 4299 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.util;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-
-public class ErrorUtil {
-	
-	private static Logger logMetacat = Logger.getLogger(RequestUtil.class);
-	
-	// 101XXX - general errors
-	public static Long GENERAL_UTILITY_ERROR = new Long(101001);	
-	public static Long METACAT_UTILITY_ERROR = new Long(101002);
-	// 104XXX - property errors
-	public static Long PROPERTY_NOT_FOUND = new Long(104001);	
-	// 105XXX - permission errors
-	public static Long NO_READ_PERMISSION = new Long(105001);
-	
-	// errorCodes is a lookup table for generic messages for each code.  It
-	// is better to use the sendError() versions that accept an explicit 
-	// error message;
-	static Hashtable<Long, String> errorCodes = new Hashtable<Long, String>();
-	static {
-		errorCodes.put(GENERAL_UTILITY_ERROR, "General utility error");
-		errorCodes.put(METACAT_UTILITY_ERROR, "Metacat utility error");
-		errorCodes.put(PROPERTY_NOT_FOUND, "Property not found");
-		errorCodes.put(NO_READ_PERMISSION, "Read permission denied for user");
-	}
-	
-	/**
-	 * private constructor - all methods are static so there is no
-     * no need to instantiate.
-	 */
-	private ErrorUtil() {}
-	
-	public static void sendError(HttpServletResponse response, Long errorCode, String errorMessage) 
-		throws ErrorSendingErrorException {
-		
-		PrintWriter out = null;
-		try {
-			out = response.getWriter();			
-			response.setContentType("text/xml");
-		
-			out.println("<?xml version=\"1.0\"?>");
-			out.println("<error>");
-			out.println("<code>" + errorCode + "</code>");
-			out.println("<message>" + errorMessage + "</message>");
-			out.println("</error>");
-		
-		} catch (IOException ioe) {
-			throw new ErrorSendingErrorException("I/O error when returning error: " 
-					+ errorCode + " : " + errorMessage);
-		} finally {
-			if (out != null) {
-				out.close();
-			}
-		}
-	}
-	
-	public static void sendError(HttpServletResponse response, Long errorCode) 
-		throws ErrorSendingErrorException {
-		
-		PrintWriter out = null;
-		try {
-			out = response.getWriter();	
-			response.setContentType("text/xml");
-		
-			out.println("<?xml version=\"1.0\"?>");
-			out.println("<error>");
-			out.println("<code>" + errorCode + "</code>");
-			out.println("<message>" + errorCodes.get(errorCode) + "</message>");
-			out.println("</error>");
-		
-		} catch (IOException ioe) {
-			throw new ErrorSendingErrorException("I/O error when returning error: " 
-					+ errorCode);
-		} finally {
-			if (out != null) {
-				out.close();
-			}
-		} out.close();
-	}
-	
-	public static void sendError(HttpServletResponse response, PrintWriter out,
-			Long errorCode, String errorMessage) throws ErrorSendingErrorException {
-
-		response.setContentType("text/xml");
-
-		out.println("<?xml version=\"1.0\"?>");
-		out.println("<error>");
-		out.println("<code>" + errorCode + "</code>");
-		out.println("<message>" + errorMessage + "</message>");
-		out.println("</error>");
-	}
-
-	public static void sendError(HttpServletResponse response, PrintWriter out,
-			Long errorCode) throws ErrorSendingErrorException {
-
-		response.setContentType("text/xml");
-
-		out.println("<?xml version=\"1.0\"?>");
-		out.println("<error>");
-		out.println("<code>" + errorCode + "</code>");
-		out.println("<message>" + errorCodes.get(errorCode) + "</message>");
-		out.println("</error>");
-	}
-}

Property changes on: src/edu/ucsb/nceas/metacat/util/ErrorUtil.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobInterface.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobInterface.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobInterface.java	(nonexistent)
@@ -1,38 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that runs a single scheduled report task 
- *  Copyright: 2009 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
- * '$Revision: 4854 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.scheduler;
-
-import org.quartz.InterruptableJob;
-
-public interface ScheduledJobInterface extends InterruptableJob {
-	
-	public static String STATE_SCHEDULED = "scheduled";
-	public static String STATE_EXECUTING = "executing";
-	public static String STATE_UNSHCEDULED = "unscheduled";	
-	public static String STATE_DELETED = "deleted";
-	
-}

Property changes on: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobInterface.java
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsAccess.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsAccess.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsAccess.java	(nonexistent)
@@ -1,101 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that manages database access of scheduled task 
- *             information.
- *  Copyright: 2009 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
- * '$Revision: 4854 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.scheduler;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import org.apache.log4j.Logger;
-
-import edu.ucsb.nceas.shared.AccessException;
-import edu.ucsb.nceas.shared.BaseAccess;
-
-public class ScheduledJobParamsAccess extends BaseAccess {
-	
-	private Logger logMetacat = Logger.getLogger(ScheduledJobParamsAccess.class);
-	
-	public ScheduledJobParamsAccess() throws AccessException {
-		super("ScheduledJobParamsAccess");
-	}
-	
-	protected void createJobParams(Long jobId, Hashtable<String, String> jobParams) throws AccessException {
-		Enumeration<String> paramKeys = jobParams.keys();
-		
-		while(paramKeys.hasMoreElements()) {
-			String paramKey = paramKeys.nextElement();
-			
-			ScheduledJobParamsDAO jobParamsDAO = new ScheduledJobParamsDAO();
-			jobParamsDAO.setStatus(ScheduledJobInterface.STATE_SCHEDULED);
-			jobParamsDAO.setJobId(jobId);
-			jobParamsDAO.setKey(paramKey);
-			jobParamsDAO.setValue(jobParams.get(paramKey));
-			
-			try {
-				String sql = 
-					"INSERT INTO scheduled_job_params (date_created, date_updated, status, job_id, key, value) " 
-					+ "VALUES(now(), now(), ?, ?, ?, ?)";		
-				PreparedStatement pstmt = conn.prepareStatement(sql);
-			
-				pstmt.setString(1, jobParamsDAO.getStatus());
-				pstmt.setLong(2, jobParamsDAO.getJobId());
-				pstmt.setString(3, jobParamsDAO.getKey());
-				pstmt.setString(4, jobParamsDAO.getValue());
-				
-				logMetacat.info("SQL createJobParams - " + sql);
-				logMetacat.info("SQL params:  [" + jobParamsDAO.getStatus() + ","
-						+ jobParamsDAO.getJobId() + ","
-						+ jobParamsDAO.getKey() + ","
-						+ jobParamsDAO.getValue().toString() + "]");
-				pstmt.execute();
-				
-			} catch (SQLException sqle) {
-				// Just throw the exception.  The ScheduledJobAccess class should handle cleanup.
-				throw new AccessException("ScheduledJobParamsAccess.createJobParams - SQL error when creating scheduled job parameter : "    
-					 + sqle.getMessage());
-			}
-		}
-	}
-	
-	protected void deleteJobParams(Long jobId) throws AccessException {
-		try {
-			String sql = "UPDATE scheduled_job_params SET status = ? WHERE jobId = ?";		
-			pstmt.setString(1, ScheduledJobInterface.STATE_DELETED);
-			pstmt.setLong(1, jobId);
-			
-			logMetacat.info("SQL deleteJobParams - " + sql);
-
-			pstmt.execute();
-		} catch (SQLException sqle) {
-			throw new AccessException("ScheduledJobParamsAccess.deleteJobParams - SQL error " 
-					+ "when deleting scheduled job params for job" + jobId  + " : "  + sqle.getMessage());
-		}	
-		
-	}	
-}
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsDAO.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsDAO.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamsDAO.java	(nonexistent)
@@ -1,61 +0,0 @@
-/**
- *  '$RCSfile$'
- *    Purpose: A Class that holds the data from the scheduled_task 
- *             table in the database. 
- *  Copyright: 2009 Regents of the University of California and the
- *             National Center for Ecological Analysis and Synthesis
- *    Authors: Michael Daigle
- * 
- *   '$Author: daigle $'
- *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
- * '$Revision: 4854 $'
- *
- * 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
- */
-
-package edu.ucsb.nceas.metacat.scheduler;
-
-import edu.ucsb.nceas.shared.BaseDAO;
-
-public class ScheduledJobParamsDAO extends BaseDAO {
-
-	private Long _jobId;
-	private String _key;
-	private String _value;
-	
-	public Long getJobId() {
-		return _jobId;
-	}
-	
-	public void setJobId(Long jobId) {
-		_jobId = jobId;
-	}
-	
-	public String getKey() {
-		return _key;
-	}
-	
-	public void setKey(String key) {
-		_key = key;
-	}
-	
-	public String getValue() {
-		return _value;
-	}
-	
-	public void setValue(String value) {
-		_value = value;
-	}
-}
\ No newline at end of file
Index: src/edu/ucsb/nceas/shared/AccessException.java
===================================================================
--- src/edu/ucsb/nceas/shared/AccessException.java	(revision 4958)
+++ src/edu/ucsb/nceas/shared/AccessException.java	(revision 4959)
@@ -31,7 +31,7 @@
  * Exception thrown when an error occurs in a configuration administrative
  * class
  */
-public class AccessException extends Exception {
+public class AccessException extends BaseException {
 	
 	private static final long serialVersionUID = -8436697355629175917L;
 
@@ -43,4 +43,8 @@
 	public AccessException(String message) {
 		super(message);
 	}
+	
+	public AccessException(String message, BaseException deeperException) {
+		super(message, deeperException);
+	}
 }
Index: src/edu/ucsb/nceas/shared/BaseException.java
===================================================================
--- src/edu/ucsb/nceas/shared/BaseException.java	(nonexistent)
+++ src/edu/ucsb/nceas/shared/BaseException.java	(revision 4959)
@@ -0,0 +1,71 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: An Exception thrown when an error occurs because an 
+ *             AccessionNumber was invalid or used incorrectly
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$Author: daigle $'
+ *     '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
+ * '$Revision: 4080 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.shared;
+
+/**
+ * Exception thrown when an error occurs in a configuration administrative
+ * class
+ */
+public class BaseException extends Exception {
+
+
+	private static final long serialVersionUID = 1331212806605660813L;
+	
+	private static String _coreMessage;
+	
+	/**
+	 * Create a new AccessException.
+	 *
+	 * @param message The error or warning message.
+	 */
+	public BaseException(String message) {
+		super(message);
+		_coreMessage = message;
+	}
+	
+	/**
+	 * Create a new BaseException.
+	 *
+	 * @param message The error or warning message.
+	 */
+	public BaseException(String message, BaseException deeperException) {
+		super(message + " --> " + deeperException.getMessage());
+		_coreMessage = deeperException.getCoreMessage();
+	}
+	
+	public String getCoreMessage() {
+		return _coreMessage;
+	}
+	
+	public void setCoreMessage(String coreMessage) {
+		_coreMessage = coreMessage;
+	}
+	
+
+
+}

Property changes on: src/edu/ucsb/nceas/shared/BaseException.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/edu/ucsb/nceas/shared/BaseAccess.java
===================================================================
--- src/edu/ucsb/nceas/shared/BaseAccess.java	(revision 4958)
+++ src/edu/ucsb/nceas/shared/BaseAccess.java	(revision 4959)
@@ -27,7 +27,6 @@
 
 package edu.ucsb.nceas.shared;
 
-import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
@@ -34,11 +33,10 @@
 import edu.ucsb.nceas.metacat.DBConnection;
 import edu.ucsb.nceas.metacat.DBConnectionPool;
 
-public class BaseAccess {
+public abstract class BaseAccess {
 	
 	protected DBConnection conn = null;
     protected int serialNumber = -1;
-    protected PreparedStatement pstmt = null;
     protected ResultSet rs = null;
 	
     protected BaseAccess(String methodName) throws AccessException {
@@ -53,15 +51,5 @@
     	}
     }
     
-    protected ResultSet select(PreparedStatement pstmt) throws AccessException {
-    	try {
-    		pstmt.execute();
-        	rs = pstmt.getResultSet();
-    	} catch (SQLException sqle) {
-    		throw new AccessException("Could not perform select: " + pstmt.toString()
-    				+ sqle.getMessage());
-    	}
-    	
-    	return rs;
-    }
+    protected abstract BaseDAO populateDAO(ResultSet resultSet) throws SQLException ;
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/ArchiveHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/ArchiveHandler.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/ArchiveHandler.java	(revision 4959)
@@ -36,7 +36,6 @@
 
 import edu.ucsb.nceas.metacat.service.PropertyService;
 import edu.ucsb.nceas.metacat.util.ErrorSendingErrorException;
-import edu.ucsb.nceas.metacat.util.ErrorUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtilException;
 import edu.ucsb.nceas.metacat.util.ResponseUtil;
 import edu.ucsb.nceas.utilities.FileUtil;
@@ -108,7 +107,7 @@
             	if (!DocumentImpl.hasReadPermission(user, groups, docid)) {
             		String errorString = "User " + user + " does not have permission"
     					+ " to read the document with the docid " + docid;
-            		ErrorUtil.sendError(response, ErrorUtil.NO_READ_PERMISSION, errorString);
+            		ResponseUtil.sendErrorXML(response, ResponseUtil.NO_READ_PERMISSION, errorString);
             		return;
             	}
             } catch (McdbException mcdbe) {
@@ -151,17 +150,17 @@
         } catch (UtilException ue) {
         	String errorString = "Utility error reading archive entry for docid: " 
     			+ docid + " : " + ue.getMessage();
-        	ErrorUtil.sendError(response, ErrorUtil.GENERAL_UTILITY_ERROR, errorString);
+        	ResponseUtil.sendErrorXML(response, ResponseUtil.GENERAL_UTILITY_ERROR, errorString);
         	throw new ErrorHandledException(null);
         } catch (PropertyNotFoundException pnfe) {
         	String errorString = "Property error reading archive entry for docid: " 
         		+ docid + " : " + pnfe.getMessage();
-        	ErrorUtil.sendError(response, ErrorUtil.PROPERTY_NOT_FOUND, errorString);
+        	ResponseUtil.sendErrorXML(response, ResponseUtil.PROPERTY_NOT_FOUND, errorString);
         	throw new ErrorHandledException(null);
         } catch (MetacatUtilException mue) {
         	String errorString = "Metacat utility error reading archive entry for docid: " 
         		+ docid + " : " + mue.getMessage();
-        	ErrorUtil.sendError(response, ErrorUtil.METACAT_UTILITY_ERROR, errorString);
+        	ResponseUtil.sendErrorXML(response, ResponseUtil.METACAT_UTILITY_ERROR, errorString);
         	throw new ErrorHandledException(null);
         } 
 	}
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 4959)
@@ -90,8 +90,11 @@
 import edu.ucsb.nceas.metacat.util.MetacatUtil;
 import edu.ucsb.nceas.metacat.util.MetacatUtilException;
 import edu.ucsb.nceas.metacat.util.RequestUtil;
+import edu.ucsb.nceas.metacat.util.ResponseUtil;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
 import edu.ucsb.nceas.metacat.util.SessionData;
+import edu.ucsb.nceas.metacat.workflow.WorkflowScheduler;
+import edu.ucsb.nceas.shared.BaseException;
 import edu.ucsb.nceas.utilities.FileUtil;
 import edu.ucsb.nceas.utilities.GeneralPropertyException;
 import edu.ucsb.nceas.utilities.PropertyNotFoundException;
@@ -154,6 +157,7 @@
 	private static final long serialVersionUID = 1L;
 	private Timer timer = null;
     private static boolean sitemapScheduled;
+    private static boolean firstHalfInitialized = false;
     private static boolean fullyInitialized = false;
     
     // Constants -- these should be final in a servlet
@@ -175,6 +179,10 @@
     public void init(ServletConfig config) throws ServletException {
     	Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
     	try {
+    		if(firstHalfInitialized) {
+    			return;
+    		}
+    		
             super.init(config);
             
             ServletContext context = config.getServletContext();
@@ -200,6 +208,8 @@
             	return;
             }  
             
+            firstHalfInitialized = true;
+            
             initSecondHalf(context);
             
     	} catch (ServiceException se) {
@@ -865,16 +875,33 @@
 					// MetacatAdminServlet
 					ServiceService.refreshService("XMLSchemaService");
 					return;
-				} else if (action.equals("schedule")) {
-					SchedulerService.getInstance().scheduleHandler(params, request, response, 
-							userName, groupNames);
-					return;
+				} else if (action.equals("scheduleWorkflow")) {
+					try {
+						String resultString = 
+							WorkflowScheduler.getInstance().scheduleJob(params, request, response, 
+								userName, groupNames);
+						ResponseUtil.sendSuccessXML(response, resultString);
+						return;
+					} catch (BaseException be) {
+						ResponseUtil.sendErrorXML(response, ResponseUtil.SCHEDULE_WORKFLOW_ERROR, be);
+						return;						
+					}
+				} else if (action.equals("getScheduledWorkflow")) {
+					try {
+						String resultString = 
+							WorkflowScheduler.getInstance().getJobs(params, request, response, 
+								userName, groupNames);
+						ResponseUtil.sendSuccessXML(response, resultString);
+						return;
+					} catch (BaseException be) {
+						ResponseUtil.sendErrorXML(response, ResponseUtil.SCHEDULE_WORKFLOW_ERROR, be);
+						return;						
+					}
 				} else {
 					PrintWriter out = response.getWriter();
 					out.println("<?xml version=\"1.0\"?>");
 					out.println("<error>");
-					out
-							.println("Error: action not registered.  Please report this error.");
+					out.println("Error: action not registered.  Please report this error.");
 					out.println("</error>");
 					out.close();
 				}
@@ -909,7 +936,7 @@
 		} catch (ErrorHandledException ehe) {
 			// Nothing to do here.  We assume if we get here, the error has been 
 			// written to ouput.  Continue on and let it display.
-		}
+		} 
 	}
     
 	
Index: src/edu/ucsb/nceas/metacat/service/ServiceException.java
===================================================================
--- src/edu/ucsb/nceas/metacat/service/ServiceException.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/service/ServiceException.java	(revision 4959)
@@ -27,11 +27,13 @@
 
 package edu.ucsb.nceas.metacat.service;
 
+import edu.ucsb.nceas.shared.BaseException;
+
 /**
  * Exception thrown when an error occurs in a configuration administrative
  * class
  */
-public class ServiceException extends Exception {
+public class ServiceException extends BaseException {
 	
 	private static final long serialVersionUID = -2982801310798091071L;
 
@@ -43,4 +45,8 @@
 	public ServiceException(String message) {
 		super(message);
 	}
+	
+	public ServiceException(String message, BaseException deeperException) {
+		super(message, deeperException);
+	}
 }
Index: src/edu/ucsb/nceas/metacat/workflow/WorkflowJob.java
===================================================================
--- src/edu/ucsb/nceas/metacat/workflow/WorkflowJob.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/workflow/WorkflowJob.java	(revision 4959)
@@ -25,14 +25,31 @@
  */
 package edu.ucsb.nceas.metacat.workflow;
 
+import java.util.Calendar;
+
+import org.apache.log4j.Logger;
+
+import org.quartz.InterruptableJob;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 
-import edu.ucsb.nceas.metacat.scheduler.ScheduledJobInterface;
+import edu.ucsb.nceas.utilities.FileUtil;
+import edu.ucsb.nceas.utilities.UtilException;
 
-public class WorkflowJob implements ScheduledJobInterface {
+public class WorkflowJob implements InterruptableJob {
 	
+	private static Logger logMetacat = Logger.getLogger(WorkflowJob.class);
+	
 	public void execute(JobExecutionContext context) throws JobExecutionException {
+		try {
+			FileUtil.createFile("/tmp/worflowJob.txt");
+			FileUtil.writeFile("/tmp/worflowJob.txt", Calendar.getInstance().getTime().toString());			
+		} catch (UtilException ue) {
+			String errorstr = "Util Exception writing to file" + ue.getMessage();
+			logMetacat.error(errorstr);
+			throw new JobExecutionException(errorstr);
+		}
+	
 	}
 	
 	public void interrupt() {
Index: src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java	(revision 4959)
@@ -0,0 +1,153 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that handles scheduling tasks 
+ *  Copyright: 2009 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$Author: daigle $'
+ *     '$Date: 2009-03-25 13:41:15 -0800 (Wed, 25 Mar 2009) $'
+ * '$Revision: 4861 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.workflow;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.scheduler.BaseScheduler;
+import edu.ucsb.nceas.metacat.scheduler.SchedulerService;
+import edu.ucsb.nceas.metacat.scheduler.MetacatSchedulerException;
+import edu.ucsb.nceas.metacat.service.ServiceException;
+
+public class WorkflowScheduler extends BaseScheduler {
+	
+	private static WorkflowScheduler workflowScheduler = null;
+	
+	private static Logger logMetacat = Logger.getLogger(WorkflowScheduler.class);
+	
+	private static String SCHEDULED_JOB_GROUP = "workflow";
+	private static String SCHEDULED_JOB_CLASS = "edu.ucsb.nceas.metacat.workflow.WorkflowJob";
+
+	/**
+	 * private constructor since this is a singleton
+	 */
+	private WorkflowScheduler()  {}
+	
+	/**
+	 * Get the single instance of SchedulerService.
+	 * 
+	 * @return the single instance of SchedulerService
+	 */
+	public static WorkflowScheduler getInstance() {
+		if (workflowScheduler == null) {
+			workflowScheduler = new WorkflowScheduler();
+		}
+		return workflowScheduler;
+	}
+	
+	public String scheduleJob(Hashtable<String, String[]> params,
+			HttpServletRequest request, HttpServletResponse response, String username,
+			String[] groups) throws MetacatSchedulerException {
+		
+		String delays[] = params.get("delay");
+		String startTimes[] = params.get("starttime");
+		HashMap<String, String> jobParams = new HashMap<String, String>();
+		Calendar startCal = null;
+
+		try {
+			SchedulerService schedulerService = SchedulerService.getInstance();
+
+			if (delays != null && delays.length > 0) {
+				startCal = schedulerService.getStartDateFromDelay(delays[0]);
+			} else if (startTimes != null && startTimes.length > 0) {
+				Date startDate = DateFormat.getInstance().parse(startTimes[0]);
+				startCal = Calendar.getInstance();
+				startCal.setTime(startDate);
+			} else {
+				// if delay and starttime were not provided, set date to now.
+				startCal = Calendar.getInstance();
+			}
+
+			String intervals[] = params.get("interval");
+			if (intervals == null || intervals.length == 0) {
+				throw new MetacatSchedulerException(
+						"SchedulerService.scheduleHandler - Interval field must be populated "
+								+ "in scheduler parameters when scheduling job.");
+			}
+			String interval = intervals[0];
+
+			Enumeration<String> paramNames = params.keys();
+			while (paramNames.hasMoreElements()) {
+				String paramName = paramNames.nextElement();
+				if (paramName.startsWith("jobparam_")) {
+					jobParams.put(paramName.substring(9), params.get(paramName)[0]);
+				}
+			}
+
+			String jobName = SCHEDULED_JOB_GROUP
+					+ Calendar.getInstance().getTimeInMillis();
+
+			return schedulerService.scheduleJob(jobName, startCal, interval,
+					SCHEDULED_JOB_CLASS, SCHEDULED_JOB_GROUP, jobParams);
+		} catch (ParseException pe) {
+			throw new MetacatSchedulerException("WorkflowScheduler.scheduleHandler - Could not " + "schedule job  : " 
+					+ pe.getMessage());
+		} catch (ServiceException se) {
+			throw new MetacatSchedulerException("WorkflowScheduler.scheduleHandler - Service issue scheduling job", se);
+		}
+	}
+	
+	public String unScheduleJob(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException {
+		return "";
+	}
+	
+	public String deleteJob(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException {
+		return "";
+	}
+	
+	public String getJobs(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException {
+		
+		String groupName = null;
+		String groupNames[] = params.get("groupName");
+		if (groupNames != null && groupNames.length != 0) {
+			groupName = groupNames[0];
+		}
+		
+		try {
+			return SchedulerService.getInstance().getJobsInfoXML(groupName);
+		} catch (ServiceException se) {
+			throw new MetacatSchedulerException("WorkflowScheduler.getJobs - Service issue getting jobs", se);
+		}		
+	}	
+}

Property changes on: src/edu/ucsb/nceas/metacat/workflow/WorkflowScheduler.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/util/ResponseUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/util/ResponseUtil.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/util/ResponseUtil.java	(revision 4959)
@@ -31,6 +31,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Hashtable;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -37,10 +39,33 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.shared.BaseException;
 import edu.ucsb.nceas.utilities.FileUtil;
 
 public class ResponseUtil {
 	
+	// 101XXX - general errors
+	public static Long GENERAL_UTILITY_ERROR = new Long(101001);	
+	public static Long METACAT_UTILITY_ERROR = new Long(101002);
+	// 104XXX - property errors
+	public static Long PROPERTY_NOT_FOUND = new Long(104001);	
+	// 105XXX - permission errors
+	public static Long NO_READ_PERMISSION = new Long(105001);
+	// 130XXX - scheduler errors
+	public static Long SCHEDULE_WORKFLOW_ERROR = new Long(130001);
+	
+	// errorCodes is a lookup table for generic messages for each code.  It
+	// is better to use the sendError() versions that accept an explicit 
+	// error message;
+	static Hashtable<Long, String> errorCodes = new Hashtable<Long, String>();
+	static {
+		errorCodes.put(GENERAL_UTILITY_ERROR, "General utility error");
+		errorCodes.put(METACAT_UTILITY_ERROR, "Metacat utility error");
+		errorCodes.put(PROPERTY_NOT_FOUND, "Property not found");
+		errorCodes.put(NO_READ_PERMISSION, "Read permission denied for user");
+		errorCodes.put(SCHEDULE_WORKFLOW_ERROR, "Schedule workflow error");
+	}
+	
 	private static Logger logMetacat = Logger.getLogger(ResponseUtil.class);
 	
 	private static int DEFAULT_BUFFER_SIZE = 4 * 1024; // 4K buffer
@@ -103,4 +128,80 @@
 					+ "  to output");
 		}
 	}
+	
+	public static void sendErrorXML(HttpServletResponse response, Long errorCode,
+			BaseException be) throws ErrorSendingErrorException {
+
+		logMetacat.error(errorCodes.get(errorCode) + " : " + be.getMessage());
+
+		PrintWriter out = null;
+		try {
+			out = response.getWriter();
+			response.setContentType("text/xml");
+
+			out.println("<?xml version=\"1.0\"?>");
+			out.println("<error>");
+			out.println("<code>" + errorCode + "</code>");
+			out.println("<defaultMessage>" + errorCodes.get(errorCode) + "</defaultMessage>");
+			out.println("<coreMessage>" + be.getCoreMessage() + "</coreMessage>");
+			out.println("<chainedMessage>" + be.getMessage() + "</chainedMessage>");
+			out.println("</error>");
+
+		} catch (IOException ioe) {
+			throw new ErrorSendingErrorException("I/O error when returning error: "
+					+ errorCode + " : " + ioe.getMessage());
+		} finally {
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
+	
+	public static void sendErrorXML(HttpServletResponse response, Long errorCode,
+			String message) throws ErrorSendingErrorException {
+
+		logMetacat.error(errorCodes.get(errorCode) + " : " + message);
+
+		PrintWriter out = null;
+		try {
+			out = response.getWriter();
+			response.setContentType("text/xml");
+
+			out.println("<?xml version=\"1.0\"?>");
+			out.println("<error>");
+			out.println("<code>" + errorCode + "</code>");
+			out.println("<defaultMessage>" + errorCodes.get(errorCode) + "</defaultMessage>");
+			out.println("<coreMessage>" + message + "</coreMessage>");
+			out.println("<chainedMessage></chainedMessage>");
+			out.println("</error>");
+
+		} catch (IOException ioe) {
+			throw new ErrorSendingErrorException("I/O error when returning error: "
+					+ errorCode + " : " + ioe.getMessage());
+		} finally {
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
+	
+	public static void sendSuccessXML(HttpServletResponse response, String message) 
+		throws ErrorSendingErrorException {
+
+		PrintWriter out = null;
+		try {
+			out = response.getWriter();
+			response.setContentType("text/xml");
+
+			out.println("<?xml version=\"1.0\"?>");
+			out.println("<success>" + message + "</success>");
+		} catch (IOException ioe) {
+			throw new ErrorSendingErrorException("I/O error when returning success XML: "
+					+ message + " : " + ioe.getMessage());
+		} finally {
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
 }
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobDAO.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobDAO.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobDAO.java	(revision 4959)
@@ -28,6 +28,7 @@
 package edu.ucsb.nceas.metacat.scheduler;
 
 import java.sql.Timestamp;
+import java.util.HashMap;
 
 import edu.ucsb.nceas.shared.BaseDAO;
 
@@ -45,7 +46,9 @@
 	private String _groupName;
 	private String _className;
 	private Timestamp _startTime;
-	private int _interval;
+	private int _intervalValue;
+	private String _intervalUnit;
+	private HashMap<String, ScheduledJobParamDAO> _jobParams = new HashMap<String, ScheduledJobParamDAO>();
 	
 	public String getName() {
 		return _name;
@@ -87,11 +90,31 @@
 		_startTime = startTime;
 	}
 	
-	public int getInterval() {
-		return _interval;
+	public int getIntervalValue() {
+		return _intervalValue;
 	}
 	
-	public void setInterval(int interval) {
-		_interval = interval;
+	public void setIntervalValue(int intervalValue) {
+		_intervalValue = intervalValue;
 	}
+	
+	public String getIntervalUnit() {
+		return _intervalUnit;
+	}
+	
+	public void setIntervalUnit(String intervalUnit) {
+		_intervalUnit = intervalUnit;
+	}
+	
+	public ScheduledJobParamDAO getJobParam(String key) {
+		return _jobParams.get(key);
+	}
+	
+	public HashMap<String, ScheduledJobParamDAO> getAllJobParams() {
+		return _jobParams;
+	}
+	
+	public void addJobParam(ScheduledJobParamDAO jobParamDAO) {
+		_jobParams.put(jobParamDAO.getKey(), jobParamDAO);
+	}
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/scheduler/SchedulerService.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/SchedulerService.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/SchedulerService.java	(revision 4959)
@@ -26,21 +26,15 @@
 
 package edu.ucsb.nceas.metacat.scheduler;
 
-import java.text.DateFormat;
-import java.text.ParseException;
 import java.util.Arrays;
 import java.util.Calendar;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.Vector;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.log4j.Logger;
 
 import org.quartz.Job;
+import org.quartz.JobDataMap;
 import org.quartz.JobDetail;
 import org.quartz.Scheduler;
 import org.quartz.SchedulerException;
@@ -51,6 +45,7 @@
 import edu.ucsb.nceas.metacat.service.BaseService;
 import edu.ucsb.nceas.metacat.service.ServiceException;
 import edu.ucsb.nceas.shared.AccessException;
+import edu.ucsb.nceas.utilities.StatusUtil;
 
 public class SchedulerService extends BaseService {
 	
@@ -59,16 +54,13 @@
 	private static Logger logMetacat = Logger.getLogger(SchedulerService.class);
 	
 	private static Scheduler sched = null;
-	
-	static Hashtable<String, String> jobClassNames = new Hashtable<String, String>();
-	static {
-		jobClassNames.put("workflow", "edu.ucsb.nceas.metacat.workflow.WorkflowJob");
-	}
 
 	/**
 	 * private constructor since this is a singleton
 	 */
-	private SchedulerService() throws ServiceException {}
+	private SchedulerService() throws ServiceException {
+		start();
+	}
 	
 	/**
 	 * Get the single instance of SchedulerService.
@@ -116,103 +108,21 @@
 		return new Vector<String>();
 	}
 	
-	public String scheduleHandler(Hashtable<String, String[]> params,
-            HttpServletRequest request, HttpServletResponse response,
-            String username, String[] groups) throws ServiceException {
+	public String scheduleJob(String jobName, Calendar startCal, String interval,
+			String jobClassName, String jobGroup, HashMap<String, String> jobParams) throws ServiceException {
         
-		String returnString = "";
-        String[] categories = params.get("category");
-        if (categories == null || categories.length == 0) {
-        	throw new ServiceException("SchedulerService.scheduleHandler - Category field " 
-        			+ "must be populated in scheduler parameters");
-        }
-        
-        String category = categories[0];
-        
-        if (category.equals("schedule")) {
-    		Calendar startCal = null;
-            Hashtable<String, String> jobParams = new Hashtable<String, String>();
-        	
-    		String jobTypes[] = params.get("type");
-            if (jobTypes == null || jobTypes.length == 0) {
-            	throw new ServiceException("SchedulerService.scheduleJob - Type field must be populated " 
-            			+ "in scheduler parameters when scheduling job.");
-            }
-    		
-            String delays[] = params.get("delay");
-    		String startTimes[] = params.get("starttime");       
-            try {
-    			if (delays != null && delays.length > 0) {
-    				startCal = getStartDateFromDelay(delays[0]);
-    			} else if (startTimes != null && startTimes.length > 0) {
-    				Date startDate = DateFormat.getInstance().parse(startTimes[0]);
-    				startCal = Calendar.getInstance();
-    				startCal.setTime(startDate);
-    			} else {
-    				throw new ServiceException("SchedulerService.scheduleJob -  Either delay or starttime  " 
-    						+ "field must be populated in scheduler parameters when scheduling job.");
-    			}
-    		} catch (ParseException pe) {
-    			throw new ServiceException("SchedulerService.scheduleJob - Could not parse start time " 
-    					+ startTimes[0] + " : " + pe.getMessage());
-    		}
-            
-            String intervals[] = params.get("interval"); 
-            if (intervals == null || intervals.length == 0) {
-            	throw new ServiceException("SchedulerService.scheduleJob - Interval field must be populated " 
-            			+ "in scheduler parameters when scheduling job.");
-            } 
-            String interval = intervals[0];
-            
-            Enumeration<String> paramNames = params.keys();
-            while (paramNames.hasMoreElements()) {
-            	String paramName = paramNames.nextElement();
-            	if (paramName.startsWith("jobparam_")) {
-            		jobParams.put(paramName.substring(8), params.get(paramName)[0]);
-            	}
-            }
-                   
-            String jobType = jobTypes[0];
-            String jobName = jobType + Calendar.getInstance().getTimeInMillis();
-        	
-        	returnString = scheduleJob(jobName, startCal, interval, jobType, jobParams);
-        } else if (category.equals("unschedule")) {
-        	String jobNames[] = params.get("jobName");
-        	if (jobNames == null || jobNames.length == 0) {
-        		throw new ServiceException("SchedulerService.scheduleJob - Job ID field must be populated " 
-            			+ "in scheduler parameters when unscheduling job.");
-        	}
-        	        	
-        	unscheduleJob(jobNames[0]);
-        } else if (category.equals("delete")) {
-//        	deleteJob(params);
-        }
-        
-        return returnString;
-	}
-	
-	public String scheduleJob(String jobName, Calendar startCal, String interval,
-			String jobType, Hashtable<String, String> jobParams) throws ServiceException {
-
         Class<Job> jobClass = null;
-       
-        String className = jobClassNames.get(jobType);
-        if (className == null) {
-        	throw new ServiceException("SchedulerService.scheduleJob - Type: " + jobType 
-        			+ " is not registered as a valid job type");
-        }
-        
-        logMetacat.info("Scheduling job -- name: " + jobName + ", class: " + className 
-        		+ ", start time: " + startCal.toString() + ", interval: " + interval);
-       	 
         try {        	
-        	jobClass = (Class<Job>)Class.forName(jobType + "Job");     	
+        	jobClass = (Class<Job>)Class.forName(jobClassName);     	
         } catch (ClassNotFoundException cnfe) {
         	throw new ServiceException("SchedulerService.scheduleJob - Could not find class with name: " 
-        			+ jobType + "Job");
-        }    
+        			+ jobClassName + " : " + cnfe.getMessage());
+        } 
         
-		char intervalUnit = interval.trim().charAt(interval.length());
+        logMetacat.info("Scheduling job -- name: " + jobName + ", class: " + jobClassName 
+        		+ ", start time: " + startCal.toString() + ", interval: " + interval);  
+        
+		char intervalUnit = interval.trim().charAt(interval.length() - 1);
 		String intervalStrValue = interval.trim().substring(0, interval.length() - 1);
 		int intervalValue;
 		try {
@@ -219,45 +129,24 @@
 			intervalValue = Integer.parseInt(intervalStrValue);
 		} catch (NumberFormatException nfe) {
 			throw new ServiceException("SchedulerService.scheduleJob - Could not parse interval value " 
-					+ "into an integer: " + intervalStrValue);
+					+ "into an integer: " + intervalStrValue + " : " + nfe.getMessage());
 		}
 		
-		switch (intervalUnit) {
-		case 's':
-		case 'S':
-			scheduleSecondlyJob(jobName, jobClass, startCal, intervalValue, jobType);
-			break;
-		case 'm':
-		case 'M':
-			scheduleMinutelyJob(jobName, jobClass, startCal, intervalValue, jobType);
-			break;
-		case 'h':
-		case 'H':
-			scheduleHourlyJob(jobName, jobClass, startCal, intervalValue, jobType);
-			break;
-		case 'd':
-		case 'D':
-			scheduleDailyJob(jobName, jobClass, startCal, intervalValue, jobType);
-			break;
-		default:
-			throw new ServiceException("SchedulerService.scheduleJob - Could not interpret interval unit: " 
-					+ intervalUnit + ". Unit must be s, m, h or d");	
-		}	
+		startJob(jobName, startCal, intervalValue, intervalUnit, jobClass, jobGroup, jobParams);
 		
 		try {
 			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
-			jobAccess.createJob(jobName, jobClass, startCal, intervalValue, jobParams);
+			jobAccess.createJob(jobName, jobName, jobGroup, jobClass, startCal, intervalValue, Character.toString(intervalUnit), jobParams);
 		} catch (AccessException ae) {
 			try {
 				deleteJob(jobName);
-			} catch (ServiceException se) {
+			} catch (Exception e) {
 				// Not much we can do here but log this
 				logMetacat.error("An access exception was thrown when writing job: " + jobName 
 						+ "to the db, and another exception was thrown when trying to remove the " 
-						+ "job from the scheduler.  The db and scheduler may be out of sync");
+						+ "job from the scheduler.  The db and scheduler may be out of sync: " + e.getMessage());
 			}
-			throw new ServiceException("SchedulerService.scheduleJob - Error accessing db: " 
-					+ ae.getMessage());
+			throw new ServiceException("SchedulerService.scheduleJob - Error accessing db: ", ae);
 		}
 		
 		return jobName;
@@ -270,7 +159,7 @@
 
 			sched.unscheduleJob(jobDAO.getName(), jobDAO.getGroupName());
 
-			jobDAO.setStatus(ScheduledJobInterface.STATE_UNSHCEDULED);
+			jobDAO.setStatus(StatusUtil.UNSHCEDULED);
 			jobAccess.updateJobStatus(jobDAO);
 		} catch (SchedulerException se) {
 			throw new ServiceException("SchedulerService.unscheduleJob - Could not create "
@@ -277,26 +166,26 @@
 							+ "scheduled job because of service issue: " + se.getMessage());
 		} catch (AccessException ae) {
 			throw new ServiceException("SchedulerService.unscheduleJob - Could not create "
-							+ "scheduled job because of db access issue: " + ae.getMessage());
+							+ "scheduled job because of db access issue: ", ae);
 		}
 	}
 	
 	public void deleteJob(String jobName) throws ServiceException {
 		String groupName = "";
-		
+
 		try {
 			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
 			ScheduledJobDAO jobDAO = jobAccess.getJobByName(jobName);
 			groupName = jobDAO.getGroupName();
-			
+
 			sched.deleteJob(jobName, groupName);
 		} catch (SchedulerException se) {
-			throw new ServiceException("SchedulerService.deleteJob - Could not delete job: " 
-					+ jobName + " for group: " + groupName + " : " + se.getMessage());
+			throw new ServiceException("SchedulerService.deleteJob - Could not delete job: " + jobName
+							+ " for group: " + groupName + " : " + se.getMessage());
 		} catch (AccessException ae) {
 			throw new ServiceException("SchedulerService.deleteJob - Could not delete "
-					+ "scheduled job because of db access issue: " + ae.getMessage());
-}
+					+ "scheduled job because of db access issue: ", ae);
+		}
 	}
 	
 	public Vector<String> getJobInfo(String groupName) throws ServiceException {
@@ -319,11 +208,121 @@
 		return returnVector;
 	}
 	
-	private void scheduleSecondlyJob(String name, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup) throws ServiceException {
-		JobDetail jobDetail = new JobDetail(name, jobGroup, jobClass);
+	public String getJobInfoXML(Long jobId) throws ServiceException {
+		String jobInfoXML = "";
+		
+		try {
+			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
+			ScheduledJobDAO scheduledJobDAO = jobAccess.getJob(jobId);
+			
+			jobInfoXML += 
+				"<scheduledJobs>" + jobToXML(scheduledJobDAO) + "</scheduledJobs>";
+			
+		} catch (AccessException ae) {
+			throw new ServiceException("SchedulerService.getJobInfoXML - Could not get job info for job: " 
+					+ jobId, ae);
+		}
+		
+		return jobInfoXML;
+	}
+	
+	public String getJobsInfoXML(String groupName) throws ServiceException {
+		String jobInfoXML = "";
+		
+		try {
+			ScheduledJobAccess jobAccess = new ScheduledJobAccess();
+			HashMap<Long, ScheduledJobDAO> JobDAOMap = jobAccess.getAllJobs(groupName);
+			
+			jobInfoXML += "<scheduledJobs>";
+			for (Long jobDAOId : JobDAOMap.keySet()) {
+				jobInfoXML +=  jobToXML(JobDAOMap.get(jobDAOId)); 
+			}				
+			jobInfoXML += "</scheduledJobs>";
+			
+		} catch (AccessException ae) {
+			throw new ServiceException("SchedulerService.getJobInfoXML - Could not get jobs info for group: " 
+					+ groupName, ae);
+		}
+		
+		return jobInfoXML;
+	}
+	
+	private String jobToXML(ScheduledJobDAO scheduledJobDAO) {
+		String jobXML = "";
 
+		if (scheduledJobDAO != null) {
+			jobXML += "<scheduledJob>";
+			jobXML += "<id>" + scheduledJobDAO.getId() + "</id>";
+			jobXML += "<createTime>" + scheduledJobDAO.getCreateTime() + "</createTime>";
+			jobXML += "<modTime>" + scheduledJobDAO.getModTime() + "</modTime>";
+			jobXML += "<status>" + scheduledJobDAO.getStatus() + "</status>";
+			jobXML += "<name>" + scheduledJobDAO.getName() + "</name>";
+			jobXML += "<triggerName>" + scheduledJobDAO.getName() + "</triggerName>";
+			jobXML += "<groupName>" + scheduledJobDAO.getGroupName() + "</groupName>";
+			jobXML += "<className>" + scheduledJobDAO.getName() + "</className>";
+			jobXML += "<startTime>" + scheduledJobDAO.getStartTime().toString()
+					+ "</startTime>";
+			jobXML += "<intervalValue>" + scheduledJobDAO.getIntervalValue()
+					+ "</intervalValue>";
+			jobXML += "<intervalUnit>" + scheduledJobDAO.getIntervalUnit()
+					+ "</intervalUnit>";
+
+			HashMap<String, ScheduledJobParamDAO> jobParams = scheduledJobDAO
+					.getAllJobParams();
+			for (String jobParamKey : jobParams.keySet()) {
+				jobXML += "<jobParam>";
+				jobXML += "<id>" + jobParams.get(jobParamKey).getId() + "</id>";
+				jobXML += "<createTime>" + jobParams.get(jobParamKey).getCreateTime()
+						+ "</createTime>";
+				jobXML += "<modTime>" + jobParams.get(jobParamKey).getModTime()
+						+ "</modTime>";
+				jobXML += "<status>" + jobParams.get(jobParamKey).getStatus()
+						+ "</status>";
+				jobXML += "<jobId>" + jobParams.get(jobParamKey).getJobId() + "</jobId>";
+				jobXML += "<key>" + jobParams.get(jobParamKey).getKey() + "</key>";
+				jobXML += "<value>" + jobParams.get(jobParamKey).getValue() + "</value>";
+				jobXML += "</jobParam>";
+			}
+			jobXML += "</scheduledJob>";
+		}
+
+		return jobXML;
+	}
+	
+	
+	private void startJob(String jobName, Calendar startCal, int intervalValue, char intervalUnit,
+			Class<Job> jobClass, String jobGroup, HashMap<String, String> jobParams) throws ServiceException { 
+		
+		JobDetail jobDetail = new JobDetail(jobName, jobGroup, jobClass);
+		jobDetail.setJobDataMap(new JobDataMap(jobParams));
+		
+		switch (intervalUnit) {
+		case 's':
+		case 'S':
+			scheduleSecondlyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail);
+			break;
+		case 'm':
+		case 'M':
+			scheduleMinutelyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail);
+			break;
+		case 'h':
+		case 'H':
+			scheduleHourlyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail);
+			break;
+		case 'd':
+		case 'D':
+			scheduleDailyJob(jobName, jobClass, startCal, intervalValue, jobGroup, jobDetail);
+			break;
+		default:
+			throw new ServiceException("SchedulerService.scheduleJob - Could not interpret interval unit: " 
+					+ intervalUnit + ". Unit must be s, m, h or d");	
+		}	
+	}
+	
+	private void scheduleSecondlyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
+
 		Trigger trigger = TriggerUtils.makeSecondlyTrigger(interval);
-		trigger.setName(name);
+		trigger.setName(jobName);
 		trigger.setStartTime(startTime.getTime());
 
 		try {
@@ -334,11 +333,10 @@
 		}
 	}
 	
-	private void scheduleMinutelyJob(String name, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup) throws ServiceException {
-		JobDetail jobDetail = new JobDetail(name, jobGroup, jobClass);
+	private void scheduleMinutelyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
 
 		Trigger trigger = TriggerUtils.makeMinutelyTrigger(interval);
-		trigger.setName(name);
+		trigger.setName(jobName);
 		trigger.setStartTime(startTime.getTime());
 
 		try {
@@ -349,11 +347,10 @@
 		}
 	}
 	
-	private void scheduleHourlyJob(String name, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup) throws ServiceException {
-		JobDetail jobDetail = new JobDetail(name, jobGroup, jobClass);
+	private void scheduleHourlyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
 
 		Trigger trigger = TriggerUtils.makeHourlyTrigger(interval);
-		trigger.setName(name);
+		trigger.setName(jobName);
 		trigger.setStartTime(startTime.getTime());
 
 		try {
@@ -364,12 +361,10 @@
 		}
 	}
 	
-	private void scheduleDailyJob(String name, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup) throws ServiceException {
+	private void scheduleDailyJob(String jobName, Class<Job> jobClass, Calendar startTime, int interval, String jobGroup, JobDetail jobDetail) throws ServiceException {
 
-		JobDetail jobDetail = new JobDetail(name, jobGroup, jobClass);
-
 		Trigger trigger = TriggerUtils.makeHourlyTrigger(interval * 24);
-		trigger.setName(name);
+		trigger.setName(jobName);
 		trigger.setStartTime(startTime.getTime());
 
 		try {
@@ -382,10 +377,10 @@
 	
 
 	
-	private Calendar getStartDateFromDelay(String delay) throws ServiceException {
+	public Calendar getStartDateFromDelay(String delay) throws ServiceException {
 		Calendar cal = Calendar.getInstance();
 	
-		char delayUnit = delay.trim().charAt(delay.length());
+		char delayUnit = delay.trim().charAt(delay.length() - 1);
 		String delayStrValue = delay.trim().substring(0, delay.length() - 1);
 		int delayValue;
 		try {
@@ -392,7 +387,7 @@
 			delayValue = Integer.parseInt(delayStrValue);
 		} catch (NumberFormatException nfe) {
 			throw new ServiceException("SchedulerService.getStartDateFromDelay - Could not " 
-					+ "parse delay value into an integer: " + delayStrValue);
+					+ "parse delay value into an integer: " + delayStrValue + " : " + nfe.getMessage());
 		}
 		
 		switch (delayUnit) {
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamDAO.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamDAO.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamDAO.java	(revision 4959)
@@ -0,0 +1,61 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that holds the data from the scheduled_task 
+ *             table in the database. 
+ *  Copyright: 2009 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$Author: daigle $'
+ *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
+ * '$Revision: 4854 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.scheduler;
+
+import edu.ucsb.nceas.shared.BaseDAO;
+
+public class ScheduledJobParamDAO extends BaseDAO {
+
+	private Long _jobId;
+	private String _key;
+	private String _value;
+	
+	public Long getJobId() {
+		return _jobId;
+	}
+	
+	public void setJobId(Long jobId) {
+		_jobId = jobId;
+	}
+	
+	public String getKey() {
+		return _key;
+	}
+	
+	public void setKey(String key) {
+		_key = key;
+	}
+	
+	public String getValue() {
+		return _value;
+	}
+	
+	public void setValue(String value) {
+		_value = value;
+	}
+}
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamDAO.java
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +0,0 ##
Index: src/edu/ucsb/nceas/metacat/scheduler/scheduler.ddl
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/scheduler.ddl	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/scheduler/scheduler.ddl	(revision 4959)
@@ -0,0 +1,33 @@
+/*
+ * scheduled_job -- table to store scheduled jobs
+ */
+CREATE SEQUENCE scheduled_job_id_seq;
+CREATE TABLE scheduled_job (
+  id INT8 NOT NULL default nextval('scheduled_job_id_seq'),
+  date_created TIMESTAMP NOT NULL,
+  date_updated TIMESTAMP NOT NULL,
+  status VARCHAR(64) NOT NULL,
+  name VARCHAR(512) NOT NULL,
+  trigger_name VARCHAR(512) NOT NULL,
+  group_name VARCHAR(512) NOT NULL,
+  class_name VARCHAR(1024) NOT NULL,
+  start_time TIMESTAMP NOT NULL,
+  interval_value INT NOT NULL,
+  interval_unit VARCHAR(8) NOT NULL,
+  CONSTRAINT scheduled_job_pk PRIMARY KEY (id)
+);
+
+/*
+ * scheduled_job_params -- table to store scheduled jobs
+ */
+CREATE SEQUENCE scheduled_job_params_id_seq;
+CREATE TABLE scheduled_job_params (
+  id INT8  NOT NULL default nextval('scheduled_job_params_id_seq'),
+  date_created TIMESTAMP NOT NULL,
+  date_updated TIMESTAMP  NOT NULL,
+  status VARCHAR(64)  NOT NULL,
+  job_id INT8 NOT NULL,
+  key VARCHAR(64) NOT NULL,
+  value VARCHAR(1024) NOT NULL,
+  CONSTRAINT scheduled_job_params_pk PRIMARY KEY (id)
+);
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/scheduler/BaseScheduler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/BaseScheduler.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/scheduler/BaseScheduler.java	(revision 4959)
@@ -0,0 +1,51 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that runs a single scheduled report task 
+ *  Copyright: 2009 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$Author: daigle $'
+ *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
+ * '$Revision: 4854 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.scheduler;
+
+import java.util.Hashtable;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public abstract class BaseScheduler {
+	
+	public abstract String scheduleJob(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException;
+	
+	public abstract String unScheduleJob(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException;
+	
+	public abstract String deleteJob(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException;
+	
+	public abstract String getJobs(Hashtable<String, String[]> params,
+            HttpServletRequest request, HttpServletResponse response,
+            String username, String[] groups) throws MetacatSchedulerException;
+}

Property changes on: src/edu/ucsb/nceas/metacat/scheduler/BaseScheduler.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/scheduler/MetacatSchedulerException.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/MetacatSchedulerException.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/scheduler/MetacatSchedulerException.java	(revision 4959)
@@ -0,0 +1,48 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: An Exception thrown when an error occurs because an 
+ *             AccessionNumber was invalid or used incorrectly
+ *  Copyright: 2008 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ *
+ *   '$Author: daigle $'
+ *     '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
+ * '$Revision: 4080 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.scheduler;
+
+import edu.ucsb.nceas.shared.BaseException;
+
+/**
+ * Exception thrown when an error occurs in a configuration administrative
+ * class
+ */
+public class MetacatSchedulerException extends BaseException {
+
+	private static final long serialVersionUID = -4139222056636239741L;
+
+	public MetacatSchedulerException(String message) {
+		super(message);
+	}
+	
+	public MetacatSchedulerException(String message, BaseException deeperException) {
+		super(message, deeperException);
+	}
+	
+}

Property changes on: src/edu/ucsb/nceas/metacat/scheduler/MetacatSchedulerException.java
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobAccess.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobAccess.java	(revision 4958)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobAccess.java	(revision 4959)
@@ -32,13 +32,16 @@
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.util.Calendar;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Vector;
 
 import org.apache.log4j.Logger;
 import org.quartz.Job;
 
+import edu.ucsb.nceas.metacat.DBConnectionPool;
 import edu.ucsb.nceas.shared.AccessException;
 import edu.ucsb.nceas.shared.BaseAccess;
+import edu.ucsb.nceas.utilities.StatusUtil;
 
 public class ScheduledJobAccess extends BaseAccess {
 	
@@ -48,12 +51,58 @@
 		super("ScheduledJobAccess");
 	}
 	
+	public ScheduledJobDAO getJob(Long jobId) throws AccessException {
+		ScheduledJobDAO jobDAO = null;
+
+		PreparedStatement pstmt = null;
+		try {
+			String sql = "SELECT * FROM scheduled_job WHERE id = ? AND status != 'deleted'"; 
+			pstmt = conn.prepareStatement(sql);
+
+			pstmt.setLong(1, jobId);
+			
+			logMetacat.info("SQL getJobByName - " + sql);
+			logMetacat.info("SQL params: [" + jobId + "]");
+			
+			pstmt.execute();
+			
+			ResultSet resultSet = pstmt.getResultSet();
+			if (resultSet.next()) {
+				jobDAO = populateDAO(resultSet);
+			}
+			
+		} catch (SQLException sqle) {
+			throw new AccessException("ScheduledJobAccess.getJob - SQL error when getting scheduled job: " 
+					+ jobId  + " : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.getJobByName - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} 
+		}	
+		
+		ScheduledJobParamAccess jobParamAccess = new ScheduledJobParamAccess();
+		Vector<ScheduledJobParamDAO> jobParamList = 
+			jobParamAccess.getJobParamsForJobId(jobDAO.getId());
+		
+		for(ScheduledJobParamDAO jobParamDAO : jobParamList) {
+			jobDAO.addJobParam(jobParamDAO);
+		}
+		
+		return jobDAO;		
+	}
+	
 	public ScheduledJobDAO getJobByName(String jobName) throws AccessException {
 		ScheduledJobDAO jobDAO = null;
 
+		PreparedStatement pstmt = null;
 		try {
-			String sql = "SELECT * FROM scheduled_job WHERE name = ? "; 
-			PreparedStatement pstmt = conn.prepareStatement(sql);
+			String sql = "SELECT * FROM scheduled_job WHERE name = ? status != 'deleted'"; 
+			pstmt = conn.prepareStatement(sql);
 
 			pstmt.setString(1, jobName);
 			
@@ -63,71 +112,166 @@
 			pstmt.execute();
 			
 			ResultSet resultSet = pstmt.getResultSet();
-			if(resultSet.next()) {
-				jobDAO = new ScheduledJobDAO();
-				jobDAO.setId(resultSet.getLong("id"));
-				jobDAO.setCreateTime(resultSet.getTimestamp("date_created"));
-				jobDAO.setModTime(resultSet.getTimestamp("date_updated"));
-				jobDAO.setStatus(resultSet.getString("status"));
-				jobDAO.setName(resultSet.getString("name"));
-				jobDAO.setTriggerName(resultSet.getString("trigger_name"));
-				jobDAO.setTriggerName(resultSet.getString("group_name"));
-				jobDAO.setClassName(resultSet.getString("class_name"));
-				jobDAO.setStartTime(resultSet.getTimestamp("start_time"));
-				jobDAO.setInterval(resultSet.getInt("interval"));
+			if (resultSet.next()) {
+				jobDAO = populateDAO(resultSet);
 			}
 			
 		} catch (SQLException sqle) {
 			throw new AccessException("ScheduledJobAccess.getJobByName - SQL error when getting scheduled job by name: " 
 					+ jobName  + " : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.getJobByName - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} 
 		}	
 		
+		ScheduledJobParamAccess jobParamAccess = new ScheduledJobParamAccess();
+		Vector<ScheduledJobParamDAO> jobParamList = 
+			jobParamAccess.getJobParamsForJobId(jobDAO.getId());
+		
+		for(ScheduledJobParamDAO jobParamDAO : jobParamList) {
+			jobDAO.addJobParam(jobParamDAO);
+		}
+		
 		return jobDAO;		
 	}
 	
-	public void createJob(String name, Class<Job> jobClass, Calendar startTime, int interval, Hashtable<String, String> jobParams) throws AccessException {
+	public HashMap<Long, ScheduledJobDAO> getAllJobs(String groupName) throws AccessException {
+		ScheduledJobDAO jobDAO = null;
+		
+		HashMap<Long, ScheduledJobDAO> allJobDAOs = new HashMap<Long, ScheduledJobDAO>();
+
+		PreparedStatement pstmt = null;
+		try {
+			String sql = "SELECT * FROM scheduled_job WHERE status != 'deleted'"; 
+			if (groupName != null) {
+				sql += " AND group_name = ?" ;
+			}
+			pstmt = conn.prepareStatement(sql);
+			
+			logMetacat.info("SQL getAllJobs - " + sql);
+			if (groupName != null) {
+				pstmt.setString(1, groupName);
+				
+				logMetacat.info("SQL params:  [" + groupName + "]");
+			}
+						
+			pstmt.execute();
+			
+			ResultSet resultSet = pstmt.getResultSet();
+			while (resultSet.next()) {
+				jobDAO = populateDAO(resultSet);
+				
+				allJobDAOs.put(jobDAO.getId(), jobDAO);
+			}
+			
+			ScheduledJobParamAccess jobParamAccess = new ScheduledJobParamAccess();
+			Vector<ScheduledJobParamDAO> jobParamList = 
+				jobParamAccess.getAllJobParams();
+			
+			for(ScheduledJobParamDAO jobParamDAO : jobParamList) {
+				jobDAO.addJobParam(jobParamDAO);
+				
+				Long jobId = jobParamDAO.getJobId();
+				if( allJobDAOs.containsKey(jobId)) {
+					allJobDAOs.get(jobId).addJobParam(jobParamDAO);
+				}
+			}
+			
+			return allJobDAOs;
+			
+		} catch (SQLException sqle) {
+			throw new AccessException("ScheduledJobAccess.getJobByName - SQL error when getting all jobs : "  
+					+ sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.getJobByName - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}	
+				
+	}
+	
+	public void createJob(String name, String triggerName, String groupName,
+			Class<Job> jobClass, Calendar startTime, int intervalValue,
+			String intervalUnit, HashMap<String, String> jobParams)
+			throws AccessException {
+		
 		ScheduledJobDAO jobDAO = new ScheduledJobDAO();
-		jobDAO.setStatus(ScheduledJobInterface.STATE_SCHEDULED);
+		jobDAO.setStatus(StatusUtil.SCHEDULED);
 		jobDAO.setName(name);
+		jobDAO.setTriggerName(name);
+		jobDAO.setGroupName(groupName);
 		jobDAO.setClassName(jobClass.getName());
 		jobDAO.setStartTime(new Timestamp(startTime.getTimeInMillis()));
-		jobDAO.setInterval(interval);
-		
+		jobDAO.setIntervalValue(intervalValue);
+		jobDAO.setIntervalUnit(intervalUnit);
+
 		createJob(jobDAO, jobParams);
 	}
 		
-	public void createJob(ScheduledJobDAO jobDAO, Hashtable<String, String> jobParams) throws AccessException {			
+	public void createJob(ScheduledJobDAO jobDAO, HashMap<String, String> jobParams) throws AccessException {			
+		PreparedStatement pstmt = null;
+		
 		try {
 			String sql = 
-				"INSERT INTO scheduled_job (date_created, date_updated, status, name, class_name, start_time, interval) " 
-				+ "VALUES(now(), now(), ?, ?, ?, ?, ?)";		
-			PreparedStatement pstmt = conn.prepareStatement(sql);
+				"INSERT INTO scheduled_job (date_created, date_updated, status, name, trigger_name, group_name, class_name, start_time, interval_value, interval_unit) " 
+				+ "VALUES(now(), now(), ?, ?, ?, ?, ?, ?, ?, ?)";		
+			pstmt = conn.prepareStatement(sql);
 		
 			pstmt.setString(1, jobDAO.getStatus());
 			pstmt.setString(2, jobDAO.getName());
-			pstmt.setString(3, jobDAO.getClassName());
-			pstmt.setTimestamp(4, jobDAO.getStartTime());
-			pstmt.setInt(5, jobDAO.getInterval());
+			pstmt.setString(3, jobDAO.getTriggerName());
+			pstmt.setString(4, jobDAO.getGroupName());
+			pstmt.setString(5, jobDAO.getClassName());
+			pstmt.setTimestamp(6, jobDAO.getStartTime());
+			pstmt.setInt(7, jobDAO.getIntervalValue());
+			pstmt.setString(8, jobDAO.getIntervalUnit());
 			
 			logMetacat.info("SQL createJob - " + sql);
 			logMetacat.info("SQL params:  [" + jobDAO.getStatus() + ","
 					+ jobDAO.getName() + ","
+					+ jobDAO.getTriggerName() + ","
+					+ jobDAO.getGroupName() + ","
 					+ jobDAO.getClassName() + ",(Timestamp)"
 					+ jobDAO.getStartTime().toString() + ","
-					+ jobDAO.getInterval() + "]");
+					+ jobDAO.getIntervalValue() + ","
+					+ jobDAO.getIntervalUnit() + "]");
 			pstmt.execute();
 			
 		} catch (SQLException sqle) {
 			throw new AccessException("ScheduledJobAccess.createJob - SQL error when creating scheduled job " 
 					+ jobDAO.getName()  + " : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.createJob - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
 		}	
 		
 		if (jobParams.size() > 0) {
-			ScheduledJobParamsAccess scheduledJobParamsAccess = null;
+			ScheduledJobParamAccess scheduledJobParamsAccess = null;
 			ScheduledJobDAO updatedJobDAO = null;
 			try {
 				updatedJobDAO = getJobByName(jobDAO.getName());
-				scheduledJobParamsAccess = new ScheduledJobParamsAccess();
+				scheduledJobParamsAccess = new ScheduledJobParamAccess();
 				scheduledJobParamsAccess.createJobParams(updatedJobDAO.getId(), jobParams);
 			} catch (AccessException ae) {
 				if (updatedJobDAO != null) {
@@ -142,7 +286,7 @@
 	}
 	
 	public void deleteJob(ScheduledJobDAO jobDAO) throws AccessException {	
-		ScheduledJobParamsAccess scheduledJobParamsAccess = new ScheduledJobParamsAccess();
+		ScheduledJobParamAccess scheduledJobParamsAccess = new ScheduledJobParamAccess();
 		
 		if (jobDAO == null) {
 			throw new AccessException("ScheduledJobAccess.deleteJob - job DAO cannot be null.");
@@ -149,14 +293,16 @@
 		}
 		scheduledJobParamsAccess.deleteJobParams(jobDAO.getId());
 		
+		PreparedStatement pstmt = null;
+		
 		try {
 			String sql = "UPDATE scheduled_job SET status = ? WHERE id = ?";	
-			pstmt.setString(1, ScheduledJobInterface.STATE_DELETED);
+			pstmt.setString(1, StatusUtil.DELETED);
 			pstmt.setLong(2, jobDAO.getId());
 			
 			logMetacat.info("ScheduledJobAccess.deleteJob - " + sql);
 			
-			logMetacat.info("SQL params:  [" + ScheduledJobInterface.STATE_DELETED + ","
+			logMetacat.info("SQL params:  [" + StatusUtil.DELETED + ","
 					+ jobDAO.getId() + "]");
 
 			pstmt.execute();
@@ -163,7 +309,18 @@
 		} catch (SQLException sqle) {
 			throw new AccessException("ScheduledJobAccess.deleteJob - SQL error when " 
 					+ "deleting scheduled job " + jobDAO.getName()  + " : "  + sqle.getMessage());
-		}			
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.deleteJob - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}				
 	}
 	
 	public void updateJobStatus(ScheduledJobDAO jobDAO) throws AccessException {	
@@ -172,6 +329,8 @@
 			throw new AccessException("ScheduledJobAccess.updateJobStatus - job DAO cannot be null.");
 		}
 		
+		PreparedStatement pstmt = null;
+		
 		try {
 			String sql = "UPDATE scheduled_job SET status = ? WHERE id = ?";	
 			pstmt.setString(1, jobDAO.getStatus());
@@ -186,8 +345,37 @@
 		} catch (SQLException sqle) {
 			throw new AccessException("ScheduledJobAccess.deleteJob - SQL error when " 
 					+ "deleting scheduled job " + jobDAO.getName()  + " : "  + sqle.getMessage());
-		}	
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.updateJobStatus - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}		
 		
 	}
 	
+	protected ScheduledJobDAO populateDAO(ResultSet resultSet) throws SQLException {
+
+		ScheduledJobDAO jobDAO = new ScheduledJobDAO();
+		jobDAO.setId(resultSet.getLong("id"));
+		jobDAO.setCreateTime(resultSet.getTimestamp("date_created"));
+		jobDAO.setModTime(resultSet.getTimestamp("date_updated"));
+		jobDAO.setStatus(resultSet.getString("status"));
+		jobDAO.setName(resultSet.getString("name"));
+		jobDAO.setTriggerName(resultSet.getString("trigger_name"));
+		jobDAO.setGroupName(resultSet.getString("group_name"));
+		jobDAO.setClassName(resultSet.getString("class_name"));
+		jobDAO.setStartTime(resultSet.getTimestamp("start_time"));
+		jobDAO.setIntervalValue(resultSet.getInt("interval_value"));
+		jobDAO.setIntervalUnit(resultSet.getString("interval_unit"));
+
+		return jobDAO;
+	}
+	
 }
\ No newline at end of file
Index: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamAccess.java
===================================================================
--- src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamAccess.java	(nonexistent)
+++ src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamAccess.java	(revision 4959)
@@ -0,0 +1,226 @@
+/**
+ *  '$RCSfile$'
+ *    Purpose: A Class that manages database access of scheduled task 
+ *             information.
+ *  Copyright: 2009 Regents of the University of California and the
+ *             National Center for Ecological Analysis and Synthesis
+ *    Authors: Michael Daigle
+ * 
+ *   '$Author: daigle $'
+ *     '$Date: 2009-03-23 13:56:56 -0800 (Mon, 23 Mar 2009) $'
+ * '$Revision: 4854 $'
+ *
+ * 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
+ */
+
+package edu.ucsb.nceas.metacat.scheduler;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+import edu.ucsb.nceas.metacat.DBConnectionPool;
+import edu.ucsb.nceas.shared.AccessException;
+import edu.ucsb.nceas.shared.BaseAccess;
+import edu.ucsb.nceas.utilities.StatusUtil;
+
+public class ScheduledJobParamAccess extends BaseAccess {
+	
+	private Logger logMetacat = Logger.getLogger(ScheduledJobParamAccess.class);
+	
+	public ScheduledJobParamAccess() throws AccessException {
+		super("ScheduledJobParamsAccess");
+	}
+	
+	protected void createJobParams(Long jobId, HashMap<String, String> jobParams) throws AccessException {
+		
+		for(String paramKey : jobParams.keySet()) {			
+			ScheduledJobParamDAO jobParamsDAO = new ScheduledJobParamDAO();
+			jobParamsDAO.setStatus(StatusUtil.ACTIVE);
+			jobParamsDAO.setJobId(jobId);
+			jobParamsDAO.setKey(paramKey);
+			jobParamsDAO.setValue(jobParams.get(paramKey));
+			
+			PreparedStatement pstmt = null;
+			
+			try {
+				String sql = 
+					"INSERT INTO scheduled_job_params (date_created, date_updated, status, job_id, key, value) " 
+					+ "VALUES(now(), now(), ?, ?, ?, ?)";		
+				pstmt = conn.prepareStatement(sql);
+			
+				pstmt.setString(1, jobParamsDAO.getStatus());
+				pstmt.setLong(2, jobParamsDAO.getJobId());
+				pstmt.setString(3, jobParamsDAO.getKey());
+				pstmt.setString(4, jobParamsDAO.getValue());
+				
+				logMetacat.info("SQL createJobParams - " + sql);
+				logMetacat.info("SQL params:  [" + jobParamsDAO.getStatus() + ","
+						+ jobParamsDAO.getJobId() + ","
+						+ jobParamsDAO.getKey() + ","
+						+ jobParamsDAO.getValue().toString() + "]");
+				pstmt.execute();
+				
+			} catch (SQLException sqle) {
+				// Just throw the exception.  The ScheduledJobAccess class should handle cleanup.
+				throw new AccessException("ScheduledJobParamsAccess.createJobParams - SQL error when creating scheduled job parameter : "    
+					 + sqle.getMessage());
+			} finally {
+				try {
+					if (pstmt != null) {
+						pstmt.close();
+					}
+				} catch (SQLException sqle) {
+					logMetacat.error("ScheduledJobParamsAccess.createJobParams - An error occurred " 
+							+ "closing prepared statement: " + sqle.getMessage());
+				} finally {
+					DBConnectionPool.returnDBConnection(conn, serialNumber);
+				}
+			}	
+		}
+	}
+	
+	protected void deleteJobParams(Long jobId) throws AccessException {
+		PreparedStatement pstmt = null;
+		
+		try {
+			String sql = "UPDATE scheduled_job_params SET status = ? WHERE jobId = ?";		
+			pstmt.setString(1, StatusUtil.DELETED);
+			pstmt.setLong(1, jobId);
+			
+			logMetacat.info("SQL deleteJobParams - " + sql);
+
+			pstmt.execute();
+		} catch (SQLException sqle) {
+			throw new AccessException("ScheduledJobParamsAccess.deleteJobParams - SQL error " 
+					+ "when deleting scheduled job params for job" + jobId  + " : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobParamsAccess.createJobParams - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}	
+		
+	}	
+	
+	protected Vector<ScheduledJobParamDAO> getJobParamsForJobId(Long jobId) throws AccessException {
+		
+		Vector<ScheduledJobParamDAO> jobParamList = new Vector<ScheduledJobParamDAO>();
+		
+		PreparedStatement pstmt = null;
+		ScheduledJobParamDAO jobParamDAO = null;
+		try {
+			String sql = "SELECT * FROM scheduled_job_params WHERE job_id = ? status != 'deleted'"; 
+			pstmt = conn.prepareStatement(sql);
+
+			pstmt.setLong(1, jobId);
+			
+			logMetacat.info("SQL getJobParamsForJobId - " + sql);
+			logMetacat.info("SQL params: [" + jobId + "]");
+			
+			pstmt.execute();
+			
+			ResultSet resultSet = pstmt.getResultSet();
+			while (resultSet.next()) {
+				jobParamDAO = populateDAO(resultSet);
+				
+				jobParamList.add(jobParamDAO);
+			}
+			
+			return jobParamList;
+			
+		} catch (SQLException sqle) {
+			throw new AccessException("ScheduledJobAccess.getJobByName - SQL error when getting " 
+					+ "scheduled job parameter for job id: " + jobId  + " : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.getJobByName - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}
+		
+	}
+	
+	protected Vector<ScheduledJobParamDAO> getAllJobParams() throws AccessException {
+		
+		Vector<ScheduledJobParamDAO> jobParamList = new Vector<ScheduledJobParamDAO>();
+		
+		PreparedStatement pstmt = null;
+		ScheduledJobParamDAO jobParamDAO = null;
+		try {
+			String sql = "SELECT * FROM scheduled_job_params WHERE status != 'deleted'"; 
+			pstmt = conn.prepareStatement(sql);
+			
+			logMetacat.info("SQL getAllJobParams - " + sql);
+			
+			pstmt.execute();
+			
+			ResultSet resultSet = pstmt.getResultSet();
+			while (resultSet.next()) {
+				jobParamDAO = populateDAO(resultSet);
+				
+				jobParamList.add(jobParamDAO);
+			}
+			
+			return jobParamList;
+			
+		} catch (SQLException sqle) {
+			throw new AccessException("ScheduledJobAccess.getJobByName - SQL error when getting " 
+					+ "scheduled job parameters : "  + sqle.getMessage());
+		} finally {
+			try {
+				if (pstmt != null) {
+					pstmt.close();
+				}
+			} catch (SQLException sqle) {
+				logMetacat.error("ScheduledJobAccess.getJobByName - An error occurred " 
+						+ "closing prepared statement: " + sqle.getMessage());
+			} finally {
+				DBConnectionPool.returnDBConnection(conn, serialNumber);
+			}
+		}
+		
+	}
+	
+	protected ScheduledJobParamDAO populateDAO(ResultSet resultSet) throws SQLException {
+
+		ScheduledJobParamDAO jobParamDAO = new ScheduledJobParamDAO();
+		jobParamDAO.setId(resultSet.getLong("id"));
+		jobParamDAO.setCreateTime(resultSet.getTimestamp("date_created"));
+		jobParamDAO.setModTime(resultSet.getTimestamp("date_updated"));
+		jobParamDAO.setStatus(resultSet.getString("status"));
+		jobParamDAO.setJobId(resultSet.getLong("job_id"));
+		jobParamDAO.setKey(resultSet.getString("key"));
+		jobParamDAO.setValue(resultSet.getString("value"));
+
+		return jobParamDAO;
+	}
+ }
\ No newline at end of file

Property changes on: src/edu/ucsb/nceas/metacat/scheduler/ScheduledJobParamAccess.java
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +0,0 ##
Index: build.xml
===================================================================
--- build.xml	(revision 4958)
+++ build.xml	(revision 4959)
@@ -105,7 +105,7 @@
    	  <property name="schema-cvsrelpath"   value="lib${schema-relpath}"/>
       <property name="style-skins-relpath" value="/style/skins"/>
       <property name="util-module"         value="utilities" />
-   	  <property name="utilities-tag"       value="UTILITIES_1_0_0" />
+   	  <property name="utilities-tag"       value="UTILITIES_1_0_1" />
       <property name="eml-module"          value="eml" />
       <property name="eml-version"         value="2.0.0beta6" />
       <property name="eml-beta-tag"        value="BRANCH_EML_2_0_0_BETA_6_FOR_METACAT" />
@@ -228,6 +228,23 @@
    	  <property name="ecogrid-dir"         value="${ecogrid-module-dest-dir}/${ecogrid-module}"/>
 
       <property name="package.home"        value="edu/ucsb/nceas/metacat" />
+      
+      <!-- set up svn -->
+   	  <property name="svnant.lib" value="lib" />
+      <property name="svnant.jar" value="${svnant.lib}/svnant.jar" />
+      <property name="svnClientAdapter.jar" value="${svnant.lib}/svnClientAdapter.jar" />
+      <property name="svnjavahl.jar" value="${svnant.lib}/svnjavahl.jar" />
+   	  <property name="svn.utilitiesUrl" value="https://code.ecoinformatics.org/code/utilities/tags/${utilities-tag}" />
+      <!--  property name="svn.utilitiesExportPath" value="${knbdir}" / -->  
+      
+      <!-- load the svn task -->
+      <path id="svn.classpath">
+        <pathelement location="${svnjavahl.jar}" />
+        <pathelement location="${svnant.jar}" />
+        <pathelement location="${svnClientAdapter.jar}" />
+      </path>
+      <taskdef resource="svntask.properties" classpathref="svn.classpath"/>  
+      
       <condition property="utilities.required">
         <or>
           <not><available file="lib/httpclient.jar"/></not>
@@ -317,14 +334,20 @@
    </target>
 	
    <target name="getpeerutilities" depends="prepare" if="peer.utilities.required"
-	description="Checks utilities out of cvs and copies it to your utilitiesdir if it does not already exist">
-     <echo>Enter CVS password: </echo>
-     <cvs cvsRoot="${cvsroot}" package="${util-module}"
-     	tag="${utilities-tag}" dest="${utilitiesdir}/.." />
+	description="Checks utilities out of svn and copies it to your utilitiesdir if it does not already exist">
+   	 <echo message="Exporting utiities files from svn repository:" />
+   	 <!-- input message="Please enter svn repo username:" addproperty="svn.username" / -->
+   	 <!-- input message="Please enter svn repo password:" addproperty="svn.password" / -->
+   	 <!--  svn username="${svn.username}" password="${svn.password}" -->
+   	 <svn>
+   	   <export srcUrl="${svn.utilitiesUrl}" destPath="${utilitiesdir}" />
+   	 </svn>
+
+     <!--  ant dir="${utilitiesdir}" inheritAll="false"  target="dist" / -->
    </target>
 
    <target name="getutilities" depends="prepare"
-   description="Checks utility out of cvs and copies it to your metacat cvs sandbox">
+   description="Checks utility out of svn and copies it to your metacat cvs sandbox">
      <echo>Enter CVS password: </echo>
      <cvs cvsRoot="${cvsroot}"
           package="${util-module}"
