本文整理匯總了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();
}