1
14
15 package com.liferay.portal.service.impl;
16
17 import com.liferay.portal.kernel.dao.db.DB;
18 import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
19 import com.liferay.portal.kernel.dao.jdbc.DataAccess;
20 import com.liferay.portal.kernel.exception.SystemException;
21 import com.liferay.portal.kernel.log.Log;
22 import com.liferay.portal.kernel.log.LogFactoryUtil;
23 import com.liferay.portal.service.base.QuartzLocalServiceBaseImpl;
24
25 import java.sql.Connection;
26 import java.sql.PreparedStatement;
27 import java.sql.ResultSet;
28
29
34 public class QuartzLocalServiceImpl extends QuartzLocalServiceBaseImpl {
35
36 public void checkQuartzTables() throws SystemException {
37 Connection con = null;
38 PreparedStatement ps = null;
39 ResultSet rs = null;
40
41 try {
42 con = DataAccess.getConnection();
43
44 ps = con.prepareStatement(
45 "select count(*) from QUARTZ_JOB_DETAILS");
46
47 rs = ps.executeQuery();
48
49 if (rs.next()) {
50 return;
51 }
52 }
53 catch (Exception e) {
54 if (_log.isWarnEnabled()) {
55 _log.warn(e.getMessage());
56 }
57 }
58 finally {
59 DataAccess.cleanUp(con, ps, rs);
60 }
61
62 DB db = DBFactoryUtil.getDB();
63
64 try {
65 db.runSQLTemplate("quartz-tables.sql", false);
66 }
67 catch (Exception e) {
68 throw new SystemException(e);
69 }
70 }
71
72 private static Log _log = LogFactoryUtil.getLog(
73 QuartzLocalServiceImpl.class);
74
75 }