continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r209559 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/core/ continuum-core/src/mai...
Date Thu, 07 Jul 2005 01:28:54 GMT
Author: jvanzyl
Date: Wed Jul  6 18:28:51 2005
New Revision: 209559

URL: http://svn.apache.org/viewcvs?rev=209559&view=rev
Log:
o adding some code to allow the deletion of notifiers. i can't delete a 
  notifier with a detached copy of a project. the notifier instance must
  be attached before it can be deleted.
  
o added some preliminary notification wizard stuff so that users can 
  configure mail and irc notifications. need to get the jabber and msn
  going.
  

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
    maven/continuum/trunk/continuum-web/src/main/resources/forms/antProject.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/shellProject.xml
    maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Wed Jul  6 18:28:51 2005
@@ -86,4 +86,11 @@
 
     List getChangedFilesForBuild( String buildId )
         throws ContinuumStoreException;
+
+    // ----------------------------------------------------------------------
+    // Notifiers
+    // ----------------------------------------------------------------------
+
+    void removeNotifier( Object oid )
+        throws ContinuumStoreException;
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Jul  6 18:28:51 2005
@@ -45,12 +45,16 @@
 import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
 import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
 import org.apache.maven.continuum.execution.ant.AntBuildExecutor;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.model.Notifier;
 
 import org.codehaus.plexus.action.ActionManager;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.ExceptionUtils;
 
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l </a>
@@ -505,18 +509,12 @@
     public void addNotifier( String projectId, String notifierType, Map configuration )
         throws ContinuumException
     {
-        System.out.println( "projectId = " + projectId );
-
-        System.out.println( "notifierType = " + notifierType );
-
-        System.out.println( "configuration = " + configuration );
-
         ContinuumNotifier notifier = new ContinuumNotifier();
 
         notifier.setType( notifierType );
 
         // ----------------------------------------------------------------------
-        // Needs to be properties ...
+        // Needs to be properties ... but data comes in via a Map
         // ----------------------------------------------------------------------
 
         Properties notifierProperties = new Properties();
@@ -545,34 +543,25 @@
     public void removeNotifier( String projectId, String notifierType )
         throws ContinuumException
     {
-        System.out.println( "Here removing the notifier!" );
-
-        System.out.println( "projectId = " + projectId );
-
-        System.out.println( "notifierType = " + notifierType );
-
         ContinuumProject project = core.getProject( projectId );
 
         List notifiers = project.getNotifiers();
 
-        System.out.println( "notifiers.size() = " + notifiers.size() );
+        ContinuumNotifier n = null;
 
         for ( Iterator i = notifiers.iterator(); i.hasNext(); )
         {
-            ContinuumNotifier n = (ContinuumNotifier) i.next();
+            n = (ContinuumNotifier) i.next();
 
             if ( n.getType().equals( notifierType ) )
             {
-                System.out.println( "n.getType() = " + n.getType() );
-
-                i.remove();
+                break;
             }
         }
 
-        System.out.println( "notifiers.size() = " + notifiers.size() );
-
-        project.setNotifiers( notifiers );
-
-        core.updateProject( project );
+        if ( n != null )
+        {
+            core.removeNotifier( n );
+        }
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/ContinuumCore.java
Wed Jul  6 18:28:51 2005
@@ -57,6 +57,9 @@
     void buildProject( String projectId, boolean force )
         throws ContinuumException;
 
+    void removeNotifier( Object oid )
+        throws ContinuumException;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
Wed Jul  6 18:28:51 2005
@@ -175,6 +175,19 @@
         }
     }
 
+    public void removeNotifier( Object oid )
+        throws ContinuumException
+    {
+        try
+        {
+            store.removeNotifier( oid );
+        }
+        catch ( ContinuumStoreException ex )
+        {
+            throw logAndCreateException( "Error while removing notifier.", ex );
+        }
+    }
+
     public void updateProject( ContinuumProject project )
         throws ContinuumException
     {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
Wed Jul  6 18:28:51 2005
@@ -237,11 +237,17 @@
     public ContinuumProject getProject( String projectId )
         throws ContinuumStoreException
     {
+        return getProject( projectId, true );
+    }
+
+    public ContinuumProject getProject( String projectId, boolean detach )
+        throws ContinuumStoreException
+    {
         try
         {
             store.begin();
 
-            ContinuumProject project = store.getContinuumProject( projectId, true );
+            ContinuumProject project = store.getContinuumProject( projectId, detach );
 
             setProjectState( project );
 
@@ -489,6 +495,33 @@
         catch ( Exception e )
         {
             getLogger().error( "Error while rolling back tx.", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    // Notifiers
+    // ----------------------------------------------------------------------
+
+    public void removeNotifier( Object notifier )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            PersistenceManager pm = store.getThreadState().getPersistenceManager();
+
+            notifier = pm.attachCopy( notifier, false );
+
+            pm.deletePersistent( notifier );
+
+            store.commit();
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while removing a notifier.", e );
         }
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/ContinuumJPoxStoreTest.java
Wed Jul  6 18:28:51 2005
@@ -23,6 +23,7 @@
 import javax.jdo.JDODetachedFieldAccessException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.JDOHelper;
 
 import org.apache.maven.continuum.scm.CheckOutScmResult;
 import org.apache.maven.continuum.scm.ScmFile;

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
Wed Jul  6 18:28:51 2005
@@ -41,6 +41,9 @@
 
 import org.codehaus.plexus.jdo.JdoFactory;
 
+import javax.jdo.PersistenceManager;
+import javax.jdo.JDOHelper;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -963,5 +966,5 @@
         assertEquals( "project.executorId", builderId, actual.getExecutorId() );
 
         assertEquals( "project.workingDirectory", workingDirectory, actual.getWorkingDirectory()
);
-    }
+    }    
 }

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/antProject.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/antProject.xml?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/antProject.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/antProject.xml Wed Jul  6
18:28:51 2005
@@ -23,6 +23,7 @@
     <action>addEntity</action>
     <view>Summary.vm</view>
     <view-on-failure>Add.vm</view-on-failure>
+    <fid-on-failure>antProject</fid-on-failure>    
     <expression>addAntProject(#entity)</expression>
   </add>
 

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/notificationMail.xml Wed
Jul  6 18:28:51 2005
@@ -8,7 +8,7 @@
       <immutable>true</immutable>
     </element>
     <element>
-      <id>mailAddress</id>
+      <id>address</id>
       <validators>
         <validator>
           <id>required</id>
@@ -25,6 +25,7 @@
     <action>callMethod</action>
     <view>Summary.vm</view>
     <view-on-failure>Add.vm</view-on-failure>
+    <fid-on-failure>notificationMail</fid-on-failure>
     <expression>addNotifier(#id,#notifierType,#parameters)</expression>
   </add>
 

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/shellProject.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/shellProject.xml?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/shellProject.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/shellProject.xml Wed Jul
 6 18:28:51 2005
@@ -27,6 +27,7 @@
     <action>addEntity</action>
     <view>Summary.vm</view>
     <view-on-failure>Add.vm</view-on-failure>
+    <fid-on-failure>shellProject</fid-on-failure>
     <expression>addShellProject(#entity)</expression>
   </add>
 

Modified: maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties?rev=209559&r1=209558&r2=209559&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
Wed Jul  6 18:28:51 2005
@@ -121,14 +121,14 @@
 
 ircNotificationTitle = IRC Notification
 
-ircHost.label = IRC Host
-ircHost.error = You must enter a host.
-ircHost.message = Enter the IRC host i.e. irc.codehaus.org
+host.label = IRC Host
+host.error = You must enter a host.
+host.message = Enter the IRC host i.e. irc.codehaus.org
 
-ircPort.label = IRC Port
-ircPort.error = You must enter a port number
-ircPort.message = Enter the IRC port i.e. 6667
+port.label = IRC Port
+port.error = You must enter a port number
+port.message = Enter the IRC port i.e. 6667
 
-ircChannel.label = IRC Channel
-ircChannel.error = You must enter an IRC channel
-ircChannel.message = Enter an IRC channel i.e. #maven
\ No newline at end of file
+channel.label = IRC Channel
+channel.error = You must enter an IRC channel
+channel.message = Enter an IRC channel i.e. #maven
\ No newline at end of file



Mime
View raw message