abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r555831 - in /incubator/abdera/java/trunk: contrib/rss/src/main/java/org/apache/abdera/contrib/rss/ extensions/src/main/java/org/apache/abdera/ext/features/ extensions/src/main/java/org/apache/abdera/ext/media/ extensions/src/main/java/org/...
Date Fri, 13 Jul 2007 01:16:12 GMT
Author: jmsnell
Date: Thu Jul 12 18:16:10 2007
New Revision: 555831

URL: http://svn.apache.org/viewvc?view=rev&rev=555831
Log:
Use the new AbstractExtensionFactory utility to simplify the various ExtensionFactory instances
we ship

Modified:
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
    incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesExtensionFactory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchConstants.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadExtensionFactory.java

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssConstants.java
Thu Jul 12 18:16:10 2007
@@ -22,6 +22,7 @@
 public interface RssConstants {
 
   public static final String RSS_MEDIATYPE = "application/rss+xml";
+  public static final String RDF_MEDIATYPE = "application/rdf+xml";
   
   public static final String ENC_NS = "http://purl.org/rss/1.0/modules/content/";
   public static final String RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

Modified: incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/contrib/rss/src/main/java/org/apache/abdera/contrib/rss/RssExtensionFactory.java
Thu Jul 12 18:16:10 2007
@@ -17,114 +17,67 @@
 */
 package org.apache.abdera.contrib.rss;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Element;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
 public class RssExtensionFactory 
-  implements ExtensionFactory, RssConstants {
-
-  @SuppressWarnings("unchecked")
-  public <T extends Element> T getElementWrapper(Element internal) {
-    
-    QName qname = internal.getQName();
-    if (qname.equals(QNAME_RSS)) {
-      if (internal.getAttributeValue("version") != null) {
-        return (T)(new RssFeed(internal));
-      }
-    } if (qname.equals(QNAME_RDF)) {
-      return (T)(new RssFeed(internal));
-    } else if (qname.equals(QNAME_CHANNEL) || qname.equals(QNAME_RDF_CHANNEL)) {
-      return (T)(new RssChannel(internal)); 
-    } else if (qname.equals(QNAME_ITEM) || qname.equals(QNAME_RDF_ITEM)) {
-      return (T)(new RssItem(internal));
-    } else if (qname.equals(QNAME_LINK) || qname.equals(QNAME_RDF_LINK)) {
-      return (T)(new RssLink(internal));
-    } else if (qname.equals(QNAME_TITLE) || 
-               qname.equals(QNAME_RDF_TITLE) ||
-               qname.equals(QNAME_DC_TITLE) ||
-               qname.equals(QNAME_DESCRIPTION) || 
-               qname.equals(QNAME_RDF_DESCRIPTION) ||
-               qname.equals(QNAME_DC_DESCRIPTION) ||
-               qname.equals(QNAME_COPYRIGHT) || 
-               qname.equals(QNAME_DC_RIGHTS)) {
-      return (T)(new RssText(internal));
-    } else if (qname.equals(QNAME_MANAGINGEDITOR) || 
-               qname.equals(QNAME_MANAGINGEDITOR2) || 
-               qname.equals(QNAME_DC_CREATOR) ||
-               qname.equals(QNAME_DC_CONTRIBUTOR) ||
-               qname.equals(QNAME_WEBMASTER) ||
-               qname.equals(QNAME_WEBMASTER2)) {
-      return (T)(new RssPerson(internal));
-    } else if (qname.equals(QNAME_PUBDATE) || 
-               qname.equals(QNAME_PUBDATE2) ||
-               qname.equals(QNAME_LASTBUILDDATE) || 
-               qname.equals(QNAME_LASTBUILDDATE2) ||
-               qname.equals(QNAME_DC_DATE)) {
-      return (T)(new RssDateTime(internal));
-    } else if (qname.equals(QNAME_CATEGORY) || 
-               qname.equals(QNAME_DC_SUBJECT)) {
-      return (T)(new RssCategory(internal));
-    } else if (qname.equals(QNAME_GENERATOR)) {
-      return (T)(new RssGenerator(internal));
-    } else if (qname.equals(QNAME_DOCS)) {
-      return (T)(new RssLink(internal));
-    } else if (qname.equals(QNAME_CLOUD)) {
-      return (T)(new RssCloud(internal));
-    } else if (qname.equals(QNAME_TTL)) {
-      return (T)(new RssText(internal));
-    } else if (qname.equals(QNAME_IMAGE) || qname.equals(QNAME_RDF_IMAGE)) {
-      return (T)(new RssImage(internal));
-    } else if (qname.equals(QNAME_RATING)) {
-      return (T) internal;
-    } else if (qname.equals(QNAME_TEXTINPUT) || qname.equals(QNAME_TEXTINPUT2)) {
-      return (T)(new RssTextInput(internal));
-    } else if (qname.equals(QNAME_SKIPHOURS) || qname.equals(QNAME_SKIPHOURS2)) {
-      return (T)(new RssSkipHours(internal));
-    } else if (qname.equals(QNAME_SKIPDAYS) || qname.equals(QNAME_SKIPDAYS2)) {
-      return (T)(new RssSkipDays(internal));
-    } else if (qname.equals(QNAME_URL) || qname.equals(QNAME_RDF_URL)) {
-      return (T)(new RssUriElement(internal));
-    } else if (qname.equals(QNAME_AUTHOR)) {
-      return (T)(new RssPerson(internal));
-    } else if (qname.equals(QNAME_ENCLOSURE)) {
-      return (T)(new RssEnclosure(internal));
-    } else if (qname.equals(QNAME_GUID) || 
-               qname.equals(QNAME_DC_IDENTIFIER)) {
-      return (T)(new RssGuid(internal));
-    } else if (qname.equals(QNAME_COMMENTS)) {
-      return (T)(new RssLink(internal));
-    } else if (qname.equals(QNAME_SOURCE) || 
-               qname.equals(QNAME_DC_SOURCE)) {
-      return (T)(new RssSource(internal));
-    } else if (qname.equals(QNAME_CONTENT_ENCODED)) {
-      return (T)(new RssContent(internal));
-    }
-    
-    return (T) internal;
-  }
-
-  public List<String> getNamespaces() {
-    List<String> namespaces = new ArrayList<String>();
-    namespaces.add("");
-    namespaces.add(ENC_NS);
-    return namespaces;
-  }
-
-  public boolean handlesNamespace(String namespace) {
-    return (namespace.equals("") || namespace.equals(ENC_NS));
-  }
+  extends AbstractExtensionFactory 
+  implements RssConstants {
 
-  public <T extends Base> String getMimeType(T base) {
-    Element element = base instanceof Element ? (Element)base : ((Document)base).getRoot();
-    if (element instanceof RssFeed) return RssConstants.RSS_MEDIATYPE;
-    return null;
+  public RssExtensionFactory() {
+    super("",ENC_NS,DC_NS,RDF_NS);
+    addMimeType(QNAME_RSS, RSS_MEDIATYPE);
+    addMimeType(QNAME_RDF, RDF_MEDIATYPE);
+    addImpl(QNAME_RSS,RssFeed.class);
+    addImpl(QNAME_RDF,RssFeed.class);
+    addImpl(QNAME_CHANNEL,RssChannel.class);
+    addImpl(QNAME_RDF_CHANNEL,RssChannel.class);
+    addImpl(QNAME_ITEM,RssItem.class);
+    addImpl(QNAME_RDF_ITEM,RssItem.class);
+    addImpl(QNAME_LINK,RssLink.class);
+    addImpl(QNAME_RDF_LINK,RssLink.class);
+    addImpl(QNAME_TITLE,RssText.class);
+    addImpl(QNAME_RDF_TITLE,RssText.class);
+    addImpl(QNAME_DC_TITLE,RssText.class);
+    addImpl(QNAME_DESCRIPTION,RssText.class);
+    addImpl(QNAME_RDF_DESCRIPTION,RssText.class);
+    addImpl(QNAME_DC_DESCRIPTION,RssText.class);
+    addImpl(QNAME_COPYRIGHT,RssText.class);
+    addImpl(QNAME_DC_RIGHTS,RssText.class);
+    addImpl(QNAME_MANAGINGEDITOR,RssPerson.class);
+    addImpl(QNAME_MANAGINGEDITOR2,RssPerson.class);
+    addImpl(QNAME_DC_CREATOR,RssPerson.class);
+    addImpl(QNAME_DC_CONTRIBUTOR,RssPerson.class);
+    addImpl(QNAME_WEBMASTER,RssPerson.class);
+    addImpl(QNAME_WEBMASTER2,RssPerson.class);
+    addImpl(QNAME_PUBDATE,RssDateTime.class);
+    addImpl(QNAME_PUBDATE2,RssDateTime.class);
+    addImpl(QNAME_LASTBUILDDATE,RssDateTime.class);
+    addImpl(QNAME_LASTBUILDDATE2,RssDateTime.class);
+    addImpl(QNAME_DC_DATE,RssDateTime.class);
+    addImpl(QNAME_CATEGORY,RssCategory.class);
+    addImpl(QNAME_DC_SUBJECT,RssCategory.class);
+    addImpl(QNAME_GENERATOR,RssGenerator.class);
+    addImpl(QNAME_DOCS,RssLink.class);
+    addImpl(QNAME_CLOUD,RssCloud.class);
+    addImpl(QNAME_TTL,RssText.class);
+    addImpl(QNAME_IMAGE,RssImage.class);
+    addImpl(QNAME_RDF_IMAGE,RssImage.class);
+    addImpl(QNAME_TEXTINPUT,RssTextInput.class);
+    addImpl(QNAME_TEXTINPUT2,RssTextInput.class);
+    addImpl(QNAME_SKIPHOURS,RssSkipHours.class);
+    addImpl(QNAME_SKIPHOURS2,RssSkipHours.class);
+    addImpl(QNAME_SKIPDAYS,RssSkipDays.class);
+    addImpl(QNAME_SKIPDAYS2,RssSkipDays.class);
+    addImpl(QNAME_URL,RssUriElement.class);
+    addImpl(QNAME_RDF_URL,RssUriElement.class);
+    addImpl(QNAME_AUTHOR,RssPerson.class);
+    addImpl(QNAME_ENCLOSURE,RssEnclosure.class);
+    addImpl(QNAME_GUID,RssGuid.class);
+    addImpl(QNAME_DC_IDENTIFIER,RssGuid.class);
+    addImpl(QNAME_COMMENTS,RssLink.class);
+    addImpl(QNAME_SOURCE,RssSource.class);
+    addImpl(QNAME_DC_SOURCE,RssSource.class);
+    addImpl(QNAME_CONTENT_ENCODED,RssContent.class);
   }
 
 }

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesExtensionFactory.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesExtensionFactory.java
Thu Jul 12 18:16:10 2007
@@ -17,40 +17,14 @@
 */
 package org.apache.abdera.ext.features;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Element;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
 public final class FeaturesExtensionFactory 
-  implements ExtensionFactory {
-
-  public boolean handlesNamespace(String namespace) {
-    return (FeaturesHelper.FNS.equals(namespace));
-  }
-
-  public List<String> getNamespaces() {
-    List<String> lst = new ArrayList<String>();
-    lst.add(FeaturesHelper.FNS);
-    return lst;
-  }
+  extends AbstractExtensionFactory {
 
-  @SuppressWarnings("unchecked")
-  public <T extends Element> T getElementWrapper(Element internal) {
-    QName qname = internal.getQName();
-    if (FeaturesHelper.FEATURE.equals(qname)) 
-      return (T)new Feature(internal);
-    else return (T)internal;
+  public FeaturesExtensionFactory() {
+    super(FeaturesHelper.FNS);
+    addImpl(FeaturesHelper.FEATURE,Feature.class);
   }
-
-  public <T extends Base> String getMimeType(T base) {
-    return null;
-  }
-
-
-
+  
 }

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
Thu Jul 12 18:16:10 2007
@@ -17,47 +17,30 @@
 */
 package org.apache.abdera.ext.media;
 
-import java.util.List;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Element;
-
-public final class MediaExtensionFactory implements ExtensionFactory {
-
-  @SuppressWarnings({ "unchecked", "deprecation" })
-  public <T extends Element> T getElementWrapper(Element internal) {
-    QName qname = internal.getQName();
-    if (qname.equals(MediaConstants.ADULT)) return (T) new MediaAdult(internal);
-    if (qname.equals(MediaConstants.CATEGORY)) return (T) new MediaCategory(internal);
-    if (qname.equals(MediaConstants.CONTENT)) return (T) new MediaContent(internal);
-    if (qname.equals(MediaConstants.COPYRIGHT)) return (T) new MediaCopyright(internal);
-    if (qname.equals(MediaConstants.CREDIT)) return (T) new MediaCredit(internal);
-    if (qname.equals(MediaConstants.DESCRIPTION)) return (T) new MediaDescription(internal);
-    if (qname.equals(MediaConstants.GROUP)) return (T) new MediaGroup(internal);
-    if (qname.equals(MediaConstants.HASH)) return (T) new MediaHash(internal);
-    if (qname.equals(MediaConstants.KEYWORDS)) return (T) new MediaKeywords(internal);
-    if (qname.equals(MediaConstants.PLAYER)) return (T) new MediaPlayer(internal);
-    if (qname.equals(MediaConstants.RATING)) return (T) new MediaRating(internal);
-    if (qname.equals(MediaConstants.RESTRICTION)) return (T) new MediaRestriction(internal);
-    if (qname.equals(MediaConstants.TEXT)) return (T) new MediaText(internal);
-    if (qname.equals(MediaConstants.THUMBNAIL)) return (T) new MediaThumbnail(internal);
-    if (qname.equals(MediaConstants.TITLE)) return (T) new MediaTitle(internal);
-    return (T)internal;
-  }
-
-  public List<String> getNamespaces() {
-    return java.util.Arrays.asList(new String[] {MediaConstants.MEDIA_NS});
-  }
-
-  public boolean handlesNamespace(String namespace) {
-    return namespace.equals(MediaConstants.MEDIA_NS);
-  }
-
-  public <T extends Base> String getMimeType(T base) {
-    return null;
+public final class MediaExtensionFactory 
+  extends AbstractExtensionFactory
+  implements MediaConstants {
+  
+  @SuppressWarnings("deprecation")
+  public MediaExtensionFactory() {
+    super(MediaConstants.MEDIA_NS);
+    addImpl(ADULT,MediaAdult.class);
+    addImpl(CATEGORY,MediaCategory.class);
+    addImpl(CONTENT,MediaContent.class);
+    addImpl(COPYRIGHT,MediaCopyright.class);
+    addImpl(CREDIT,MediaCredit.class);
+    addImpl(DESCRIPTION,MediaDescription.class);
+    addImpl(GROUP,MediaGroup.class);
+    addImpl(HASH,MediaHash.class);
+    addImpl(KEYWORDS,MediaKeywords.class);
+    addImpl(PLAYER,MediaPlayer.class);
+    addImpl(RATING,MediaRating.class);
+    addImpl(RESTRICTION,MediaRestriction.class);
+    addImpl(TEXT,MediaText.class);
+    addImpl(THUMBNAIL,MediaThumbnail.class);
+    addImpl(TITLE,MediaTitle.class);
   }
 
 }

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchConstants.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchConstants.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchConstants.java
Thu Jul 12 18:16:10 2007
@@ -19,8 +19,7 @@
 
 import javax.xml.namespace.QName;
 
-public final class OpenSearchConstants {
-  private OpenSearchConstants() {}
+public interface OpenSearchConstants {
 
   public static final String OPENSEARCH_V10_NS = "http://a9.com/-/spec/opensearchrss/1.0/";
   public static final String OPENSEARCH_NS = "http://a9.com/-/spec/opensearchrss/1.1/";

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/opensearch/OpenSearchExtensionFactory.java
Thu Jul 12 18:16:10 2007
@@ -17,49 +17,24 @@
 */
 package org.apache.abdera.ext.opensearch;
 
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Element;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
 public final class OpenSearchExtensionFactory 
-  implements ExtensionFactory {
+  extends AbstractExtensionFactory
+  implements OpenSearchConstants {
 
-  @SuppressWarnings("unchecked")
-  public <T extends Element> T getElementWrapper(Element internal) {
-    QName qname = internal.getQName();
-    if (qname.equals(OpenSearchConstants.QUERY) ||
-        qname.equals(OpenSearchConstants.QUERY_V10)) {
-      return (T)new Query(internal);
-    } else if (qname.equals(OpenSearchConstants.ITEMS_PER_PAGE) ||
-               qname.equals(OpenSearchConstants.START_INDEX) ||
-               qname.equals(OpenSearchConstants.TOTAL_RESULTS) ||
-               qname.equals(OpenSearchConstants.ITEMS_PER_PAGE_V10) ||
-               qname.equals(OpenSearchConstants.START_INDEX_V10) ||
-               qname.equals(OpenSearchConstants.TOTAL_RESULTS_V10)) {
-      return (T)new IntegerElement(internal);
-    } else {
-      return (T)internal;
-    }
+  public OpenSearchExtensionFactory() {
+    super(
+      OpenSearchConstants.OPENSEARCH_NS, 
+      OpenSearchConstants.OPENSEARCH_V10_NS);
+    addImpl(QUERY,Query.class);
+    addImpl(QUERY_V10,Query.class);
+    addImpl(ITEMS_PER_PAGE, IntegerElement.class);
+    addImpl(START_INDEX, IntegerElement.class);
+    addImpl(TOTAL_RESULTS, IntegerElement.class);
+    addImpl(ITEMS_PER_PAGE_V10, IntegerElement.class);
+    addImpl(START_INDEX_V10, IntegerElement.class);
+    addImpl(TOTAL_RESULTS_V10, IntegerElement.class);
   }
-
-  public List<String> getNamespaces() {
-    return java.util.Arrays.asList(
-      new String[] {
-        OpenSearchConstants.OPENSEARCH_NS, 
-        OpenSearchConstants.OPENSEARCH_V10_NS});
-  }
-
-  public boolean handlesNamespace(String namespace) {
-    return OpenSearchConstants.OPENSEARCH_NS.equals(namespace) ||
-           OpenSearchConstants.OPENSEARCH_V10_NS.equals(namespace);
-  }
-
-  public <T extends Base> String getMimeType(T base) {
-    return null;
-  }
-
+  
 }

Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadExtensionFactory.java?view=diff&rev=555831&r1=555830&r2=555831
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadExtensionFactory.java
(original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadExtensionFactory.java
Thu Jul 12 18:16:10 2007
@@ -17,42 +17,16 @@
 */
 package org.apache.abdera.ext.thread;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.factory.ExtensionFactory;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Element;
+import org.apache.abdera.util.AbstractExtensionFactory;
 
 public final class ThreadExtensionFactory 
-  implements ExtensionFactory {
-
-  public boolean handlesNamespace(String namespace) {
-    return (ThreadConstants.THR_NS.equals(namespace));
-  }
-
-  public List<String> getNamespaces() {
-    List<String> lst = new ArrayList<String>();
-    lst.add(ThreadConstants.THR_NS);
-    return lst;
-  }
+  extends AbstractExtensionFactory
+  implements ThreadConstants {
 
-  @SuppressWarnings("unchecked")
-  public <T extends Element> T getElementWrapper(Element internal) {
-    QName qname = internal.getQName();
-    if (ThreadConstants.IN_REPLY_TO.equals(qname)) 
-      return (T)new InReplyTo(internal);
-    else if (ThreadConstants.THRTOTAL.equals(qname))
-      return (T)new Total(internal);
-    else return (T)internal;
+  public ThreadExtensionFactory() {
+    super(ThreadConstants.THR_NS);
+    addImpl(IN_REPLY_TO,InReplyTo.class);
+    addImpl(THRTOTAL,Total.class);
   }
-
-  public <T extends Base> String getMimeType(T base) {
-    return null;
-  }
-
-
-
+  
 }



Mime
View raw message