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 @Override
035 public void checkQuartzTables() throws SystemException {
036 Connection con = null;
037 PreparedStatement ps = null;
038 ResultSet rs = null;
039
040 try {
041 con = DataAccess.getConnection();
042
043 ps = con.prepareStatement(
044 "select count(*) from QUARTZ_JOB_DETAILS");
045
046 rs = ps.executeQuery();
047
048 if (rs.next()) {
049 return;
050 }
051 }
052 catch (Exception e) {
053 if (_log.isWarnEnabled()) {
054 _log.warn(e, e);
055 }
056 }
057 finally {
058 DataAccess.cleanUp(con, ps, rs);
059 }
060
061 DB db = DBFactoryUtil.getDB();
062
063 try {
064 db.runSQLTemplate("quartz-tables.sql", false);
065 }
066 catch (Exception e) {
067 throw new SystemException(e);
068 }
069 }
070
071 private static Log _log = LogFactoryUtil.getLog(
072 QuartzLocalServiceImpl.class);
073
074 }