01: /******************************************************************************
02: * DelayedInvocationReader.java - created by aaronz@vt.edu on Mar 19, 2007
03: *
04: * Copyright (c) 2007 Virginia Polytechnic Institute and State University
05: * Licensed under the Educational Community License version 1.0
06: *
07: * A copy of the Educational Community License has been included in this
08: * distribution and is available at: http://www.opensource.org/licenses/ecl1.php
09: *
10: * Contributors:
11: * Aaron Zeckoski (aaronz@vt.edu) - primary
12: *
13: *****************************************************************************/package org.sakaiproject.component.app.scheduler;
14:
15: import java.sql.ResultSet;
16: import java.sql.SQLException;
17:
18: import org.apache.commons.logging.Log;
19: import org.apache.commons.logging.LogFactory;
20: import org.sakaiproject.api.app.scheduler.DelayedInvocation;
21: import org.sakaiproject.db.api.SqlReader;
22:
23: /**
24: * An SQLReader so we can get the info out of the DB reasonably
25: *
26: * @author Aaron Zeckoski (aaronz@vt.edu)
27: */
28: public class DelayedInvocationReader implements SqlReader {
29:
30: private static final Log LOG = LogFactory
31: .getLog(DelayedInvocationReader.class);
32:
33: public Object readSqlResultRecord(ResultSet result) {
34:
35: DelayedInvocation invocation = new DelayedInvocation();
36:
37: try {
38: invocation.uuid = result.getString("INVOCATION_ID");
39: invocation.date = result.getTimestamp("INVOCATION_TIME");
40: invocation.componentId = result.getString("COMPONENT");
41: invocation.contextId = result.getString("CONTEXT");
42: } catch (SQLException e) {
43: LOG.error("SqlException: " + e);
44: return null;
45: }
46:
47: return invocation;
48: }
49:
50: }
|