01: /**********************************************************************************
02: * $URL$
03: * $Id$
04: **********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005 The Regents of the University of Michigan, Trustees of Indiana University,
07: * Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
08: *
09: * Licensed under the Educational Community License Version 1.0 (the "License");
10: * By obtaining, using and/or copying this Original Work, you agree that you have read,
11: * understand, and will comply with the terms and conditions of the Educational Community License.
12: * You may obtain a copy of the License at:
13: *
14: * http://cvs.sakaiproject.org/licenses/license_1_0.html
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17: * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
18: * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19: * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21: *
22: **********************************************************************************/package org.sakaiproject.component.app.scheduler;
23:
24: import java.sql.Connection;
25: import java.sql.SQLException;
26:
27: import javax.sql.DataSource;
28:
29: import org.apache.commons.logging.Log;
30: import org.apache.commons.logging.LogFactory;
31: import org.quartz.utils.ConnectionProvider;
32: import org.sakaiproject.component.cover.ComponentManager;
33:
34: public class ConnectionProviderDelegate implements ConnectionProvider {
35:
36: private static final Log LOG = LogFactory
37: .getLog(ConnectionProviderDelegate.class);
38: private static DataSource ds;
39:
40: /**
41: * @see org.quartz.utils.ConnectionProvider#getConnection()
42: */
43: public Connection getConnection() throws SQLException {
44:
45: if (LOG.isDebugEnabled()) {
46: LOG.debug("quartz getConnection()");
47: }
48:
49: if (ds == null) {
50: ds = (DataSource) ComponentManager
51: .get("javax.sql.DataSource");
52: }
53: return ds.getConnection();
54: }
55:
56: /**
57: * @see org.quartz.utils.ConnectionProvider#shutdown()
58: */
59: public void shutdown() throws SQLException {
60: }
61:
62: }
|