本文整理汇总了Java中org.quartz.impl.matchers.GroupMatcher.getCompareWithOperator方法的典型用法代码示例。如果您正苦于以下问题:Java GroupMatcher.getCompareWithOperator方法的具体用法?Java GroupMatcher.getCompareWithOperator怎么用?Java GroupMatcher.getCompareWithOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.impl.matchers.GroupMatcher
的用法示例。
在下文中一共展示了GroupMatcher.getCompareWithOperator方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pauseTriggers
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Pause all of the <code>{@link Trigger}s</code> in the given group.
* </p>
* <p>
* The JobStore should "remember" that the group is paused, and impose the pause on any new triggers that are added to
* the group while the group is paused.
* </p>
*/
@Override
public Collection<String> pauseTriggers(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException {
HashSet<String> pausedGroups = new HashSet<String>();
lock();
try {
Set<TriggerKey> triggerKeys = getTriggerKeys(matcher);
for (TriggerKey key : triggerKeys) {
triggerFacade.addPausedGroup(key.getGroup());
pausedGroups.add(key.getGroup());
pauseTrigger(key);
}
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS)) {
triggerFacade.addPausedGroup(matcher.getCompareToValue());
pausedGroups.add(matcher.getCompareToValue());
}
} finally {
unlock();
}
return pausedGroups;
}
示例2: pauseJobs
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the given group - by pausing all of their
* <code>Trigger</code>s.
* </p>
* <p>
* The JobStore should "remember" that the group is paused, and impose the pause on any new jobs that are added to the
* group while the group is paused.
* </p>
*/
@Override
public Collection<String> pauseJobs(GroupMatcher<JobKey> matcher) throws JobPersistenceException {
Collection<String> pausedGroups = new HashSet<String>();
lock();
try {
Set<JobKey> jobKeys = getJobKeys(matcher);
for (JobKey jobKey : jobKeys) {
for (OperableTrigger trigger : getTriggersForJob(jobKey)) {
pauseTrigger(trigger.getKey());
}
pausedGroups.add(jobKey.getGroup());
}
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS)) {
jobFacade.addPausedGroup(matcher.getCompareToValue());
pausedGroups.add(matcher.getCompareToValue());
}
} finally {
unlock();
}
return pausedGroups;
}
示例3: pauseJobs
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
* passing the <code>SchedulingContext</code> associated with this
* instance.
* </p>
*/
public void pauseJobs(GroupMatcher<JobKey> matcher) throws SchedulerException {
String operation = null;
switch (matcher.getCompareWithOperator()) {
case EQUALS:
operation = "pauseJobGroup";
break;
case STARTS_WITH:
operation = "pauseJobsStartingWith";
break;
case ENDS_WITH:
operation = "pauseJobsEndingWith";
break;
case CONTAINS:
operation = "pauseJobsContaining";
case ANYTHING:
operation = "pauseJobsAll";
}
invoke(
operation,
new Object[] { matcher.getCompareToValue() },
new String[] { String.class.getName() });
}
示例4: resumeJobs
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
* passing the <code>SchedulingContext</code> associated with this
* instance.
* </p>
*/
public void resumeJobs(GroupMatcher<JobKey> matcher) throws SchedulerException {
String operation = null;
switch (matcher.getCompareWithOperator()) {
case EQUALS:
operation = "resumeJobGroup";
break;
case STARTS_WITH:
operation = "resumeJobsStartingWith";
break;
case ENDS_WITH:
operation = "resumeJobsEndingWith";
break;
case CONTAINS:
operation = "resumeJobsContaining";
case ANYTHING:
operation = "resumeJobsAll";
}
invoke(
operation,
new Object[] { matcher.getCompareToValue() },
new String[] { String.class.getName() });
}
示例5: toSqlLikeClause
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
protected String toSqlLikeClause(final GroupMatcher<?> matcher) {
String groupName;
switch(matcher.getCompareWithOperator()) {
case EQUALS:
groupName = matcher.getCompareToValue();
break;
case CONTAINS:
groupName = "%" + matcher.getCompareToValue() + "%";
break;
case ENDS_WITH:
groupName = "%" + matcher.getCompareToValue();
break;
case STARTS_WITH:
groupName = matcher.getCompareToValue() + "%";
break;
case ANYTHING:
groupName = "%";
break;
default:
throw new UnsupportedOperationException("Don't know how to translate " + matcher.getCompareWithOperator() + " into SQL");
}
return groupName;
}
示例6: getJobKeys
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Job}</code> s that have the given group name.
* </p>
*/
@Override
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws JobPersistenceException {
lock();
try {
Set<String> matchingGroups = new HashSet<String>();
switch (matcher.getCompareWithOperator()) {
case EQUALS:
matchingGroups.add(matcher.getCompareToValue());
break;
default:
for (String group : jobFacade.getAllGroupNames()) {
if (matcher.getCompareWithOperator().evaluate(group, matcher.getCompareToValue())) {
matchingGroups.add(group);
}
}
}
Set<JobKey> out = new HashSet<JobKey>();
for (String matchingGroup : matchingGroups) {
Set<String> grpJobNames = toolkitDSHolder.getOrCreateJobsGroupMap(matchingGroup);
for (String jobName : grpJobNames) {
JobKey jobKey = new JobKey(jobName, matchingGroup);
if (jobFacade.containsKey(jobKey)) {
out.add(jobKey);
}
}
}
return out;
} finally {
unlock();
}
}
示例7: getTriggerKeys
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Trigger}</code> s that have the given group name.
* </p>
*/
@Override
public Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) throws JobPersistenceException {
lock();
try {
Set<String> groupNames = new HashSet<String>();
switch (matcher.getCompareWithOperator()) {
case EQUALS:
groupNames.add(matcher.getCompareToValue());
break;
default:
for (String group : triggerFacade.allTriggersGroupNames()) {
if (matcher.getCompareWithOperator().evaluate(group, matcher.getCompareToValue())) {
groupNames.add(group);
}
}
}
Set<TriggerKey> out = new HashSet<TriggerKey>();
for (String groupName : groupNames) {
Set<String> grpSet = toolkitDSHolder.getOrCreateTriggersGroupMap(groupName);
for (String key : grpSet) {
TriggerKey triggerKey = new TriggerKey(key, groupName);
TriggerWrapper tw = triggerFacade.get(triggerKey);
if (tw != null) {
out.add(triggerKey);
}
}
}
return out;
} finally {
unlock();
}
}
示例8: pauseTriggers
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Pause all of the known <code>{@link Trigger}s</code> matching.
* </p>
*
* <p>
* The JobStore should "remember" the groups paused, and impose the
* pause on any new triggers that are added to one of these groups while the group is
* paused.
* </p>
*
*/
public List<String> pauseTriggers(GroupMatcher<TriggerKey> matcher) {
List<String> pausedGroups;
synchronized (lock) {
pausedGroups = new LinkedList<String>();
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
switch (operator) {
case EQUALS:
if(pausedTriggerGroups.add(matcher.getCompareToValue())) {
pausedGroups.add(matcher.getCompareToValue());
}
break;
default :
for (String group : triggersByGroup.keySet()) {
if(operator.evaluate(group, matcher.getCompareToValue())) {
if(pausedTriggerGroups.add(matcher.getCompareToValue())) {
pausedGroups.add(group);
}
}
}
}
for (String pausedGroup : pausedGroups) {
Set<TriggerKey> keys = getTriggerKeys(GroupMatcher.triggerGroupEquals(pausedGroup));
for (TriggerKey key: keys) {
pauseTrigger(key);
}
}
}
return pausedGroups;
}
示例9: pauseJobs
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Pause all of the <code>{@link org.quartz.JobDetail}s</code> in the
* given group - by pausing all of their <code>Trigger</code>s.
* </p>
*
*
* <p>
* The JobStore should "remember" that the group is paused, and impose the
* pause on any new jobs that are added to the group while the group is
* paused.
* </p>
*/
public List<String> pauseJobs(GroupMatcher<JobKey> matcher) {
List<String> pausedGroups = new LinkedList<String>();
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
switch (operator) {
case EQUALS:
if (pausedJobGroups.add(matcher.getCompareToValue())) {
pausedGroups.add(matcher.getCompareToValue());
}
break;
default :
for (String group : jobsByGroup.keySet()) {
if(operator.evaluate(group, matcher.getCompareToValue())) {
if (pausedJobGroups.add(group)) {
pausedGroups.add(group);
}
}
}
}
for (String groupName : pausedGroups) {
for (JobKey jobKey: getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
List<OperableTrigger> triggersOfJob = getTriggersForJob(jobKey);
for (OperableTrigger trigger: triggersOfJob) {
pauseTrigger(trigger.getKey());
}
}
}
}
return pausedGroups;
}
示例10: pauseTriggers
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
* passing the <code>SchedulingContext</code> associated with this
* instance.
* </p>
*/
public void pauseTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException {
String operation = null;
switch (matcher.getCompareWithOperator()) {
case EQUALS:
operation = "pauseTriggerGroup";
break;
case CONTAINS:
operation = "pauseTriggersContaining";
break;
case STARTS_WITH:
operation = "pauseTriggersStartingWith";
break;
case ENDS_WITH:
operation = "pauseTriggersEndingWith";
case ANYTHING:
operation = "pauseTriggersAll";
}
if (operation != null) {
invoke(
operation,
new Object[] { matcher.getCompareToValue() },
new String[] { String.class.getName() });
} else {
throw new SchedulerException("Unsupported GroupMatcher kind for pausing triggers: " + matcher.getCompareWithOperator());
}
}
示例11: resumeTriggers
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>,
* passing the <code>SchedulingContext</code> associated with this
* instance.
* </p>
*/
public void resumeTriggers(GroupMatcher<TriggerKey> matcher) throws SchedulerException {
String operation = null;
switch (matcher.getCompareWithOperator()) {
case EQUALS:
operation = "resumeTriggerGroup";
break;
case CONTAINS:
operation = "resumeTriggersContaining";
break;
case STARTS_WITH:
operation = "resumeTriggersStartingWith";
break;
case ENDS_WITH:
operation = "resumeTriggersEndingWith";
case ANYTHING:
operation = "resumeTriggersAll";
}
if (operation != null) {
invoke(
operation,
new Object[] { matcher.getCompareToValue() },
new String[] { String.class.getName() });
} else {
throw new SchedulerException("Unsupported GroupMatcher kind for resuming triggers: " + matcher.getCompareWithOperator());
}
}
示例12: pauseTriggerGroup
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Pause all of the <code>{@link org.quartz.Trigger}s</code> matching the
* given groupMatcher.
* </p>
*
* @see #resumeTriggerGroup(java.sql.Connection, org.quartz.impl.matchers.GroupMatcher)
*/
public Set<String> pauseTriggerGroup(Connection conn,
GroupMatcher<TriggerKey> matcher) throws JobPersistenceException {
try {
getDelegate().updateTriggerGroupStateFromOtherStates(
conn, matcher, STATE_PAUSED, STATE_ACQUIRED,
STATE_WAITING, STATE_WAITING);
getDelegate().updateTriggerGroupStateFromOtherState(
conn, matcher, STATE_PAUSED_BLOCKED, STATE_BLOCKED);
List<String> groups = getDelegate().selectTriggerGroups(conn, matcher);
// make sure to account for an exact group match for a group that doesn't yet exist
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
if (operator.equals(StringOperatorName.EQUALS) && !groups.contains(matcher.getCompareToValue())) {
groups.add(matcher.getCompareToValue());
}
for (String group : groups) {
if (!getDelegate().isTriggerGroupPaused(conn, group)) {
getDelegate().insertPausedTriggerGroup(conn, group);
}
}
return new HashSet<String>(groups);
} catch (SQLException e) {
throw new JobPersistenceException("Couldn't pause trigger group '"
+ matcher + "': " + e.getMessage(), e);
}
}
示例13: getJobKeys
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Job}</code> s that
* match the given groupMatcher.
* </p>
*/
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) {
Set<JobKey> outList = null;
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
String compareToValue = matcher.getCompareToValue();
switch(operator) {
case EQUALS:
HashMap<JobKey, JobWrapper> grpMap = jobsByGroup.get(compareToValue);
if (grpMap != null) {
outList = new HashSet<JobKey>();
for (JobWrapper jw : grpMap.values()) {
if (jw != null) {
outList.add(jw.jobDetail.getKey());
}
}
}
break;
default:
for (Map.Entry<String, HashMap<JobKey, JobWrapper>> entry : jobsByGroup.entrySet()) {
if(operator.evaluate(entry.getKey(), compareToValue) && entry.getValue() != null) {
if(outList == null) {
outList = new HashSet<JobKey>();
}
for (JobWrapper jobWrapper : entry.getValue().values()) {
if(jobWrapper != null) {
outList.add(jobWrapper.jobDetail.getKey());
}
}
}
}
}
}
return outList == null ? java.util.Collections.<JobKey>emptySet() : outList;
}
示例14: getTriggerKeys
import org.quartz.impl.matchers.GroupMatcher; //导入方法依赖的package包/类
/**
* <p>
* Get the names of all of the <code>{@link org.quartz.Trigger}</code> s
* that match the given groupMatcher.
* </p>
*/
public Set<TriggerKey> getTriggerKeys(GroupMatcher<TriggerKey> matcher) {
Set<TriggerKey> outList = null;
synchronized (lock) {
StringMatcher.StringOperatorName operator = matcher.getCompareWithOperator();
String compareToValue = matcher.getCompareToValue();
switch(operator) {
case EQUALS:
HashMap<TriggerKey, TriggerWrapper> grpMap = triggersByGroup.get(compareToValue);
if (grpMap != null) {
outList = new HashSet<TriggerKey>();
for (TriggerWrapper tw : grpMap.values()) {
if (tw != null) {
outList.add(tw.trigger.getKey());
}
}
}
break;
default:
for (Map.Entry<String, HashMap<TriggerKey, TriggerWrapper>> entry : triggersByGroup.entrySet()) {
if(operator.evaluate(entry.getKey(), compareToValue) && entry.getValue() != null) {
if(outList == null) {
outList = new HashSet<TriggerKey>();
}
for (TriggerWrapper triggerWrapper : entry.getValue().values()) {
if(triggerWrapper != null) {
outList.add(triggerWrapper.trigger.getKey());
}
}
}
}
}
}
return outList == null ? Collections.<TriggerKey>emptySet() : outList;
}