abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r772446 - /abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java
Date Wed, 06 May 2009 22:06:21 GMT
Author: jmsnell
Date: Wed May  6 22:06:20 2009
New Revision: 772446

URL: http://svn.apache.org/viewvc?rev=772446&view=rev
Log:
Refactoring of some of the base level class discovery code. The moves things to a more logical
location, improves the reliability of the implementation and simplifies the code structure
a bit.

Modified:
    abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java

Modified: abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java?rev=772446&r1=772445&r2=772446&view=diff
==============================================================================
--- abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java
(original)
+++ abdera/java/trunk/extensions/serializer/src/main/java/org/apache/abdera/ext/serializer/DefaultSerializationContext.java
Wed May  6 22:06:20 2009
@@ -17,11 +17,10 @@
 */
 package org.apache.abdera.ext.serializer;
 
-import java.util.List;
 import java.util.Map;
 
 import org.apache.abdera.Abdera;
-import org.apache.abdera.util.ServiceUtil;
+import org.apache.abdera.util.Discover;
 import org.apache.abdera.writer.StreamWriter;
 
 @SuppressWarnings("unchecked")
@@ -30,7 +29,7 @@
 
   private static final long serialVersionUID = 740460842415905883L;
 
-  private final List<SerializerProvider> providers;
+  private final Iterable<SerializerProvider> providers;
   
   public DefaultSerializationContext(StreamWriter streamWriter) {
     super(streamWriter);
@@ -45,7 +44,7 @@
   }
    
   private void initSerializers() {
-    SerializerProvider[] providers = getConverterProviders();
+    Iterable<SerializerProvider> providers = getConverterProviders();
     for (SerializerProvider provider : providers) {
       for (Map.Entry<Class,Serializer> entry : provider) {
         setSerializer(entry.getKey(), entry.getValue());
@@ -56,17 +55,19 @@
   /**
    * Returns the listing of registered ConverterProvider implementations
    */
-  public SerializerProvider[] getConverterProviders() {
-    return providers != null ? 
-      providers.toArray(
-        new SerializerProvider[providers.size()]) : 
-          new SerializerProvider[0];
+  public Iterable<SerializerProvider> getConverterProviders() {
+    return providers;
+//    return providers != null ? 
+//      providers.toArray(
+//        new SerializerProvider[providers.size()]) : 
+//          new SerializerProvider[0];
   }
   
-  protected static synchronized List<SerializerProvider> loadConverterProviders() {
-    List<SerializerProvider> providers =
-      ServiceUtil.loadimpls(
-        "META-INF/services/org.apache.abdera.converter.ConverterProvider");
+  protected static synchronized Iterable<SerializerProvider> loadConverterProviders()
{
+    Iterable<SerializerProvider> providers =
+      Discover.locate("org.apache.abdera.converter.ConverterProvider");
+//      ServiceUtil.loadimpls(
+//        "META-INF/services/org.apache.abdera.converter.ConverterProvider");
     return providers;    
   }
   



Mime
View raw message