continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r497761 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: DefaultContinuum.java core/action/AddAssignableRolesAction.java core/action/RemoveAssignableRolesAction.java
Date Fri, 19 Jan 2007 10:06:43 GMT
Author: evenisse
Date: Fri Jan 19 02:06:42 2007
New Revision: 497761

URL: http://svn.apache.org/viewvc?view=rev&rev=497761
Log:
[CONTINUUM-1075] Remove projectGroup roles when the project group is removed

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
  (with props)
Modified:
    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/action/AddAssignableRolesAction.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=497761&r1=497760&r2=497761
==============================================================================
--- 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
Fri Jan 19 02:06:42 2007
@@ -255,6 +255,12 @@
             }
         }
 
+        getLogger().info( "Remove project group" + projectGroup.getName() + "(" + projectGroup.getId()
+ ")" );
+
+        Map context = new HashMap();
+        context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId()
) );
+        executeAction( "remove-assignable-roles", context );
+
         store.removeProjectGroup( projectGroup );
     }
 
@@ -1073,11 +1079,12 @@
         return addMavenOneProject( metadataUrl, projectGroupId, true );
     }
 
-    public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId,
boolean checkProtocol )
+    public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId,
+                                                              boolean checkProtocol )
         throws ContinuumException
     {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenOneContinuumProjectBuilder.ID,
-                                                       projectGroupId, checkProtocol );
+        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenOneContinuumProjectBuilder.ID,
projectGroupId,
+                                                       checkProtocol );
     }
 
     // ----------------------------------------------------------------------
@@ -1106,8 +1113,8 @@
                                                               boolean checkProtocol )
         throws ContinuumException
     {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                       projectGroupId, checkProtocol );
+        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
projectGroupId,
+                                                       checkProtocol );
     }
 
     // ----------------------------------------------------------------------
@@ -1218,7 +1225,7 @@
                     return res;
                 }
             }
-            catch( FormicaException e )
+            catch ( FormicaException e )
             {
                 //can't be thrown
             }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java?view=diff&rev=497761&r1=497760&r2=497761
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
Fri Jan 19 02:06:42 2007
@@ -21,8 +21,8 @@
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
-import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.rbac.profile.RoleProfileException;
 import org.codehaus.plexus.rbac.profile.RoleProfileManager;
 import org.codehaus.plexus.security.rbac.Role;
@@ -33,11 +33,8 @@
  * AddAssignableRolesAction:
  *
  * @author: Jesse McConnell <jmcconnell@apache.org>
- * @version: $ID:$
- *
- * @plexus.component
- *   role="org.codehaus.plexus.action.Action"
- *   role-hint="add-assignable-roles"
+ * @version: $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="add-assignable-roles"
  */
 public class AddAssignableRolesAction
     extends AbstractContinuumAction
@@ -55,7 +52,7 @@
     public void execute( Map context )
         throws ContinuumException, ContinuumStoreException
     {
-        int projectGroupId =  getProjectGroupId( context );
+        int projectGroupId = getProjectGroupId( context );
 
         ProjectGroup projectGroup = store.getProjectGroupWithBuildDetails( projectGroupId
);
 

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java?view=auto&rev=497761
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
Fri Jan 19 02:06:42 2007
@@ -0,0 +1,70 @@
+package org.apache.maven.continuum.core.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+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.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+
+import java.util.Map;
+
+/**
+ * AddAssignableRolesAction:
+ *
+ * @author: Emmanuel Venisse <evenisse@apache.org>
+ * @version: $Id$
+ * @plexus.component role="org.codehaus.plexus.action.Action" role-hint="remove-assignable-roles"
+ */
+public class RemoveAssignableRolesAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    /**
+     * @plexus.requirement role-hint="continuum"
+     */
+    private RoleProfileManager roleManager;
+
+    public void execute( Map context )
+        throws ContinuumException, ContinuumStoreException
+    {
+        int projectGroupId = getProjectGroupId( context );
+
+        ProjectGroup projectGroup = store.getProjectGroup( projectGroupId );
+
+        try
+        {
+            roleManager.deleteDynamicRole( "continuum-group-developer", projectGroup.getName()
);
+
+            roleManager.deleteDynamicRole( "continuum-group-user", projectGroup.getName()
);
+        }
+        catch ( RoleProfileException rpe )
+        {
+            rpe.printStackTrace();
+            throw new ContinuumException( "error removing dynamic role for project " + projectGroup.getName(),
rpe );
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/RemoveAssignableRolesAction.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message