Title: [40589] trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views: adding maven mailer
Revision
40589
Author
jacob_robertson
Date
2012-05-22 21:54:53 -0400 (Tue, 22 May 2012)

Log Message

adding maven mailer

Modified Paths


Added Paths

Diff

Added: trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailMavenValuesProvider.java (0 => 40589)


--- trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailMavenValuesProvider.java	                        (rev 0)
+++ trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailMavenValuesProvider.java	2012-05-23 01:54:53 UTC (rev 40589)
@@ -0,0 +1,38 @@
+package hudson.views;
+
+import hudson.maven.MavenReporter;
+import hudson.maven.MavenModuleSet;
+import hudson.maven.reporters.MavenMailer;
+import hudson.model.TopLevelItem;
+import hudson.tasks.Publisher;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EmailMavenValuesProvider extends AbstractEmailValuesProvider {
+
+	@Override
+	public List<String> getValues(TopLevelItem item) {
+		if (item instanceof MavenModuleSet) {
+			List<String> values = new ArrayList<String>();
+			MavenModuleSet maven = (MavenModuleSet) item;
+			for (MavenReporter reporter: maven.getReporters().toList()) {
+				if (reporter instanceof MavenMailer) {
+					MavenMailer mailer = (MavenMailer) reporter;
+					values.add(mailer.recipients);
+				}
+			}
+			return values;
+		} else {
+			return null;
+		}
+	}
+	@Override
+	protected String getValue(Publisher publisher) {
+		throw new UnsupportedOperationException();
+	}
+	@SuppressWarnings("unchecked")
+	public Class getPluginTesterClass() {
+		return MavenMailer.class;
+	}
+}
Property changes on: trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailMavenValuesProvider.java
___________________________________________________________________

Added: svn:mime-type

Modified: trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailValuesHelper.java (40588 => 40589)


--- trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailValuesHelper.java	2012-05-23 01:31:44 UTC (rev 40588)
+++ trunk/hudson/plugins/view-job-filters/src/main/java/hudson/views/EmailValuesHelper.java	2012-05-23 01:54:53 UTC (rev 40589)
@@ -35,10 +35,18 @@
 		} catch (Throwable e) {
 			// plug-in probably not installed
 		}
+		try {
+			matchers.add(buildEmailMaven());
+		} catch (Throwable e) {
+			// plug-in probably not installed
+		}
 		return matchers;
 	}
 	private static AbstractEmailValuesProvider buildEmailExt() {
 		return PluginHelperUtils.validateAndThrow(new EmailExtValuesProvider());
 	}
+	private static AbstractEmailValuesProvider buildEmailMaven() {
+		return PluginHelperUtils.validateAndThrow(new EmailMavenValuesProvider());
+	}
 	
 }

Reply via email to