本文整理汇总了Java中hudson.tasks.Publisher类的典型用法代码示例。如果您正苦于以下问题:Java Publisher类的具体用法?Java Publisher怎么用?Java Publisher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Publisher类属于hudson.tasks包,在下文中一共展示了Publisher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCheck
import hudson.tasks.Publisher; //导入依赖的package包/类
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
if (item instanceof Project) {
Project project = (Project) item;
DescribableList<Publisher, Descriptor<Publisher>> publishersList = project.getPublishersList();
for (Publisher publisher : publishersList) {
if (publisher instanceof ArtifactArchiver) {
LOG.log(Level.FINEST, "ArtifactChecker " + publisher);
return (((ArtifactArchiver) publisher).getArtifacts() == null ||
(((ArtifactArchiver) publisher).getArtifacts() != null &&
((ArtifactArchiver) publisher).getArtifacts().length() == 0));
}
}
}
return false;
}
示例2: getPublishersList
import hudson.tasks.Publisher; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public DescribableList<Publisher, Descriptor<Publisher>> getPublishersList() {
// TODO(mattmoor): switch to utilize something with an atomic
// compare/exchange semantic.
if (publishers != null) {
return publishers;
}
// NOTE: I believe this is lazily initialized vs. created in the
// constructor so that lazy API consumers can omit an empty publisher list
// from their serialized XML blob.
synchronized (this) {
if (publishers == null) {
publishers =
new DescribableList<Publisher, Descriptor<Publisher>>(this);
}
}
return publishers;
}
示例3: getPublishersList
import hudson.tasks.Publisher; //导入依赖的package包/类
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList(
IMode mode) {
InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>> gov =
new InheritanceGovernor<DescribableList<Publisher, Descriptor<Publisher>>>(
"publishersList", SELECTOR.PUBLISHER, this) {
@Override
protected DescribableList<Publisher, Descriptor<Publisher>> castToDestinationType(Object o) {
return castToDescribableList(o);
}
@Override
public DescribableList<Publisher, Descriptor<Publisher>> getRawField(
InheritanceProject ip) {
return ip.getRawPublishersList();
}
@Override
protected DescribableList<Publisher, Descriptor<Publisher>> reduceFromFullInheritance(
Deque<DescribableList<Publisher, Descriptor<Publisher>>> list) {
return InheritanceGovernor.reduceDescribableByMerge(list);
}
};
return gov.retrieveFullyDerivedField(this, mode);
}
示例4: isManualTrigger
import hudson.tasks.Publisher; //导入依赖的package包/类
public boolean isManualTrigger(AbstractProject<?, ?> project) {
List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
for (AbstractProject upstreamProject : upstreamProjects) {
DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists =
upstreamProject.getPublishersList();
for (Publisher upstreamPub : upstreamPublishersLists) {
if (upstreamPub instanceof BuildPipelineTrigger) {
String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
return true;
}
}
}
}
return false;
}
示例5: getUpstreamManualTriggered
import hudson.tasks.Publisher; //导入依赖的package包/类
@Override
public List<AbstractProject> getUpstreamManualTriggered(AbstractProject<?, ?> project) {
List<AbstractProject> result = new ArrayList<>();
List<AbstractProject> upstreamProjects = project.getUpstreamProjects();
for (AbstractProject upstream : upstreamProjects) {
@SuppressWarnings("unchecked")
DescribableList<Publisher, Descriptor<Publisher>> upstreamPublishersLists = upstream.getPublishersList();
for (Publisher upstreamPub : upstreamPublishersLists) {
if (upstreamPub instanceof BuildPipelineTrigger) {
String names = ((BuildPipelineTrigger) upstreamPub).getDownstreamProjectNames();
if (ProjectUtil.getProjectList(names, project.getParent(), null).contains(project)) {
result.add(upstream);
}
}
}
}
return result;
}
示例6: findPublisher
import hudson.tasks.Publisher; //导入依赖的package包/类
public static OTCNotifier findPublisher(AbstractBuild r){
List<Publisher> publisherList = r.getProject().getPublishersList().toList();
//ensure that there is an OTCNotifier in the project
for(Publisher publisher: publisherList){
if(publisher instanceof OTCNotifier){
return (OTCNotifier) publisher;
}
}
return null;
}
示例7: testFindPublisher
import hudson.tasks.Publisher; //导入依赖的package包/类
@Test
public void testFindPublisher() {
OTCNotifier otcNotifier = mock(OTCNotifier.class);
AbstractBuild r = mock(AbstractBuild.class);
AbstractProject project = mock(AbstractProject.class);
DescribableList<Publisher, Descriptor<Publisher>> describableList = mock(DescribableList.class);
ArrayList<Publisher> publisherList = new ArrayList<Publisher>();
publisherList.add(otcNotifier);
when(r.getProject()).thenReturn(project);
when(project.getPublishersList()).thenReturn(describableList);
when(describableList.toList()).thenReturn(publisherList);
assertEquals(otcNotifier, EventHandler.findPublisher(r));
}
示例8: getApplicableDescriptors
import hudson.tasks.Publisher; //导入依赖的package包/类
public Collection<? extends Descriptor<?>> getApplicableDescriptors() {
// Jenkins.instance.getDescriptorList(SimpleBuildStep) is empty, presumably because that itself is not a Describable.
List<Descriptor<?>> r = new ArrayList<>();
populate(r, Builder.class);
populate(r, Publisher.class);
return r;
}
示例9: getService
import hudson.tasks.Publisher; //导入依赖的package包/类
private JdumpService getService(AbstractBuild builder, TaskListener listener) {
Map<Descriptor<Publisher>, Publisher> map = builder.getProject().getPublishersList().toMap();
for (Publisher publisher : map.values()) {
if (publisher instanceof JdumpNotifier) {
return ((JdumpNotifier) publisher).newJdumpService(builder, listener);
}
}
return null;
}
示例10: newInstance
import hudson.tasks.Publisher; //导入依赖的package包/类
/**
* Called when the user saves the project configuration.
*/
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData)
throws FormException {
PlotPipelinePublisher publisher = new PlotPipelinePublisher(true);
for (Object data : SeriesFactory.getArray(formData.get("plots"))) {
publisher.addPlot(bindPlot((JSONObject) data, req));
}
return publisher;
}
示例11: newInstance
import hudson.tasks.Publisher; //导入依赖的package包/类
/**
* This method is called by hudson if the user has clicked the add button of the Aptly site hosts point in the System Configuration
* web page. It's create a new instance of the {@link AptlyPublisher} class and added all configured ftp sites to this instance by calling
* the method {@link AptlyPublisher#getEntries()} and on it's return value the addAll method is called.
*
* {@inheritDoc}
*
* @param req
* {@inheritDoc}
* @return {@inheritDoc}
* @see hudson.model.Descriptor#newInstance(org.kohsuke.stapler.StaplerRequest)
*/
@Override
public Publisher newInstance(StaplerRequest req, JSONObject formData) {
AptlyPublisher pub = new AptlyPublisher();
try {
List<PackageItem> entries = req.bindJSONToList(PackageItem.class, formData.get("packageItems"));
pub.getPackageItems().addAll(entries);
} catch (Exception e) {
LOG.severe(">> bindJSONToList Exception: " + e.getMessage());
return null;
}
return pub;
}
示例12: prebuild
import hudson.tasks.Publisher; //导入依赖的package包/类
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
if (startNotification) {
Map<Descriptor<Publisher>, Publisher> map = build.getProject().getPublishersList().toMap();
for (Publisher publisher : map.values()) {
if (publisher instanceof TelegramNotifier) {
logger.info("Invoking Started...");
new ActiveNotifier((TelegramNotifier) publisher, listener).started(build);
}
}
}
return super.prebuild(build, listener);
}
示例13: getNotifier
import hudson.tasks.Publisher; //导入依赖的package包/类
@SuppressWarnings("unchecked")
FineGrainedNotifier getNotifier(AbstractProject project, TaskListener listener) {
Map<Descriptor<Publisher>, Publisher> map = project.getPublishersList().toMap();
for (Publisher publisher : map.values()) {
if (publisher instanceof TelegramNotifier) {
return new ActiveNotifier((TelegramNotifier) publisher, (BuildListener)listener);
}
}
return new DisabledNotifier();
}
示例14: prebuild
import hudson.tasks.Publisher; //导入依赖的package包/类
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
if (startNotification) {
Map<Descriptor<Publisher>, Publisher> map = build.getProject().getPublishersList().toMap();
for (Publisher publisher : map.values()) {
if (publisher instanceof MattermostNotifier) {
logger.info("Invoking Started...");
new ActiveNotifier((MattermostNotifier)publisher, listener).started(build);
}
}
}
return super.prebuild(build, listener);
}
示例15: getNotifier
import hudson.tasks.Publisher; //导入依赖的package包/类
@SuppressWarnings("unchecked")
FineGrainedNotifier getNotifier(AbstractProject project, TaskListener listener) {
Map<Descriptor<Publisher>, Publisher> map = project.getPublishersList().toMap();
for (Publisher publisher : map.values()) {
if (publisher instanceof MattermostNotifier) {
return new ActiveNotifier((MattermostNotifier) publisher, (BuildListener)listener);
}
}
return new DisabledNotifier();
}