
com.mtvnet.boxspring.scheduling.quartz.TriggerPropertyEditor Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2009, MTV Networks. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the Apache License Version 2.0 is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/
package com.mtvnet.boxspring.scheduling.quartz;
import org.quartz.Trigger;
import java.beans.PropertyEditorSupport;
/**
* Java Bean property editor for converting text to instances of type
* org.quartz.Trigger
.
* If the text begins with the word "cron", the remaining text must conform to the syntax
* specified in the class org.quartz.CronExpression
. Otherwise, the text
* must conform to the syntax specified in the ATG 2006.3 Programming Guide
* (http://www.atg.com/repositories/ContentCatalogRepository_en/manuals/ATG2006.3/dynprog/index.html)
* Chapter 5, section Scheduler Service. Currently we support RelativeSchedule and
* PeriodicSchedule, but not CalendarSchedule, though the "with catch up" clause is ignored
* in PeriodicSchedule because there does not seem to be an analog to it in Quartz.
*
* @see org.quartz.Trigger
* @see org.quartz.CronExpression
* @see atg.service.scheduler.RelativeSchedule
* @see atg.service.scheduler.PeriodicSchedule
*/
public class TriggerPropertyEditor extends PropertyEditorSupport {
/**
* Converts text to either a CronTriggerBean or SimpleTriggerBean.
*
* @param text The text to convert
*/
public void setAsText(String text) {
Trigger trigger = null;
try {
trigger = PropertyValueParser.getTrigger(text);
} catch (Exception e) {
throw new java.lang.IllegalArgumentException("Unable to parse trigger text: " + text,
e);
}
if (trigger == null) {
throw new java.lang.IllegalArgumentException(
"Unable to parse trigger text: " + text);
}
setValue(trigger);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy