archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1433402 - in /archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role: DefaultRoleManager.java processor/DefaultRoleModelProcessor.java template/DefaultRoleTemplateProcessor.java
Date Tue, 15 Jan 2013 13:24:14 GMT
Author: olamy
Date: Tue Jan 15 13:24:14 2013
New Revision: 1433402

URL: http://svn.apache.org/viewvc?rev=1433402&view=rev
Log:
fix compilation issues

Modified:
    archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/DefaultRoleManager.java
    archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/processor/DefaultRoleModelProcessor.java
    archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/template/DefaultRoleTemplateProcessor.java

Modified: archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/DefaultRoleManager.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/DefaultRoleManager.java?rev=1433402&r1=1433401&r2=1433402&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/DefaultRoleManager.java
(original)
+++ archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/DefaultRoleManager.java
Tue Jan 15 13:24:14 2013
@@ -440,15 +440,22 @@ public class DefaultRoleManager
         }
         else
         {
-            if ( rbacManager.roleExists( modelRole.getName() ) )
+            try
             {
-                return true;
+                if ( rbacManager.roleExists( modelRole.getName() ) )
+                {
+                    return true;
+                }
+                else
+                {
+                    // perhaps try and reload the model here?
+                    throw new RoleManagerException(
+                        "breakdown in role management, role exists in configuration but was
not created in underlying store" );
+                }
             }
-            else
+            catch ( RbacManagerException e )
             {
-                // perhaps try and reload the model here?
-                throw new RoleManagerException(
-                    "breakdown in role management, role exists in configuration but was not
created in underlying store" );
+                throw new RoleManagerException( e.getMessage(), e );
             }
         }
     }
@@ -465,13 +472,20 @@ public class DefaultRoleManager
         }
         else
         {
-            if ( rbacManager.roleExists( modelTemplate.getNamePrefix() + modelTemplate.getDelimiter()
+ resource ) )
+            try
             {
-                return true;
+                if ( rbacManager.roleExists( modelTemplate.getNamePrefix() + modelTemplate.getDelimiter()
+ resource ) )
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
             }
-            else
+            catch ( RbacManagerException e )
             {
-                return false;
+                throw new RoleManagerException( e.getMessage(), e );
             }
         }
     }

Modified: archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/processor/DefaultRoleModelProcessor.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/processor/DefaultRoleModelProcessor.java?rev=1433402&r1=1433401&r2=1433402&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/processor/DefaultRoleModelProcessor.java
(original)
+++ archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/processor/DefaultRoleModelProcessor.java
Tue Jan 15 13:24:14 2013
@@ -49,16 +49,15 @@ import java.util.Map;
  * DefaultRoleModelProcessor: inserts the components of the model that can be populated into
the rbac manager
  *
  * @author: Jesse McConnell <jesse@codehaus.org>
- *
  */
-@Service( "roleModelProcessor" )
+@Service("roleModelProcessor")
 public class DefaultRoleModelProcessor
     implements RoleModelProcessor
 {
     private Logger log = LoggerFactory.getLogger( DefaultRoleModelProcessor.class );
 
     @Inject
-    @Named( value = "rbacManager#cached" )
+    @Named(value = "rbacManager#cached")
     private RBACManager rbacManager;
 
     private Map<String, Resource> resourceMap = new HashMap<String, Resource>();
@@ -76,7 +75,7 @@ public class DefaultRoleModelProcessor
         processRoles( model );
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private void processResources( RedbackRoleModel model )
         throws RoleManagerException
     {
@@ -111,7 +110,7 @@ public class DefaultRoleModelProcessor
         }
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private void processOperations( RedbackRoleModel model )
         throws RoleManagerException
     {
@@ -148,7 +147,7 @@ public class DefaultRoleModelProcessor
         }
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private void processRoles( RedbackRoleModel model )
         throws RoleManagerException
     {
@@ -168,7 +167,18 @@ public class DefaultRoleModelProcessor
 
             List<Permission> permissions = processPermissions( roleProfile.getPermissions()
);
 
-            if ( !rbacManager.roleExists( roleProfile.getName() ) )
+            boolean roleExists = false;
+
+            try
+            {
+                roleExists = rbacManager.roleExists( roleProfile.getName() );
+            }
+            catch ( RbacManagerException e )
+            {
+                throw new RoleManagerException( e.getMessage(), e );
+            }
+
+            if ( !roleExists )
             {
                 try
                 {

Modified: archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/template/DefaultRoleTemplateProcessor.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/template/DefaultRoleTemplateProcessor.java?rev=1433402&r1=1433401&r2=1433402&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/template/DefaultRoleTemplateProcessor.java
(original)
+++ archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-role-manager/src/main/java/org/apache/archiva/redback/role/template/DefaultRoleTemplateProcessor.java
Tue Jan 15 13:24:14 2013
@@ -50,17 +50,17 @@ import java.util.List;
  *
  * @author: Jesse McConnell <jesse@codehaus.org>
  */
-@Service( "roleTemplateProcessor" )
+@Service("roleTemplateProcessor")
 public class DefaultRoleTemplateProcessor
     implements RoleTemplateProcessor
 {
     private Logger log = LoggerFactory.getLogger( DefaultRoleTemplateProcessor.class );
 
     @Inject
-    @Named( value = "rbacManager#cached" )
+    @Named(value = "rbacManager#cached")
     private RBACManager rbacManager;
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public void create( RedbackRoleModel model, String templateId, String resource )
         throws RoleManagerException
     {
@@ -84,7 +84,7 @@ public class DefaultRoleTemplateProcesso
         throw new RoleManagerException( "unknown template '" + templateId + "'" );
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public void remove( RedbackRoleModel model, String templateId, String resource )
         throws RoleManagerException
     {
@@ -173,7 +173,7 @@ public class DefaultRoleTemplateProcesso
         }
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private void processTemplate( RedbackRoleModel model, ModelTemplate template, String
resource )
         throws RoleManagerException
     {
@@ -181,7 +181,18 @@ public class DefaultRoleTemplateProcesso
 
         List<Permission> permissions = processPermissions( model, template, resource
);
 
-        if ( !rbacManager.roleExists( templateName ) )
+        boolean roleExists = false;
+
+        try
+        {
+            roleExists = rbacManager.roleExists( templateName );
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new RoleManagerException( e.getMessage(), e );
+        }
+
+        if ( !roleExists )
         {
             try
             {
@@ -344,7 +355,7 @@ public class DefaultRoleTemplateProcesso
         }
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     private List<Permission> processPermissions( RedbackRoleModel model, ModelTemplate
template, String resource )
         throws RoleManagerException
     {



Mime
View raw message