jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r826668 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/config/ main/java/org/apache/jackrabbit/core/security/authorization/ main/java/org/apache/jackrabbit/core/securit...
Date Mon, 19 Oct 2009 13:39:07 GMT
Author: jukka
Date: Mon Oct 19 13:39:06 2009
New Revision: 826668

URL: http://svn.apache.org/viewvc?rev=826668&view=rev
Log:
JCR-1438: Replace Config classes with factories

Revert previous change (r826653) to avoid conflicts with uncommitted changes from Angela.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/DefaultSecurityManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlProviderFactoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleSecurityManager.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/SecurityConfigTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.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=826668&r1=826667&r2=826668&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
Mon Oct 19 13:39:06 2009
@@ -214,8 +214,7 @@
         // create the workspace access manager
         SecurityManagerConfig smc = config.getSecurityManagerConfig();
         if (smc != null && smc.getWorkspaceAccessConfig() != null) {
-            workspaceAccessManager =
-                smc.getWorkspaceAccessConfig().newInstance(WorkspaceAccessManager.class);
+            workspaceAccessManager = (WorkspaceAccessManager) smc.getWorkspaceAccessConfig().newInstance();
         } else {
             // fallback -> the default implementation
             log.debug("No WorkspaceAccessManager configured; using default.");
@@ -302,7 +301,7 @@
                 log.debug("No configuration entry for AccessManager. Using org.apache.jackrabbit.core.security.DefaultAccessManager");
                 accessMgr = new DefaultAccessManager();
             } else {
-                accessMgr = amConfig.newInstance(AccessManager.class);
+                accessMgr = (AccessManager) amConfig.newInstance();
             }
 
             accessMgr.init(amContext, pp, workspaceAccessManager);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Mon Oct 19 13:39:06 2009
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.StringReader;
@@ -447,7 +448,7 @@
                 log.debug("No configuration entry for SecurityManager. Using org.apache.jackrabbit.core.security.simple.SimpleSecurityManager");
                 securityMgr = new SimpleSecurityManager();
             } else {
-                securityMgr = smc.newInstance(JackrabbitSecurityManager.class);
+                securityMgr = (JackrabbitSecurityManager) smc.newInstance();
             }
 
             securityMgr.init(this, securitySession);
@@ -1393,7 +1394,7 @@
                                                                DataStore dataStore)
             throws RepositoryException {
         try {
-            PersistenceManager pm = pmConfig.newInstance(PersistenceManager.class);
+            PersistenceManager pm = (PersistenceManager) pmConfig.newInstance();
             pm.init(new PMContext(homeDir, fs, rootNodeId, nsReg, ntReg, dataStore));
             return pm;
         } catch (Exception e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
Mon Oct 19 13:39:06 2009
@@ -16,29 +16,23 @@
  */
 package org.apache.jackrabbit.core.config;
 
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
+import org.apache.commons.collections.BeanMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.io.InputStream;
+import java.io.IOException;
+
 /**
  * Bean configuration class. BeanConfig instances contain the class name
  * and property information required to instantiate a class that conforms
  * with the JavaBean conventions.
  */
-public class BeanConfig {
+public class BeanConfig<T> {
 
     private static Logger log = LoggerFactory.getLogger(BeanConfig.class);
 
@@ -157,40 +151,38 @@
      * @return new bean instance
      * @throws ConfigurationException on bean configuration errors
      */
-    @SuppressWarnings("unchecked")
-    public <T> T newInstance(Class<T> klass) throws ConfigurationException {
+    public Object newInstance() throws ConfigurationException {
         try {
+            // Instantiate the object using the default constructor
             Class<?> objectClass =
                 Class.forName(getClassName(), true, getClassLoader());
-            if (!klass.isAssignableFrom(objectClass)) {
-                throw new ConfigurationException(
-                        "Configured class "+getClassName()
-                        + " does not implement " + klass.getName()
-                        + ". Please fix the repository configuration.");
-            }
-
-            // Instantiate the object using the default constructor
-            Object instance = objectClass.newInstance();
+            Object object = objectClass.newInstance();
 
             // Set all configured bean properties
-            List<?> names = Collections.list(properties.propertyNames());
-            BeanInfo info = Introspector.getBeanInfo(objectClass, Object.class);
-            for (PropertyDescriptor property : info.getPropertyDescriptors()) {
-                String value = properties.getProperty(property.getName());
+            BeanMap map = new BeanMap(object);
+            for (Object key : map.keySet()) {
+                String value = properties.getProperty(key.toString());
                 if (value != null) {
-                    setProperty(instance, property, value);
-                    names.remove(property.getName());
+                    map.put(key, value);
                 }
             }
 
-            // Check that no invalid property names were configured
-            if (validate && !names.isEmpty()) {
-                throw new ConfigurationException(
-                        "Configured class " + getClassName()
-                        + " does not contain the properties " + names);
+            if (validate) {
+                // Check that no invalid property names were configured
+                for (Object key : properties.keySet()) {
+                    if (!map.containsKey(key)
+                            && properties.getProperty(key.toString()) != null) {
+                        String msg =
+                            "Configured class " + object.getClass().getName()
+                            + " does not contain the property " + key
+                            + ". Please fix the repository configuration.";
+                        log.error(msg);
+                        throw new ConfigurationException(msg);
+                    }
+                }
             }
 
-            return (T) instance;
+            return (T) object;
         } catch (ClassNotFoundException e) {
             throw new ConfigurationException(
                     "Configured bean implementation class " + getClassName()
@@ -203,71 +195,6 @@
             throw new ConfigurationException(
                     "Configured bean implementation class " + getClassName()
                     + " is protected.", e);
-        } catch (IntrospectionException e) {
-            throw new ConfigurationException(
-                    "Configured bean implementation class " + getClassName()
-                    + " can not be introspected", e);
-        }
-    }
-
-    private void setProperty(
-            Object instance, PropertyDescriptor property, String value)
-            throws ConfigurationException {
-        Method method = property.getWriteMethod();
-        if (method == null) {
-            throw new ConfigurationException(
-                    "Property " + property.getName() + " of class "
-                    + getClassName() + " can not be written"); 
-        }
-
-        Class<?>[] types = method.getParameterTypes();
-        if (types.length != 1) {
-            throw new ConfigurationException(
-                    "Property " + property.getName() + " of class "
-                    + getClassName() + " has an invalid setter");
-        }
-
-        Class<?> type = types[0];
-        try {
-            if (types[0].isAssignableFrom(String.class)
-                || types[0].isAssignableFrom(Object.class)) {
-                method.invoke(instance, value);
-            } else if (types[0].isAssignableFrom(Boolean.TYPE)
-                    || types[0].isAssignableFrom(Boolean.class)) {
-                method.invoke(instance, Boolean.valueOf(value));
-            } else if (types[0].isAssignableFrom(Integer.TYPE)
-                    || types[0].isAssignableFrom(Integer.class)) {
-                method.invoke(instance, Integer.valueOf(value));
-            } else if (types[0].isAssignableFrom(Long.TYPE)
-                    || types[0].isAssignableFrom(Long.class)) {
-                method.invoke(instance, Long.valueOf(value));
-            } else if (types[0].isAssignableFrom(Double.TYPE)
-                    || types[0].isAssignableFrom(Double.class)) {
-                method.invoke(instance, Double.valueOf(value));
-            } else {
-                throw new ConfigurationException(
-                        "The type (" + type.getName()
-                        + ") of property " + property.getName() + " of class "
-                        + getClassName() + " is not supported");
-            }
-        } catch (NumberFormatException e) {
-            throw new ConfigurationException(
-                    "Invalid number format (" + value + ") for property "
-                    + property.getName() + " of class " + getClassName(), e);
-        } catch (InvocationTargetException e) {
-            throw new ConfigurationException(
-                    "Property " + property.getName() + " of class "
-                    + getClassName() + " can not be set to \"" + value + "\"",
-                    e);
-        } catch (IllegalAccessException e) {
-            throw new ConfigurationException(
-                    "The setter of property " + property.getName()
-                    + " of class " + getClassName() + " can not be accessed",
-                    e);
-        } catch (IllegalArgumentException e) {
-            throw new ConfigurationException(
-                    "Unable to call the setter of property "
-                    + property.getName() + " of class " + getClassName(), e);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java
Mon Oct 19 13:39:06 2009
@@ -60,6 +60,12 @@
     }
 
     public LoginModule getLoginModule() throws ConfigurationException {
-        return newInstance(LoginModule.class);
+        Object result = newInstance();
+        if (result instanceof LoginModule) {
+            return (LoginModule) result;
+        } else {
+            throw new ConfigurationException("Invalid login module implementation class "
+                    + getClassName() + ".");
+        }
     }
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
Mon Oct 19 13:39:06 2009
@@ -552,7 +552,7 @@
                                 className, parseParameters(element));
 
                         QueryHandler handler =
-                            config.newInstance(QueryHandler.class);
+                            (QueryHandler) config.newInstance();
                         try {
                             handler.init(fs, context);
                             return handler;
@@ -622,7 +622,14 @@
             public ISMLocking getISMLocking() throws RepositoryException {
                 Element element = getElement(parent, ISM_LOCKING_ELEMENT, false);
                 if (element != null) {
-                    return parseBeanConfig(element).newInstance(ISMLocking.class);
+                    BeanConfig config = parseBeanConfig(element);
+                    try {
+                        return (ISMLocking) config.newInstance();
+                    } catch (ClassCastException e) {
+                        throw new RepositoryException(
+                                "Invalid ISMLocking class: "
+                                + config.getClassName(), e);
+                    }
                 } else {
                     return new DefaultISMLocking();
                 }
@@ -757,18 +764,25 @@
             public Journal getJournal(NamespaceResolver resolver)
                     throws RepositoryException {
                 BeanConfig config = parseBeanConfig(cluster, JOURNAL_ELEMENT);
-                Journal journal = config.newInstance(Journal.class);
-                if (journal instanceof AbstractJournal) {
-                    ((AbstractJournal) journal).setRepositoryHome(home);
-                }
-                try {
-                    journal.init(id, resolver);
-                } catch (JournalException e) {
-                    // TODO: Should JournalException extend RepositoryException?
+                Object object = config.newInstance();
+                if (object instanceof Journal) {
+                    Journal journal = (Journal) object;
+                    if (journal instanceof AbstractJournal) {
+                        ((AbstractJournal) journal).setRepositoryHome(home);
+                    }
+                    try {
+                        journal.init(id, resolver);
+                    } catch (JournalException e) {
+                        // TODO: Should JournalException extend RepositoryException?
+                        throw new RepositoryException(
+                                "Journal initialization failed: " + journal, e);
+                    }
+                    return journal;
+                } else {
                     throw new RepositoryException(
-                            "Journal initialization failed: " + journal, e);
+                            "Invalid Journal implementation class: "
+                            + config.getClassName());
                 }
-                return journal;
             }
         };
     }
@@ -802,7 +816,7 @@
                             && DATA_STORE_ELEMENT.equals(child.getNodeName())) {
                         BeanConfig bc =
                             parseBeanConfig(parent, DATA_STORE_ELEMENT);
-                        DataStore store = bc.newInstance(DataStore.class);
+                        DataStore store = (DataStore) bc.newInstance();
                         store.init(directory);
                         return store;
                     }
@@ -832,6 +846,7 @@
     protected RepositoryLockMechanismFactory getRepositoryLockMechanismFactory(final Element
root) {
         return new RepositoryLockMechanismFactory() {
             public RepositoryLockMechanism getRepositoryLockMechanism() throws RepositoryException
{
+                RepositoryLockMechanism lock = null;
                 NodeList children = root.getChildNodes();
                 for (int i = 0; i < children.getLength(); i++) {
                     Node child = children.item(i);
@@ -839,10 +854,14 @@
                             && REPOSITORY_LOCK_MECHANISM_ELEMENT.equals(child.getNodeName()))
{
                         BeanConfig bc =
                             parseBeanConfig(root, REPOSITORY_LOCK_MECHANISM_ELEMENT);
-                        return bc.newInstance(RepositoryLockMechanism.class);
+                        lock = (RepositoryLockMechanism) bc.newInstance();
+                        break;
                     }
                 }
-                return new RepositoryLock();
+                if (lock == null) {
+                    lock = new RepositoryLock();
+                }
+                return lock;
             }
         };
     }
@@ -889,9 +908,13 @@
         return new FileSystemFactory() {
             public FileSystem getFileSystem() throws RepositoryException {
                 try {
-                    FileSystem fs = config.newInstance(FileSystem.class);
+                    FileSystem fs = (FileSystem) config.newInstance();
                     fs.init();
                     return fs;
+                } catch (ClassCastException e) {
+                    throw new RepositoryException(
+                            "Invalid file system implementation class: "
+                            + config.getClassName(), e);
                 } catch (FileSystemException e) {
                     throw new RepositoryException(
                             "File system initialization failure.", e);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlProviderFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlProviderFactoryImpl.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlProviderFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlProviderFactoryImpl.java
Mon Oct 19 13:39:06 2009
@@ -74,7 +74,7 @@
         Map props;
         if (config != null && config.getAccessControlProviderConfig() != null) {
             BeanConfig bc = config.getAccessControlProviderConfig();
-            prov = bc.newInstance(AccessControlProvider.class);
+            prov = (AccessControlProvider) bc.newInstance();
             props = bc.getParameters();
         } else {
             log.debug("No ac-provider configuration for workspace " + workspaceName + " ->
using defaults.");

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleSecurityManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleSecurityManager.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleSecurityManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/simple/SimpleSecurityManager.java
Mon Oct 19 13:39:06 2009
@@ -176,8 +176,7 @@
 
         SecurityManagerConfig smc = config.getSecurityManagerConfig();
         if (smc != null && smc.getWorkspaceAccessConfig() != null) {
-            workspaceAccessManager =
-                smc.getWorkspaceAccessConfig().newInstance(WorkspaceAccessManager.class);
+            workspaceAccessManager = (WorkspaceAccessManager) smc.getWorkspaceAccessConfig().newInstance();
         } else {
             // fallback -> the default simple implementation
             log.debug("No WorkspaceAccessManager configured; using default.");
@@ -217,7 +216,7 @@
             if (amc == null) {
                 accessMgr = new SimpleAccessManager();
             } else {
-                accessMgr = amc.newInstance(AccessManager.class);
+                accessMgr = (AccessManager) amc.newInstance();
             }
             accessMgr.init(amContext, acP, workspaceAccessManager);
             return accessMgr;

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/RepositoryConfigTest.java
Mon Oct 19 13:39:06 2009
@@ -213,8 +213,7 @@
 
         BeanConfig bc = smc.getWorkspaceAccessConfig();
         if (bc != null) {
-            WorkspaceAccessManager wac =
-                smc.getWorkspaceAccessConfig().newInstance(WorkspaceAccessManager.class);
+            WorkspaceAccessManager wac = (WorkspaceAccessManager) smc.getWorkspaceAccessConfig().newInstance();
             assertEquals("org.apache.jackrabbit.core.security.simple.SimpleWorkspaceAccessManager",
wac.getClass().getName());
         }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/SecurityConfigTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/SecurityConfigTest.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/SecurityConfigTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/SecurityConfigTest.java
Mon Oct 19 13:39:06 2009
@@ -17,9 +17,7 @@
 package org.apache.jackrabbit.core.config;
 
 import org.apache.jackrabbit.core.DefaultSecurityManager;
-import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.security.DefaultAccessManager;
-import org.apache.jackrabbit.core.security.JackrabbitSecurityManager;
 import org.apache.jackrabbit.core.security.user.UserManagerImpl;
 import org.apache.jackrabbit.core.security.authentication.DefaultLoginModule;
 import org.apache.jackrabbit.core.security.simple.SimpleAccessManager;
@@ -68,12 +66,12 @@
 
         SecurityManagerConfig smc = config.getSecurityManagerConfig();
         assertNotNull(smc);
-        assertTrue(smc.newInstance(JackrabbitSecurityManager.class) instanceof SimpleSecurityManager);
+        assertTrue(smc.newInstance() instanceof SimpleSecurityManager);
         assertNull(smc.getWorkspaceAccessConfig());
         assertNull(smc.getWorkspaceName());
 
         assertNotNull(config.getAccessManagerConfig());
-        assertTrue(config.getAccessManagerConfig().newInstance(AccessManager.class) instanceof
SimpleAccessManager);
+        assertTrue(config.getAccessManagerConfig().newInstance() instanceof SimpleAccessManager);
 
         assertNull(config.getLoginModuleConfig());
     }
@@ -87,7 +85,7 @@
 
         SecurityManagerConfig smc = config.getSecurityManagerConfig();
         assertNotNull(smc);
-        assertTrue(smc.newInstance(JackrabbitSecurityManager.class) instanceof DefaultSecurityManager);
+        assertTrue(smc.newInstance() instanceof DefaultSecurityManager);
         assertNull(smc.getWorkspaceAccessConfig());
         assertEquals("security", smc.getWorkspaceName());
 
@@ -95,7 +93,7 @@
 
         AccessManagerConfig amc = config.getAccessManagerConfig();
         assertNotNull(amc);
-        assertTrue(amc.newInstance(AccessManager.class) instanceof DefaultAccessManager);
+        assertTrue(amc.newInstance() instanceof DefaultAccessManager);
 
         LoginModuleConfig lmc = config.getLoginModuleConfig();
         assertNotNull(lmc);

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java?rev=826668&r1=826667&r2=826668&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/config/WorkspaceConfigTest.java
Mon Oct 19 13:39:06 2009
@@ -64,7 +64,7 @@
         if (ws != null) {
             BeanConfig ppfConfig =  ws.getAccessControlProviderConfig();
             if (ppfConfig != null) {
-                ppfConfig.newInstance(AccessControlProvider.class);
+                AccessControlProvider prov = (AccessControlProvider) ppfConfig.newInstance();
             }
         }
     }



Mime
View raw message