continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r467436 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
Date Tue, 24 Oct 2006 18:50:07 GMT
Author: jmcconnell
Date: Tue Oct 24 11:50:07 2006
New Revision: 467436

URL: http://svn.apache.org/viewvc?view=rev&rev=467436
Log:
this should get the notifiers working dispatch wise...and this is a bit different from the
actual loading of the group/project notifiers so I ought to be able to get away with committing
this and then rahul's work should start functioning.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java?view=diff&rev=467436&r1=467435&r2=467436
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/notification/DefaultContinuumNotificationDispatcher.java
Tue Oct 24 11:50:07 2006
@@ -21,6 +21,7 @@
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectNotifier;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -132,6 +133,24 @@
 
                 context.put( CONTEXT_UPDATE_SCM_RESULT, build.getScmResult() );
             }
+
+
+            ProjectGroup projectGroup = store.getProjectGroupWithBuildDetails( project.getProjectGroup().getId()
);
+
+            // perform the project lvl notifications
+            for ( Iterator i = project.getNotifiers().iterator(); i.hasNext(); )
+            {
+                sendNotification( messageId, (ProjectNotifier) i.next(), context );
+            }
+
+            // perform the project group lvl notifications
+            if ( projectGroup.getNotifiers() != null )
+            {
+                for ( Iterator i = projectGroup.getNotifiers().iterator(); i.hasNext(); )
+                {
+                    sendNotification( messageId, (ProjectNotifier) i.next(), context );
+                }
+            }            
         }
         catch ( ContinuumStoreException e )
         {
@@ -145,37 +164,35 @@
 
             return;
         }
+    }
 
-        for ( Iterator i = project.getNotifiers().iterator(); i.hasNext(); )
-        {
-            ProjectNotifier projectNotifier = (ProjectNotifier) i.next();
-
-            String notifierType = projectNotifier.getType();
+    private void sendNotification( String messageId, ProjectNotifier projectNotifier, Map
context )
+    {
+        String notifierType = projectNotifier.getType();
 
-            if ( !projectNotifier.isEnabled() )
-            {
-                getLogger().info( notifierType + " notifier (id=" + projectNotifier.getId()
+ ") is disabled." );
+        if ( !projectNotifier.isEnabled() )
+        {
+            getLogger().info( notifierType + " notifier (id=" + projectNotifier.getId() +
") is disabled." );
 
-                continue;
-            }
+            return;
+        }
 
-            Map configuration = projectNotifier.getConfiguration();
+        Map configuration = projectNotifier.getConfiguration();
 
-            try
-            {
-                context.put( CONTEXT_PROJECT_NOTIFIER, projectNotifier );
+        try
+        {
+            context.put( CONTEXT_PROJECT_NOTIFIER, projectNotifier );
 
-                Notifier notifier = notifierManager.getNotifier( notifierType );
+            Notifier notifier = notifierManager.getNotifier( notifierType );
 
-                Set recipients = recipientSource.getRecipients( String.valueOf( projectNotifier.getId()
), messageId,
-                                                                configuration, context );
+            Set recipients = recipientSource.getRecipients( String.valueOf( projectNotifier.getId()
), messageId,
+                                                            configuration, context );
 
-                notifier.sendNotification( messageId, recipients, configuration, context
);
-            }
-            catch ( NotificationException e )
-            {
-                getLogger().error( "Error while trying to use the " + notifierType + "notifier.",
e );
-            }
+            notifier.sendNotification( messageId, recipients, configuration, context );
+        }
+        catch ( NotificationException e )
+        {
+            getLogger().error( "Error while trying to use the " + notifierType + "notifier.",
e );
         }
     }
 }



Mime
View raw message