jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r788012 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java
Date Wed, 24 Jun 2009 13:11:34 GMT
Author: angela
Date: Wed Jun 24 13:11:34 2009
New Revision: 788012

URL: http://svn.apache.org/viewvc?rev=788012&view=rev
Log:
JCR-2087 Upgrade to Java 5 as the base platform
minor improvement


Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java?rev=788012&r1=788011&r2=788012&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java
Wed Jun 24 13:11:34 2009
@@ -126,7 +126,7 @@
      * key = name of the workspace,
      * value = {@link AccessControlProvider}
      */
-    private final Map acProviders = new HashMap();
+    private final Map<String, AccessControlProvider> acProviders = new HashMap();
 
     /**
      * the AccessControlProviderFactory
@@ -184,12 +184,12 @@
         Properties[] moduleConfig = authContextProvider.getModuleConfig();
 
         // retrieve default-ids (admin and anomymous) from login-module-configuration.
-        for (int i = 0; i < moduleConfig.length; i++) {
-            if (moduleConfig[i].containsKey(LoginModuleConfig.PARAM_ADMIN_ID)) {
-                adminId = moduleConfig[i].getProperty(LoginModuleConfig.PARAM_ADMIN_ID);
+        for (Properties props : moduleConfig) {
+            if (props.containsKey(LoginModuleConfig.PARAM_ADMIN_ID)) {
+                adminId = props.getProperty(LoginModuleConfig.PARAM_ADMIN_ID);
             }
-            if (moduleConfig[i].containsKey(LoginModuleConfig.PARAM_ANONYMOUS_ID)) {
-                anonymousId = moduleConfig[i].getProperty(LoginModuleConfig.PARAM_ANONYMOUS_ID);
+            if (props.containsKey(LoginModuleConfig.PARAM_ANONYMOUS_ID)) {
+                anonymousId = props.getProperty(LoginModuleConfig.PARAM_ANONYMOUS_ID);
             }
         }
         // fallback:
@@ -228,8 +228,8 @@
         // 2) create registry instance
         principalProviderRegistry = new ProviderRegistryImpl(defaultPP);
         // 3) register all configured principal providers.
-        for (int i = 0; i < moduleConfig.length; i++) {
-            principalProviderRegistry.registerProvider(moduleConfig[i]);
+        for (Properties props : moduleConfig) {
+            principalProviderRegistry.registerProvider(props);
         }
 
         // create the principal manager for the security workspace
@@ -244,7 +244,7 @@
     public void dispose(String workspaceName) {
         checkInitialized();
         synchronized (acProviders) {
-            AccessControlProvider prov = (AccessControlProvider) acProviders.remove(workspaceName);
+            AccessControlProvider prov = acProviders.remove(workspaceName);
             if (prov != null) {
                 prov.close();
             }
@@ -257,9 +257,9 @@
     public void close() {
         checkInitialized();
         synchronized (acProviders) {
-            Iterator itr = acProviders.values().iterator();
+            Iterator<AccessControlProvider> itr = acProviders.values().iterator();
             while (itr.hasNext()) {
-                ((AccessControlProvider) itr.next()).close();
+                itr.next().close();
             }
             acProviders.clear();
         }
@@ -289,7 +289,8 @@
             throw e;
         } catch (Exception e) {
             // wrap in RepositoryException
-            String msg = "Failed to instantiate AccessManager (" + amConfig.getClassName()
+ ")";
+            String clsName = (amConfig == null) ? "-- missing access manager configuration
--" : amConfig.getClassName();
+            String msg = "Failed to instantiate AccessManager (" + clsName + ")";
             log.error(msg, e);
             throw new RepositoryException(msg, e);
         }
@@ -411,7 +412,7 @@
             throws NoSuchWorkspaceException, RepositoryException {
         checkInitialized();
         synchronized (acProviders) {
-            AccessControlProvider provider = (AccessControlProvider) acProviders.get(workspaceName);
+            AccessControlProvider provider = acProviders.get(workspaceName);
             if (provider == null) {
                 SystemSession systemSession = repository.getSystemSession(workspaceName);
                 WorkspaceConfig conf = repository.getConfig().getWorkspaceConfig(workspaceName);



Mime
View raw message