abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r556726 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java core/src/main/java/org/apache/abdera/factory/Factory.java parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Date Mon, 16 Jul 2007 20:39:03 GMT
Author: jmsnell
Date: Mon Jul 16 13:38:59 2007
New Revision: 556726

URL: http://svn.apache.org/viewvc?view=rev&rev=556726
Log:
Per... https://issues.apache.org/jira/browse/ABDERA-52

Provide a simple way of listing what ExtensionFactory implementations have been
registered with Abdera.

Example:

  String[] names = abdera.getFactory().listExtensionFactories();
  for (String name : names) System.out.println(name)
  

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java?view=diff&rev=556726&r1=556725&r2=556726
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/ExtensionFactoryMap.java
Mon Jul 16 13:38:59 2007
@@ -107,4 +107,15 @@
     }
     return null;
   }
+  
+  public String[] listExtensionFactories() {
+    List<String> names = new ArrayList<String>();
+    synchronized(factories) {
+      for (ExtensionFactory factory : factories) {
+        String name = factory.getClass().getName();
+        if (!names.contains(name)) names.add(name);
+      }
+    }
+    return names.toArray(new String[names.size()]);
+  }
 }

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java?view=diff&rev=556726&r1=556725&r2=556726
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/factory/Factory.java
Mon Jul 16 13:38:59 2007
@@ -650,4 +650,9 @@
    * Get the mime type for the specified extension element / document
    */
   <T extends Base>String getMimeType(T base);
+  
+  /**
+   * Returns a listing of extension factories registered
+   */
+  String[] listExtensionFactories();
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?view=diff&rev=556726&r1=556725&r2=556726
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Mon Jul 16 13:38:59 2007
@@ -827,4 +827,8 @@
   public <T extends Base> String getMimeType(T base) {
     return factoriesMap.getMimeType(base);
   }
+
+  public String[] listExtensionFactories() {
+    return factoriesMap.listExtensionFactories();
+  }
 }



Mime
View raw message