incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1401623 - in /sling/trunk/bundles/jcr/jackrabbit-server: ./ src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/ src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/ src/main/java/org/apache/sling/jcr/jackrabbit/server...
Date Wed, 24 Oct 2012 11:31:38 GMT
Author: cziegeler
Date: Wed Oct 24 11:31:38 2012
New Revision: 1401623

URL: http://svn.apache.org/viewvc?rev=1401623&view=rev
Log:
SLING-2624 : Improving Jackrabbit integration with OSGi Service Registry. Reverting as test
case is failing

Removed:
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/OsgiAwareSecurityManager.java
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/security/SlingDefaultLoginModule.java
Modified:
    sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml

Modified: sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/pom.xml?rev=1401623&r1=1401622&r2=1401623&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/pom.xml (original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/pom.xml Wed Oct 24 11:31:38 2012
@@ -97,10 +97,7 @@
                              org.apache.sling.jcr.jackrabbit.server;version=2.1.0,
                              org.apache.sling.jcr.jackrabbit.server.security;version=2.0.4-incubator,
                              org.apache.sling.jcr.jackrabbit.server.security.accessmanager;version=2.1.0,
-                             org.apache.jackrabbit.core.security.principal;version=2.2.5,
-                             org.apache.jackrabbit.core.security.authentication;version=2.2.5,
-                             org.apache.jackrabbit.core.security.authentication.token;version=2.2.5,
-                             org.apache.jackrabbit.core.security.user.action;version=2.4.0
+                             org.apache.jackrabbit.core.security.principal;version=2.2.5
                         </Export-Package>
                         <Private-Package>
                             org.apache.sling.jcr.jackrabbit.server.impl.*,
@@ -140,8 +137,6 @@
                             org.apache.jackrabbit.commons.*,
                             org.apache.jackrabbit.spi.commons.*,
 
-                            org.apache.felix.jaas.boot;resolution:=optional,
-
                             <!-- optional JDBC driver import -->
                             com.microsoft.sqlserver.jdbc;
                             oracle.jdbc;
@@ -160,17 +155,11 @@
                         <Embed-Transitive>true</Embed-Transitive>
                         <Embed-Dependency>
                             jackrabbit-core,
-                            org.apache.sling.jcr.jackrabbit.base,
                             lucene-core,
                             concurrent,
                             commons-dbcp,
                             commons-pool
                         </Embed-Dependency>
-                        <Jaas-ModuleClass>
-                            org.apache.jackrabbit.core.security.authentication.DefaultLoginModule,
-                            org.apache.jackrabbit.core.security.simple.SimpleLoginModule,
-                            org.apache.sling.jcr.jackrabbit.server.security.SlingDefaultLoginModule
-                        </Jaas-ModuleClass>
                         <_removeheaders>
                             Embed-Dependency,
                             Embed-Transitive,
@@ -211,12 +200,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.jcr.jackrabbit.base</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.base</artifactId>
             <version>2.1.0</version>
             <scope>compile</scope>
@@ -232,7 +215,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-core</artifactId>
-            <version>2.5.2</version>
+            <version>2.4.2</version>
             <scope>compile</scope>
         </dependency>
 

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java?rev=1401623&r1=1401622&r2=1401623&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/Activator.java
Wed Oct 24 11:31:38 2012
@@ -17,19 +17,14 @@
 package org.apache.sling.jcr.jackrabbit.server.impl;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.sling.jcr.base.AbstractSlingRepository;
 import org.apache.sling.jcr.base.util.RepositoryAccessor;
-import org.apache.sling.jcr.jackrabbit.base.config.OsgiBeanFactory;
-import org.apache.sling.jcr.jackrabbit.base.security.MultiplexingAuthorizableAction;
-import org.apache.sling.jcr.jackrabbit.base.security.PrincipalProviderTracker;
 import org.apache.sling.jcr.jackrabbit.server.security.LoginModulePlugin;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -43,7 +38,6 @@ import org.osgi.service.cm.Configuration
 import org.osgi.util.tracker.ServiceTracker;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xml.sax.InputSource;
 
 /**
  * The <code>Activator</code> TODO
@@ -90,12 +84,6 @@ public class Activator implements Bundle
     private String slingContext;
     private static AccessManagerFactoryTracker accessManagerFactoryTracker;
 
-    private static PrincipalProviderTracker principalProviderTracker;
-
-    private OsgiBeanFactory beanFactory;
-
-    private MultiplexingAuthorizableAction authorizableActionTracker;
-
     protected String getRepositoryName() {
     	String repoName = bundleContext.getProperty("sling.repository.name");
     	if (repoName != null) {
@@ -141,16 +129,6 @@ public class Activator implements Bundle
             accessManagerFactoryTracker = new AccessManagerFactoryTracker(bundleContext);
         }
         accessManagerFactoryTracker.open();
-
-        if(principalProviderTracker == null){
-            principalProviderTracker = new PrincipalProviderTracker(bundleContext);
-        }
-        principalProviderTracker.open();
-
-        if(authorizableActionTracker == null){
-            authorizableActionTracker = new MultiplexingAuthorizableAction(bundleContext);
-        }
-        authorizableActionTracker.open();
     }
 
     public void stop(BundleContext arg0) {
@@ -169,21 +147,6 @@ public class Activator implements Bundle
             accessManagerFactoryTracker = null;
         }
 
-        if(principalProviderTracker != null){
-            principalProviderTracker.close();
-            principalProviderTracker = null;
-        }
-
-        if(beanFactory != null){
-            beanFactory.close();
-            beanFactory = null;
-        }
-
-        if(authorizableActionTracker != null){
-            authorizableActionTracker.close();
-            authorizableActionTracker = null;
-        }
-
         // clear the bundle context field
         bundleContext = null;
     }
@@ -247,10 +210,6 @@ public class Activator implements Bundle
         return accessManagerFactoryTracker;
     }
 
-    public static PrincipalProviderTracker getPrincipalProviderTracker(){
-        return principalProviderTracker;
-    }
-
     // ---------- internal -----------------------------------------------------
 
     private void verifyConfiguration(ServiceReference ref) {
@@ -270,7 +229,6 @@ public class Activator implements Bundle
                     "verifyConfiguration: {} Configurations available for {}, nothing to
do",
                     new Object[] { new Integer(cfgs.length),
                         SERVER_REPOSITORY_FACTORY_PID });
-                createBeanFactory(cfgs[0]);
                 return;
             }
 
@@ -290,7 +248,7 @@ public class Activator implements Bundle
             // create the factory and set the properties
             Configuration config = ca.createFactoryConfiguration(SERVER_REPOSITORY_FACTORY_PID);
             config.update(defaultConfig);
-            createBeanFactory(config);
+
             log.info("verifyConfiguration: Created configuration {} for {}",
                 config.getPid(), config.getFactoryPid());
 
@@ -302,47 +260,6 @@ public class Activator implements Bundle
         }
     }
 
-    /**
-     * Creates the BeanFactory by finding out the location of repository
-     * configuration. Currently it depends on internal of SlingServerRepository implementation
on how it accesses the
-     * repository configuration.
-     *
-     * TODO - Find a better way to centralize logic related to configuration access
-     */
-    private void createBeanFactory(Configuration c){
-        InputSource source = null;
-        try {
-            Dictionary config = c.getProperties();
-            String home = (String) config.get(SlingServerRepository.REPOSITORY_HOME_DIR);
-
-            //1. Check override url
-            String configUrl = (String) config.get(RepositoryAccessor.REPOSITORY_URL_OVERRIDE_PROPERTY);
-
-            //2. Check default url
-            if(configUrl == null){
-              configUrl = (String) config.get(SlingServerRepository.REPOSITORY_CONFIG_URL);
-            }
-
-            //If url found create InputSource from it else
-            //point to repository home director
-            if(configUrl != null){
-                source = new InputSource(new FileInputStream(new File(configUrl)));
-            }else if(home != null){
-                String homePath = SlingServerRepository.getAbsoluteHomePath(config,bundleContext);
-                source = SlingServerRepository.getRepositoryConfigSource(new File(homePath));
-            }
-
-            if(source == null){
-                throw new IllegalStateException("Cannot determine repository configuration
file location");
-            }
-
-            beanFactory = new OsgiBeanFactory(bundleContext);
-            beanFactory.initialize(source);
-        } catch (Exception e) {
-            throw new RuntimeException("Error occurred while initializing bean factory",e);
-        }
-    }
-
     private void initDefaultConfig(Hashtable<String, String> props, BundleContext bundleContext)
throws IOException {
         String slingHomePath = bundleContext.getProperty("sling.home");
         String home = getHomePath(bundleContext, slingHomePath);

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java?rev=1401623&r1=1401622&r2=1401623&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
Wed Oct 24 11:31:38 2012
@@ -35,14 +35,10 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
 import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
 import org.apache.jackrabbit.api.management.RepositoryManager;
 import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.config.BeanFactory;
-import org.apache.jackrabbit.core.config.ConfigurationException;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.core.config.RepositoryConfigurationParser;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.base.AbstractSlingRepository;
 import org.apache.sling.jcr.jackrabbit.server.impl.security.AdministrativeCredentials;
@@ -51,7 +47,6 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.log.LogService;
-import org.xml.sax.InputSource;
 
 /**
  * The <code>SlingServerRepository</code> TODO
@@ -95,9 +90,6 @@ public class SlingServerRepository exten
     @Property(value="")
     public static final String REPOSITORY_REGISTRATION_NAME = "name";
 
-    @Reference
-    private BeanFactory beanFactory;
-
     //---------- Repository Management ----------------------------------------
 
     @Override
@@ -110,8 +102,21 @@ public class SlingServerRepository exten
         @SuppressWarnings("unchecked")
         Dictionary<String, Object> environment = this.getComponentContext().getProperties();
         String configURLObj = (String) environment.get(REPOSITORY_CONFIG_URL);
-        String home = getAbsoluteHomePath(environment,getComponentContext().getBundleContext());
+        String home = (String) environment.get(REPOSITORY_HOME_DIR);
+
+        // ensure absolute home (path)
         File homeFile = new File(home);
+        if (!homeFile.isAbsolute()) {
+            BundleContext context = getComponentContext().getBundleContext();
+            String slingHomePath = context.getProperty("sling.home");
+            if (slingHomePath != null) {
+                homeFile = new File(slingHomePath, home);
+            } else {
+                homeFile = homeFile.getAbsoluteFile();
+            }
+            home = homeFile.getAbsolutePath();
+        }
+
         // somewhat dirty hack to have the derby.log file in a sensible
         // location, but don't overwrite anything already set
         if (System.getProperty("derby.stream.error.file") == null) {
@@ -152,9 +157,9 @@ public class SlingServerRepository exten
                         log(LogService.LOG_INFO, "Using configuration file " + configFile.getAbsolutePath());
                     }
                 }
-                crc = create(new InputSource(ins), homeFile);
+                crc = RepositoryConfig.create(ins, home);
             } else {
-                crc = create(getRepositoryConfigSource(homeFile), homeFile);
+                crc = RepositoryConfig.create(homeFile);
             }
 
             return RepositoryImpl.create(crc);
@@ -184,7 +189,6 @@ public class SlingServerRepository exten
         return null;
     }
 
-
     @Override
     protected void disposeRepository(Repository repository) {
         super.disposeRepository(repository);
@@ -299,27 +303,6 @@ public class SlingServerRepository exten
         }
     }
 
-    public static String getAbsoluteHomePath(Dictionary<String, Object> p,BundleContext
context){
-        String home = (String) p.get(REPOSITORY_HOME_DIR);
-
-        // ensure absolute home (path)
-        File homeFile = new File(home);
-        if (!homeFile.isAbsolute()) {
-            String slingHomePath = context.getProperty("sling.home");
-            if (slingHomePath != null) {
-                homeFile = new File(slingHomePath, home);
-            } else {
-                homeFile = homeFile.getAbsoluteFile();
-            }
-            home = homeFile.getAbsolutePath();
-        }
-        return home;
-    }
-
-    public static InputSource getRepositoryConfigSource(File homeFile) throws FileNotFoundException
{
-        return new InputSource(new FileInputStream(new File(homeFile, "repository.xml")));
-    }
-
     /**
      * {@inheritDoc}
      * @see org.apache.sling.jcr.base.AbstractSlingRepository#getAdministrativeCredentials(java.lang.String)
@@ -337,16 +320,4 @@ public class SlingServerRepository exten
     protected Credentials getAnonCredentials(String anonUser) {
         return new AnonCredentials(anonUser);
     }
-
-    private RepositoryConfig create(InputSource xml, File dir) throws ConfigurationException
{
-        java.util.Properties variables = new java.util.Properties(System.getProperties());
-        variables.setProperty(RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, dir.getPath());
-        RepositoryConfigurationParser parser =
-                new RepositoryConfigurationParser(variables);
-        parser.setBeanFactory(beanFactory);
-        RepositoryConfig config = parser.parseRepositoryConfig(xml);
-        config.init();
-        return config;
-    }
-
 }

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml?rev=1401623&r1=1401622&r2=1401623&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml (original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml Wed Oct 24
11:31:38 2012
@@ -18,8 +18,8 @@
   under the License.
 -->
 <!DOCTYPE Repository
-          PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.4//EN"
-          "http://jackrabbit.apache.org/dtd/repository-2.4.dtd">
+          PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
+          "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
 
 <Repository>
     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
@@ -30,11 +30,6 @@
 
     <Security appName="Jackrabbit">
         <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
-            <UserManager class="org.apache.jackrabbit.core.security.user.UserManagerImpl">
-                <param name="defaultDepth" value="1"/>
-                <param name="autoExpandTree" value="true"/>
-                <AuthorizableAction class="org.apache.jackrabbit.core.security.user.action.AuthorizableAction"
/>
-            </UserManager>
         </SecurityManager>
 
         <AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">



Mime
View raw message