incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1346081 - in /sling/trunk/bundles/jcr/jackrabbit-server: pom.xml src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
Date Mon, 04 Jun 2012 18:37:44 GMT
Author: fmeschbe
Date: Mon Jun  4 18:37:44 2012
New Revision: 1346081

URL: http://svn.apache.org/viewvc?rev=1346081&view=rev
Log:
SLING-2501 Apply patch by Dragos Dascalita Haut (thank you very much)

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/SlingServerRepository.java

Modified: sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/pom.xml?rev=1346081&r1=1346080&r2=1346081&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/pom.xml (original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/pom.xml Mon Jun  4 18:37:44 2012
@@ -195,7 +195,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.api</artifactId>
-            <version>2.0.6</version>
+            <version>2.1.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

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=1346081&r1=1346080&r2=1346081&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
Mon Jun  4 18:37:44 2012
@@ -31,6 +31,8 @@ import javax.jcr.Credentials;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
+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.RepositoryConfig;
 import org.apache.sling.jcr.api.SlingRepository;
@@ -39,6 +41,7 @@ import org.apache.sling.jcr.jackrabbit.s
 import org.apache.sling.jcr.jackrabbit.server.impl.security.AnonCredentials;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.log.LogService;
 
 /**
@@ -53,7 +56,7 @@ import org.osgi.service.log.LogService;
  *      value="Factory for embedded Jackrabbit Repository Instances"
  */
 public class SlingServerRepository extends AbstractSlingRepository
-        implements Repository, SlingRepository {
+        implements Repository, SlingRepository, RepositoryManager {
 
     /**
      * The name of the configuration property defining the URL to the
@@ -205,7 +208,47 @@ public class SlingServerRepository exten
     }
 
 
+    //---------- Repository Manager Interface Methods -------------------------
 
+    /**
+     * @throws UnsupportedOperationException This method is not supported
+     *      in this context.
+     */
+    public void stop() {
+        throw new UnsupportedOperationException("Not allowed to manually stop the repository");
+    }
+
+    public DataStoreGarbageCollector createDataStoreGarbageCollector() throws RepositoryException
{
+        RepositoryImpl repository = (RepositoryImpl) getRepository();
+        if (repository != null) {
+            return repository.createDataStoreGarbageCollector();
+        }
+
+        throw new RepositoryException("Repository couldn't be acquired");
+    }
+
+    /**
+     * Overrides the registerService method of <code>AbstractSlingRepository</code>,
in order to register
+     * <code>org.apache.jackrabbit.api.management.RepositoryManager</code> Service
using the
+     * component properties as service registration properties.
+     *
+     * @return The OSGi <code>ServiceRegistration</code> object representing
+     *         the registered service.
+     *
+     * @see org.apache.sling.jcr.base.AbstractSlingRepository#registerService()
+     */
+    @Override
+    protected ServiceRegistration registerService() {
+
+        @SuppressWarnings("unchecked")
+        Dictionary<String, Object> props = getComponentContext().getProperties();
+
+        String[] interfaces = new String[] {
+            SlingRepository.class.getName(), Repository.class.getName(), RepositoryManager.class.getName()
+        };
+
+        return getComponentContext().getBundleContext().registerService(interfaces, this,
props);
+    }
 
     //---------- Helper -------------------------------------------------------
 



Mime
View raw message