public int deleteExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; try { ps = conn.prepareStatement(Util.rtp(DELETE_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); return ps.executeUpdate(); } finally { Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { String cronExpr = rs.getString(COL_CRON_EXPRESSION); String timeZoneId = rs.getString(COL_TIME_ZONE_ID); CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(cronExpr); if (timeZoneId != null) cb.inTimeZone(TimeZone.getTimeZone(timeZoneId)); return new TriggerPropertyBundle(cb, null, null); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
String methName = "set" + c + name.substring(1); java.lang.reflect.Method setMeth = getSetMethod(methName, propDescs);
/** * <p> * Replace the table prefix in a query by replacing any occurrences of * "{0}" with the table prefix. * </p> * * @param query * the unsubstitued query * @return the query, with proper table prefix substituted */ protected final String rtp(String query) { return Util.rtp(query, tablePrefix, getSchedulerNameLiteral()); }
private void setTriggerStateProperties(OperableTrigger trigger, TriggerPropertyBundle props) throws JobPersistenceException { if(props.getStatePropertyNames() == null) return; Util.setBeanProps(trigger, props.getStatePropertyNames(), props.getStatePropertyValues()); }
/** * <p> * Replace the table prefix in a query by replacing any occurrences of * "{0}" with the table prefix. * </p> * * @param query * the unsubstitued query * @return the query, with proper table prefix substituted */ protected final String rtp(String query) { return Util.rtp(query, tablePrefix, getSchedulerNameLiteral()); }
private void setTriggerStateProperties(OperableTrigger trigger, TriggerPropertyBundle props) throws JobPersistenceException { if(props.getStatePropertyNames() == null) return; Util.setBeanProps(trigger, props.getStatePropertyNames(), props.getStatePropertyValues()); }
public int deleteExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; try { ps = conn.prepareStatement(Util.rtp(DELETE_SIMPLE_PROPS_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); return ps.executeUpdate(); } finally { Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { String cronExpr = rs.getString(COL_CRON_EXPRESSION); String timeZoneId = rs.getString(COL_TIME_ZONE_ID); CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(cronExpr); if (timeZoneId != null) cb.inTimeZone(TimeZone.getTimeZone(timeZoneId)); return new TriggerPropertyBundle(cb, null, null); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
private void lockViaInsert(Connection conn, String lockName, String sql) throws SQLException { getLog().debug("Inserting new lock row for lock: '" + lockName + "' being obtained by thread: " + Thread.currentThread().getName()); PreparedStatement ps = conn.prepareStatement(sql); try { ps.setString(1, lockName); if(ps.executeUpdate() != 1) { throw new SQLException(Util.rtp( "No row exists, and one could not be inserted in table " + TABLE_PREFIX_SUBST + TABLE_LOCKS + " for lock named: " + lockName, getTablePrefix(), getSchedulerNameLiteral())); } } finally { ps.close(); } } }
String methName = "set" + c + name.substring(1); java.lang.reflect.Method setMeth = getSetMethod(methName, propDescs);
public int deleteExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; try { ps = conn.prepareStatement(Util.rtp(DELETE_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); return ps.executeUpdate(); } finally { Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { int repeatCount = rs.getInt(COL_REPEAT_COUNT); long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL); int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED); SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule() .withRepeatCount(repeatCount) .withIntervalInMilliseconds(repeatInterval); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
private void lockViaInsert(Connection conn, String lockName, String sql) throws SQLException { getLog().debug("Inserting new lock row for lock: '" + lockName + "' being obtained by thread: " + Thread.currentThread().getName()); PreparedStatement ps = conn.prepareStatement(sql); try { ps.setString(1, lockName); if(ps.executeUpdate() != 1) { throw new SQLException(Util.rtp( "No row exists, and one could not be inserted in table " + TABLE_PREFIX_SUBST + TABLE_LOCKS + " for lock named: " + lockName, getTablePrefix(), getSchedulerNameLiteral())); } } finally { ps.close(); } } }
public int deleteExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; try { ps = conn.prepareStatement(Util.rtp(DELETE_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); return ps.executeUpdate(); } finally { Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { int repeatCount = rs.getInt(COL_REPEAT_COUNT); long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL); int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED); SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule() .withRepeatCount(repeatCount) .withIntervalInMilliseconds(repeatInterval); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
public int deleteExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; try { ps = conn.prepareStatement(Util.rtp(DELETE_SIMPLE_PROPS_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); return ps.executeUpdate(); } finally { Util.closeStatement(ps); } }
ps = conn.prepareStatement(Util.rtp(SELECT_SIMPLE_PROPS_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps);