sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1573558 - in /sling/trunk: bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/ launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/
Date Mon, 03 Mar 2014 13:18:23 GMT
Author: cziegeler
Date: Mon Mar  3 13:18:23 2014
New Revision: 1573558

URL: http://svn.apache.org/r1573558
Log:
SLING-3427 : Incorrect handling of NamespaceMapper bindings within SlingServerRepositoryManager.
Apply slightly modified patch from Stefan Scheidewig

Modified:
    sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepositoryManager.java
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/TestNamespaceMapper.java

Modified: sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepositoryManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepositoryManager.java?rev=1573558&r1=1573557&r2=1573558&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepositoryManager.java
(original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepositoryManager.java
Mon Mar  3 13:18:23 2014
@@ -57,7 +57,6 @@ import org.apache.sling.serviceusermappi
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
@@ -137,10 +136,11 @@ public class SlingServerRepositoryManage
 
     private Map<String, ServiceRegistration> statisticsServices = new ConcurrentHashMap<String,
ServiceRegistration>();
 
-    private Map<ServiceReference, NamespaceMapper> namespaceMapperRefs = new TreeMap<ServiceReference,
NamespaceMapper>();
+    private Map<Long, NamespaceMapper> namespaceMapperRefs = new TreeMap<Long, NamespaceMapper>();
 
     // ---------- Repository Management ----------------------------------------
 
+    @Override
     protected Repository acquireRepository() {
 
         @SuppressWarnings("unchecked")
@@ -263,6 +263,7 @@ public class SlingServerRepositoryManage
      * @since bundle version 2.2.0 replacing the previously overwriting of the
      *        now final {@code AbstractSlingRepository.registerService} method.
      */
+    @Override
     protected String[] getServiceRegistrationInterfaces() {
         return new String[] {
             SlingRepository.class.getName(), Repository.class.getName(), RepositoryManager.class.getName()
@@ -289,6 +290,7 @@ public class SlingServerRepositoryManage
         return this.serviceUserMapper;
     }
 
+    @Override
     protected void disposeRepository(Repository repository) {
         unregisterStatistics(repository);
 
@@ -358,21 +360,20 @@ public class SlingServerRepositoryManage
     }
 
     @SuppressWarnings("unused")
-    private void bindNamespaceMapper(final ServiceReference ref) {
+    private void bindNamespaceMapper(final NamespaceMapper namespaceMapper, final Map<String,
Object> props) {
         synchronized (this.namespaceMapperRefs) {
-            this.namespaceMapperRefs.put(ref,
-                (NamespaceMapper) this.getComponentContext().locateService("namespaceMapper",
ref));
+            this.namespaceMapperRefs.put((Long)props.get(Constants.SERVICE_ID), namespaceMapper);
             this.namespaceMappers = this.namespaceMapperRefs.values().toArray(
-                new NamespaceMapper[this.namespaceMapperRefs.values().size()]);
+                    new NamespaceMapper[this.namespaceMapperRefs.size()]);
         }
     }
 
     @SuppressWarnings("unused")
-    private void unbindNamespaceMapper(final ServiceReference ref) {
+    private void unbindNamespaceMapper(final NamespaceMapper namespaceMapper, final Map<String,
Object> props) {
         synchronized (this.namespaceMapperRefs) {
-            this.namespaceMapperRefs.remove(ref);
+            this.namespaceMapperRefs.remove(props.get(Constants.SERVICE_ID));
             this.namespaceMappers = this.namespaceMapperRefs.values().toArray(
-                new NamespaceMapper[this.namespaceMapperRefs.values().size()]);
+                    new NamespaceMapper[this.namespaceMapperRefs.size()]);
         }
     }
 

Modified: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/TestNamespaceMapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/TestNamespaceMapper.java?rev=1573558&r1=1573557&r2=1573558&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/TestNamespaceMapper.java
(original)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/jcr/TestNamespaceMapper.java
Mon Mar  3 13:18:23 2014
@@ -39,7 +39,7 @@ import org.apache.sling.jcr.api.Namespac
 public class TestNamespaceMapper implements NamespaceMapper {
 
     public void defineNamespacePrefixes(Session session) throws RepositoryException {
-        session.setNamespacePrefix("test2", "test2=http://sling.apache.org/test/two");
+        session.setNamespacePrefix("test2", "http://sling.apache.org/test/two");
     }
 
 }



Mime
View raw message