本文整理了Java中hudson.triggers.Trigger
类的一些代码示例,展示了Trigger
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger
类的具体详情如下:
包路径:hudson.triggers.Trigger
类名称:Trigger
[英]Triggers a Build.
To register a custom Trigger from a plugin, put Extension on your TriggerDescriptor class.
[中]触发一个构建。
要从插件注册自定义触发器,请在TriggerDescriptor类上添加扩展名。
代码示例来源:origin: jenkinsci/jenkins
@Override public void start(@Nonnull Job project, boolean newInstance) {
super.start(project, newInstance);
RunListenerImpl.get().invalidateCache();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl)super.getDescriptor();
}
代码示例来源:origin: jenkinsci/jenkins
r.addAll(trigger.getProjectActions());
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Error loading trigger.", e);
代码示例来源:origin: jenkinsci/jenkins
t.stop();
triggers.replaceBy(buildDescribable(req, Trigger.for_(this)));
for (Trigger t : triggers())
t.start(this,true);
代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder
public void addTrigger(Trigger trigger) {
Trigger old = triggers.get(trigger.getDescriptor());
if (old != null) {
old.stop();
triggers.remove(old);
}
triggers.add(trigger);
trigger.start(this, true);
}
代码示例来源:origin: jenkinsci/jenkins
@Override public void stop() {
super.stop();
RunListenerImpl.get().invalidateCache();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the trigger descriptor by name. Primarily used for making them web-visible.
*/
public TriggerDescriptor getTrigger(String shortClassName) {
return (TriggerDescriptor) findDescriptor(shortClassName, Trigger.all());
}
代码示例来源:origin: jenkinsci/jenkins
public void run(AbstractProject p) {
for (Trigger t : (Collection<Trigger>) p.getTriggers().values()) {
if (t instanceof SCMTrigger) {
LOGGER.fine("synchronously triggering SCMTrigger for project " + t.job.getName());
t.run();
}
}
}
}));
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns a subset of {@link TriggerDescriptor}s that applys to the given item.
*
* @deprecated as of 1.286
* Use {@link Trigger#for_(Item)}.
*/
@Deprecated
public static List<TriggerDescriptor> getApplicableTriggers(Item i) {
return Trigger.for_(i);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* {@link Action}s to be displayed in the job page.
*
* @return
* can be empty but never null
* @since 1.341
*/
public Collection<? extends Action> getProjectActions() {
// delegate to getJobAction (singular) for backward compatible behavior
Action a = getProjectAction();
if (a==null) return Collections.emptyList();
return Collections.singletonList(a);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public void run(AbstractProject p) {
for (Trigger t : (Collection<Trigger>) p.getTriggers().values()) {
if (t instanceof SCMTrigger) {
LOGGER.fine("synchronously triggering SCMTrigger for jobs " + t.getJobNames());
t.run();
}
}
}
}));
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
public void addTrigger(Trigger trigger) {
Trigger old = triggers.get(trigger.getDescriptor());
if (old != null) {
old.stop();
triggers.remove(old);
}
triggers.add(trigger);
trigger.start(this, true);
}
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job
public void stopTriggers() {
for (Trigger trigger : triggers) {
trigger.stop();
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns a subset of {@link TriggerDescriptor}s that applys to the given item.
*/
public static List<TriggerDescriptor> for_(Item i) {
List<TriggerDescriptor> r = new ArrayList<>();
for (TriggerDescriptor t : all()) {
if(!t.isApplicable(i)) continue;
if (i instanceof TopLevelItem) {// ugly
TopLevelItemDescriptor tld = ((TopLevelItem) i).getDescriptor();
// tld shouldn't be really null in contract, but we often write test Describables that
// doesn't have a Descriptor.
if(tld!=null && !tld.isApplicable(t)) continue;
}
r.add(t);
}
return r;
}
}
代码示例来源:origin: jenkinsci/jenkins
LOGGER.log(Level.CONFIG, "cron triggered {0}", p);
try {
t.run();
} catch (Throwable e) {
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Returns a subset of {@link TriggerDescriptor}s that applys to the given item.
*
* @deprecated as of 1.286
* Use {@link Trigger#for_(Item)}.
*/
public static List<TriggerDescriptor> getApplicableTriggers(Item i) {
return Trigger.for_(i);
}
}
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
public Action superGetProjectAction() {
return super.getProjectAction();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
super.onLoad(parent, name);
if (buildMixIn == null) {
buildMixIn = createBuildMixIn();
}
buildMixIn.onLoad(parent, name);
builds = buildMixIn.getRunMap();
triggers().setOwner(this);
for (Trigger t : triggers()) {
try {
t.start(this, Items.currentlyUpdatingByXml());
} catch (Throwable e) {
LOGGER.log(Level.WARNING, "could not start trigger while loading project '" + getFullName() + "'", e);
}
}
if(scm==null)
scm = new NullSCM(); // perhaps it was pointing to a plugin that no longer exists.
if(transientActions==null)
transientActions = new Vector<Action>(); // happens when loaded from disk
updateTransientActions();
}
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
public Collection<? extends Action> superGetProjectActions() {
return super.getProjectActions();
}
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-job
public Trigger getTriggerForDescriptor(TriggerDescriptor td) {
for (Trigger trigger : triggers) {
if (td.equals(trigger.getDescriptor())) {
return trigger;
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!