Author: doogie
Date: Tue Mar 9 19:52:50 2010 New Revision: 921085 URL: http://svn.apache.org/viewvc?rev=921085&view=rev Log: s/ServiceRegistry/ServiceLoader/ Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/DynamicAccessFactory.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/Converters.java Tue Mar 9 19:52:50 2010 @@ -20,8 +20,7 @@ package org.ofbiz.base.conversion; import java.lang.reflect.Modifier; import java.util.Iterator; - -import javax.imageio.spi.ServiceRegistry; +import java.util.ServiceLoader; import javolution.util.FastMap; import javolution.util.FastSet; @@ -48,7 +47,7 @@ public class Converters { converterMap.setShared(true); registerCreator(new PassThruConverterCreator()); ClassLoader loader = Thread.currentThread().getContextClassLoader(); - Iterator<ConverterLoader> converterLoaders = ServiceRegistry.lookupProviders(ConverterLoader.class, loader); + Iterator<ConverterLoader> converterLoaders = ServiceLoader.load(ConverterLoader.class, loader).iterator(); while (converterLoaders.hasNext()) { try { ConverterLoader converterLoader = converterLoaders.next(); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/CachedClassLoader.java Tue Mar 9 19:52:50 2010 @@ -22,10 +22,9 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.Iterator; import java.util.Map; +import java.util.ServiceLoader; import java.util.Set; -import javax.imageio.spi.ServiceRegistry; - import javolution.util.FastMap; import javolution.util.FastSet; @@ -91,7 +90,7 @@ public class CachedClassLoader extends U registerClass(org.ofbiz.base.util.TimeDuration.class); ClassLoader loader = Thread.currentThread().getContextClassLoader(); - Iterator<Init> cachedClassLoaders = ServiceRegistry.lookupProviders(Init.class, loader); + Iterator<Init> cachedClassLoaders = ServiceLoader.load(Init.class, loader).iterator(); while (cachedClassLoaders.hasNext()) { Init cachedClassLoader = cachedClassLoaders.next(); try { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilObject.java Tue Mar 9 19:52:50 2010 @@ -25,7 +25,7 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.io.InputStream; import java.util.Iterator; -import javax.imageio.spi.ServiceRegistry; +import java.util.ServiceLoader; /** * UtilObject @@ -192,7 +192,7 @@ public final class UtilObject { } public static <A, R> R getObjectFromFactory(Class<? extends Factory<R, A>> factoryInterface, A obj) throws ClassNotFoundException { - Iterator<? extends Factory<R, A>> it = ServiceRegistry.lookupProviders(factoryInterface); + Iterator<? extends Factory<R, A>> it = ServiceLoader.load(factoryInterface).iterator(); while (it.hasNext()) { Factory<R, A> factory = it.next(); R instance = factory.getInstance(obj); Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java (original) +++ ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java Tue Mar 9 19:52:50 2010 @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Iterator; -import javax.imageio.spi.ServiceRegistry; +import java.util.ServiceLoader; import org.ofbiz.base.util.Debug; import org.ofbiz.common.authentication.api.Authenticator; @@ -90,7 +90,7 @@ public class AuthHelper { private synchronized static void loadAuthenticators_internal(LocalDispatcher dispatcher) { if (!authenticatorsLoaded) { - Iterator<Authenticator> it = ServiceRegistry.lookupProviders(Authenticator.class, getContextClassLoader()); + Iterator<Authenticator> it = ServiceLoader.load(Authenticator.class, getContextClassLoader()).iterator(); while (it.hasNext()) { try { Authenticator auth = it.next(); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Tue Mar 9 19:52:50 2010 @@ -27,9 +27,9 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.ServiceLoader; import java.util.Set; -import javax.imageio.spi.ServiceRegistry; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -94,7 +94,7 @@ public class SimpleMethod { private static final Method methodOperationExecMethod; static { Map<String, MethodOperation.Factory<MethodOperation>> mapFactories = new HashMap<String, MethodOperation.Factory<MethodOperation>>(); - Iterator<MethodOperation.Factory<MethodOperation>> it = UtilGenerics.cast(ServiceRegistry.lookupProviders(MethodOperation.Factory.class, SimpleMethod.class.getClassLoader())); + Iterator<MethodOperation.Factory<MethodOperation>> it = UtilGenerics.cast(ServiceLoader.load(MethodOperation.Factory.class, SimpleMethod.class.getClassLoader()).iterator()); while (it.hasNext()) { MethodOperation.Factory<MethodOperation> factory = it.next(); mapFactories.put(factory.getName(), factory); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ConditionalFactory.java Tue Mar 9 19:52:50 2010 @@ -22,8 +22,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; - -import javax.imageio.spi.ServiceRegistry; +import java.util.ServiceLoader; import org.w3c.dom.*; import org.ofbiz.base.util.*; @@ -36,7 +35,7 @@ public abstract class ConditionalFactory private static final Map<String, ConditionalFactory<?>> conditionalFactories; static { Map<String, ConditionalFactory<?>> factories = new HashMap<String, ConditionalFactory<?>>(); - Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceRegistry.lookupProviders(ConditionalFactory.class, ConditionalFactory.class.getClassLoader())); + Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceLoader.load(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()).iterator()); while (it.hasNext()) { ConditionalFactory<?> factory = it.next(); factories.put(factory.getName(), factory); Modified: ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/DynamicAccessFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/DynamicAccessFactory.java?rev=921085&r1=921084&r2=921085&view=diff ============================================================================== --- ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/DynamicAccessFactory.java (original) +++ ofbiz/trunk/framework/security/src/org/ofbiz/security/authz/da/DynamicAccessFactory.java Tue Mar 9 19:52:50 2010 @@ -20,9 +20,9 @@ package org.ofbiz.security.authz.da; import java.util.Set; import java.util.Iterator; +import java.util.ServiceLoader; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.imageio.spi.ServiceRegistry; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; @@ -59,7 +59,7 @@ public class DynamicAccessFactory { } private static void loadAccessHandlers(Delegator delegator) { - Iterator<DynamicAccessHandler> it = ServiceRegistry.lookupProviders(DynamicAccessHandler.class, DynamicAccessFactory.class.getClassLoader()); + Iterator<DynamicAccessHandler> it = ServiceLoader.load(DynamicAccessHandler.class, DynamicAccessFactory.class.getClassLoader()).iterator(); while (it.hasNext()) { DynamicAccessHandler handler = it.next(); handler.setDelegator(delegator); |
Free forum by Nabble | Edit this page |