jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1370689 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: osgi/Activator.java plugins/type/TypeValidatorProvider.java plugins/value/ConflictValidatorProvider.java
Date Wed, 08 Aug 2012 08:01:39 GMT
Author: jukka
Date: Wed Aug  8 08:01:39 2012
New Revision: 1370689

URL: http://svn.apache.org/viewvc?rev=1370689&view=rev
Log:
OAK-224: Allow the ContentRepositoryImpl to receive a CommitEditor in the constructor

Hardcode the list of editors in the OSGi activator for now until they're turned to services.
Turn the rest of the validators to OSGi services.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidatorProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java?rev=1370689&r1=1370688&r2=1370689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/osgi/Activator.java
Wed Aug  8 08:01:39 2012
@@ -16,9 +16,19 @@
  */
 package org.apache.jackrabbit.oak.osgi;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
+import org.apache.jackrabbit.oak.plugins.type.DefaultTypeEditor;
+import org.apache.jackrabbit.oak.spi.commit.CommitEditor;
+import org.apache.jackrabbit.oak.spi.commit.CompositeEditor;
+import org.apache.jackrabbit.oak.spi.commit.ValidatingEditor;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -26,10 +36,6 @@ import org.osgi.framework.ServiceRegistr
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
 public class Activator implements BundleActivator, ServiceTrackerCustomizer {
 
     private BundleContext context;
@@ -71,10 +77,16 @@ public class Activator implements Bundle
     public Object addingService(ServiceReference reference) {
         Object service = context.getService(reference);
         if (service instanceof MicroKernel) {
+            List<CommitEditor> editors = new ArrayList<CommitEditor>();
+            editors.add(new DefaultTypeEditor());
+            editors.add(new ValidatingEditor(validatorProvider));
+            // editors.add(new LuceneEditor());
+
             MicroKernel kernel = (MicroKernel) service;
             services.put(reference, context.registerService(
                     ContentRepository.class.getName(),
-                    new ContentRepositoryImpl(kernel, indexProvider, validatorProvider),
+                    new ContentRepositoryImpl(
+                            kernel, indexProvider, new CompositeEditor(editors)),
                     new Properties()));
             return service;
         } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java?rev=1370689&r1=1370688&r2=1370689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
Wed Aug  8 08:01:39 2012
@@ -19,11 +19,15 @@ package org.apache.jackrabbit.oak.plugin
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+@Component
+@Service(ValidatorProvider.class)
 public class TypeValidatorProvider implements ValidatorProvider {
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidatorProvider.java?rev=1370689&r1=1370688&r2=1370689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/value/ConflictValidatorProvider.java
Wed Aug  8 08:01:39 2012
@@ -16,11 +16,16 @@
  */
 package org.apache.jackrabbit.oak.plugins.value;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+@Component
+@Service(ValidatorProvider.class)
 public class ConflictValidatorProvider implements ValidatorProvider {
+
     @Override
     public Validator getRootValidator(NodeState before, NodeState after) {
         return new ConflictValidator();



Mime
View raw message