chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1082141 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
Date Wed, 16 Mar 2011 13:01:53 GMT
Author: jukka
Date: Wed Mar 16 13:01:53 2011
New Revision: 1082141

URL: http://svn.apache.org/viewvc?rev=1082141&view=rev
Log:
CMIS-329: Implement support for versioning in opencmis-server-jcr module

Use the javax.imageio.spi.ServiceRegistry class instead of java.util.ServiceLoader to avoid
a Java 6 dependency.

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java?rev=1082141&r1=1082140&r2=1082141&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
Wed Mar 16 13:01:53 2011
@@ -34,10 +34,11 @@ import javax.jcr.RepositoryFactory;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.ServiceLoader;
+import javax.imageio.spi.ServiceRegistry;
 
 /**
  * A {@link CmisServiceFactory} implementation which returns {@link JcrService} instances.
 
@@ -85,9 +86,10 @@ public class JcrServiceFactory extends A
 
     /**
      * Acquire the JCR repository given a configuration. This implementation used
-     * {@link java.util.ServiceLoader#load(Class)}  for locating <code>RepositoryFactory</code>
-     * instances. The first instance which can handle the <code>jcrConfig</code>
parameters
-     * is used to acquire the repository. 
+     * {@link javax.imageio.spi.ServiceRegistry#lookupProviders(Class)} for
+     * locating <code>RepositoryFactory</code> instances. The first instance
+     * which can handle the <code>jcrConfig</code> parameters is used to
+     * acquire the repository. 
      *
      * @param jcrConfig  configuration determining the JCR repository to be returned
      * @return
@@ -95,7 +97,10 @@ public class JcrServiceFactory extends A
      */
     protected Repository acquireJcrRepository(Map<String, String> jcrConfig) {
         try {
-            for (RepositoryFactory factory : ServiceLoader.load(RepositoryFactory.class))
{
+            Iterator factories =
+                ServiceRegistry.lookupProviders(RepositoryFactory.class);
+            while (factories.hasNext()) {
+                RepositoryFactory factory = (RepositoryFactory) factories.next();
                 log.debug("Trying to acquire JCR repository from factory " + factory);
                 Repository repository = factory.getRepository(jcrConfig);
                 if (repository != null) {



Mime
View raw message