001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.kernel.dao.db.DB;
018 import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
019 import com.liferay.portal.kernel.dao.jdbc.DataAccess;
020 import com.liferay.portal.kernel.exception.SystemException;
021 import com.liferay.portal.kernel.log.Log;
022 import com.liferay.portal.kernel.log.LogFactoryUtil;
023 import com.liferay.portal.service.base.QuartzLocalServiceBaseImpl;
024
025 import java.sql.Connection;
026 import java.sql.PreparedStatement;
027 import java.sql.ResultSet;
028
029
032 public class QuartzLocalServiceImpl extends QuartzLocalServiceBaseImpl {
033
034 public void checkQuartzTables() throws SystemException {
035 Connection con = null;
036 PreparedStatement ps = null;
037 ResultSet rs = null;
038
039 try {
040 con = DataAccess.getConnection();
041
042 ps = con.prepareStatement(
043 "select count(*) from QUARTZ_JOB_DETAILS");
044
045 rs = ps.executeQuery();
046
047 if (rs.next()) {
048 return;
049 }
050 }
051 catch (Exception e) {
052 if (_log.isWarnEnabled()) {
053 _log.warn(e.getMessage());
054 }
055 }
056 finally {
057 DataAccess.cleanUp(con, ps, rs);
058 }
059
060 DB db = DBFactoryUtil.getDB();
061
062 try {
063 db.runSQLTemplate("quartz-tables.sql", false);
064 }
065 catch (Exception e) {
066 throw new SystemException(e);
067 }
068 }
069
070 private static Log _log = LogFactoryUtil.getLog(
071 QuartzLocalServiceImpl.class);
072
073 }