abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r433823 [2/3] - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/cache/ client/src/main/java/org/apache/abdera/protocol/client/ client/src/main/java/org/apache/abdera/protocol/util/ client/src/test/java/org/a...
Date Wed, 23 Aug 2006 01:13:32 GMT
Modified: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMTotal.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMTotal.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMTotal.java (original)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/impl/FOMTotal.java Tue Aug 22 18:13:27 2006
@@ -21,7 +21,6 @@
 
 import org.apache.abdera.ext.thread.ThreadConstants;
 import org.apache.abdera.ext.thread.Total;
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.parser.stax.FOMElement;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
@@ -34,7 +33,7 @@
   private static final long serialVersionUID = 241599118592917827L;
 
   public FOMTotal() {
-    super(ThreadConstants.THRTOTAL, null, (OMFactory)Factory.INSTANCE);
+    super(ThreadConstants.THRTOTAL);
   }
   
   public FOMTotal(

Modified: incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/opensearch/OpenSearchTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/opensearch/OpenSearchTest.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/opensearch/OpenSearchTest.java (original)
+++ incubator/abdera/java/trunk/extensions/src/test/java/org/apache/abdera/test/ext/opensearch/OpenSearchTest.java Tue Aug 22 18:13:27 2006
@@ -19,6 +19,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Document;
 
@@ -34,8 +35,10 @@
 public class OpenSearchTest extends TestCase {
   public void testBasics()
   {
+    Parser parser = Abdera.getNewParser();
+    
     InputStream stream = OpenSearchTest.class.getResourceAsStream("/opensearch.xml");
-    Document<Element> doc = Parser.INSTANCE.parse(stream);
+    Document<Element> doc = parser.parse(stream);
 
     TotalResults tr = doc.getRoot().getFirstChild(OpenSearchConstants.TOTAL_RESULTS);
     assertNotNull(tr);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java Tue Aug 22 18:13:27 2006
@@ -17,15 +17,11 @@
 */
 package org.apache.abdera.parser.stax;
 
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.filter.ParseFilter;
 import org.apache.abdera.filter.TextFilter;
 import org.apache.abdera.model.Content;
@@ -47,7 +43,6 @@
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 
-
 public class FOMBuilder 
   extends StAXOMBuilder
   implements Constants {
@@ -63,97 +58,11 @@
     XMLStreamReader parser, 
     ParserOptions parserOptions) {
       super(factory, parser);
-      document = (OMDocument) factory.newDocument();
+      this.document = (OMDocument) factory.newDocument();
       this.parserOptions = parserOptions;
-      fomfactory = factory;
-  }
-
-  public FOMBuilder(
-    FOMFactory factory, 
-    XMLStreamReader parser) {
-      super(factory, parser);
-      document = (OMDocument) factory.newDocument();
-      fomfactory = factory;
-  }
-  
-  public FOMBuilder(
-    String filePath, 
-    ParserOptions parserOptions) 
-      throws XMLStreamException, 
-             FileNotFoundException {
-    super(filePath);
-    document = (OMDocument) Factory.INSTANCE.newDocument();
-    this.parserOptions = parserOptions;
-    fomfactory = getFomFactory();
-    setOMBuilderFactory(fomfactory);
-  }
-
-  public FOMBuilder(
-    FOMFactory factory, 
-    String filePath, 
-    ParserOptions parserOptions) 
-      throws XMLStreamException, 
-             FileNotFoundException {
-    super(filePath);
-    document = (OMDocument) factory.newDocument();
-    this.parserOptions = parserOptions;
-    fomfactory = factory;
-    setOMBuilderFactory(fomfactory);
-  }
-  
-  public FOMBuilder(
-    InputStream inStream, 
-    ParserOptions parserOptions) 
-      throws XMLStreamException {
-    super(inStream);
-    document = (OMDocument) Factory.INSTANCE.newDocument();
-    this.parserOptions = parserOptions;
-    fomfactory = getFomFactory();
-    setOMBuilderFactory(fomfactory);
-  }
-
-  public FOMBuilder(
-    FOMFactory factory, 
-    InputStream inStream, 
-    ParserOptions parserOptions) 
-      throws XMLStreamException {
-    super(inStream);
-    document = (OMDocument) factory.newDocument();
-    this.parserOptions = parserOptions;
-    fomfactory = factory;
-    setOMBuilderFactory(fomfactory);
-  }
-
-  public FOMBuilder(
-    XMLStreamReader parser, 
-    ParserOptions parserOptions) {
-      super(parser);
-      document = (OMDocument) Factory.INSTANCE.newDocument();
-      this.parserOptions = parserOptions;
-      fomfactory = getFomFactory();
-      setOMBuilderFactory(fomfactory);
-  }
-  
-  public FOMBuilder(
-    XMLStreamReader parser, 
-    FOMFactory factory, 
-    ParserOptions parserOptions) {
-      super(factory, parser);
-      document = (OMDocument) factory.newDocument();
-      this.parserOptions = parserOptions;
-      fomfactory = factory;
+      this.fomfactory = factory;
   }
  
-  private FOMFactory getFomFactory() {
-    FOMFactory factory = 
-      (parserOptions != null) ? 
-        (FOMFactory)parserOptions.getFactory() : null;
-    if (factory == null)
-      factory = (Factory.INSTANCE instanceof FOMFactory) ? 
-          (FOMFactory)Factory.INSTANCE : new FOMFactory();
-    return factory;
-  }
-  
   public ParserOptions getParserOptions() {
     return parserOptions;
   }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -39,7 +38,7 @@
   private static final long serialVersionUID = -4313042828936786803L;
   
   public FOMCategory() {
-    super(Constants.CATEGORY, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.CATEGORY);
   }
   
   public FOMCategory(String term) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java Tue Aug 22 18:13:27 2006
@@ -23,7 +23,6 @@
 import javax.activation.MimeType;
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.MimeTypeHelper;
@@ -33,7 +32,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMCollection 
   extends FOMExtensibleElement 
   implements Collection {
@@ -41,7 +39,7 @@
   private static final long serialVersionUID = -5291734055253987136L;
 
   public FOMCollection() {
-    super(Constants.COLLECTION, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.COLLECTION);
   }
   
   public FOMCollection(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java Tue Aug 22 18:13:27 2006
@@ -26,7 +26,6 @@
 import javax.activation.URLDataSource;
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
@@ -47,7 +46,7 @@
   protected Type type = null;
   
   public FOMContent(Content.Type type) {
-    super(Constants.CONTENT, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.CONTENT);
     init(type);
   }
   

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMControl.java Tue Aug 22 18:13:27 2006
@@ -19,7 +19,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Control;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -29,7 +28,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMControl
   extends FOMExtensibleElement
   implements Control {
@@ -37,7 +35,7 @@
   private static final long serialVersionUID = -3816493378953555206L;
 
   public FOMControl() {
-    super(Constants.CONTROL, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.CONTROL);
   }
   
   public FOMControl(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDateTime.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.DateTime;
 import org.apache.axiom.om.OMContainer;
@@ -31,7 +30,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMDateTime 
   extends FOMElement 
   implements DateTime {
@@ -39,7 +37,7 @@
   private static final long serialVersionUID = -6611503566172011733L;
 
   public FOMDateTime(QName qname) {
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname);
   }
   
   public FOMDateTime(QName qname, Date date) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java Tue Aug 22 18:13:27 2006
@@ -25,7 +25,6 @@
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -36,7 +35,6 @@
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMDiv 
   extends FOMExtensibleElement 
   implements Div {
@@ -44,7 +42,7 @@
   private static final long serialVersionUID = -2319449893405850433L;
 
   public FOMDiv() {
-    super(Constants.DIV, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.DIV);
   }
   
   public FOMDiv(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Tue Aug 22 18:13:27 2006
@@ -67,7 +67,7 @@
   private static final long serialVersionUID = 8024257594220911953L;
   
   public FOMElement(QName qname) {
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname, null, null);
   }
   
   public FOMElement(
@@ -579,5 +579,5 @@
     }
     return locale;
   }
-  
+
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java Tue Aug 22 18:13:27 2006
@@ -27,7 +27,6 @@
 import javax.activation.MimeTypeParseException;
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Content;
@@ -60,7 +59,7 @@
   private static final long serialVersionUID = 1L;
 
   public FOMEntry() {
-    super(Constants.ENTRY, new FOMDocument(), (OMFactory)Factory.INSTANCE);
+    super(Constants.ENTRY, new FOMDocument(), new FOMFactory());
   }
   
   public FOMEntry(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java Tue Aug 22 18:13:27 2006
@@ -21,7 +21,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ExtensibleElement;
 import org.apache.abdera.parser.stax.util.FOMExtensionIterator;
@@ -33,13 +32,12 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public abstract class FOMExtensibleElement 
   extends FOMElement 
   implements ExtensibleElement {
 
   public FOMExtensibleElement(QName qname) {
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname);
   }
   
   public FOMExtensibleElement(

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?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- 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 Tue Aug 22 18:13:27 2006
@@ -27,6 +27,7 @@
 import javax.activation.MimeTypeParseException;
 import javax.xml.namespace.QName;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.ExtensionFactory;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Base;
@@ -65,13 +66,26 @@
   extends OMLinkedListImplFactory 
   implements Factory, Constants, ExtensionFactory, FOMExtensionFactory {
 
+  private Abdera abdera = null;
   private Map<QName,Class> extensions = null;
   private List<ExtensionFactory> factories = null;
   
+  public FOMFactory() {
+    this.abdera = new Abdera();
+  }
+  
+  public FOMFactory(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
   public Parser newParser() {
     return new FOMParser();
   }
   
+  private Abdera getAbdera() {
+    return abdera;
+  }
+  
   @SuppressWarnings("unchecked")
   public <T extends Element>Document<T> newDocument() {
     return new FOMDocument(this);
@@ -409,7 +423,7 @@
   private List<ExtensionFactory> getExtensionFactories() {
     if (factories == null) {
       factories = new ArrayList<ExtensionFactory>(
-        org.apache.abdera.util.ServiceUtil.loadExtensionFactories());
+        getAbdera().getConfiguration().getExtensionFactories());
     }
     factories.add(0, this);
     return factories;

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java Tue Aug 22 18:13:27 2006
@@ -27,7 +27,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Source;
@@ -48,7 +47,7 @@
   private static final long serialVersionUID = 4552921210185524535L;
   
   public FOMFeed() {
-    super(Constants.FEED, new FOMDocument(), (OMFactory)Factory.INSTANCE);
+    super(Constants.FEED, new FOMDocument(), new FOMFactory());
   }
   
   public FOMFeed(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Generator;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -31,7 +30,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMGenerator 
   extends FOMElement 
   implements Generator {
@@ -39,7 +37,7 @@
   private static final long serialVersionUID = -8441971633807437976L;
 
   public FOMGenerator() {
-    super(Constants.GENERATOR, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.GENERATOR);
   }
   
   public FOMGenerator(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.IRI;
 import org.apache.abdera.util.URIHelper;
 import org.apache.axiom.om.OMContainer;
@@ -31,7 +30,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMIRI 
   extends FOMElement 
   implements IRI {
@@ -39,7 +37,7 @@
   private static final long serialVersionUID = -8434722753544181200L;
 
   public FOMIRI(QName qname) {
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname);
   }
   
   public FOMIRI(QName qname, String value) throws URISyntaxException {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java Tue Aug 22 18:13:27 2006
@@ -26,7 +26,6 @@
 import javax.activation.MimeTypeParseException;
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
@@ -36,7 +35,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMLink 
   extends FOMExtensibleElement 
   implements Link {
@@ -44,7 +42,7 @@
   private static final long serialVersionUID = 2239772197929910635L;
 
   public FOMLink() {
-    super(Constants.LINK, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.LINK);
   }
   
   public FOMLink(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java Tue Aug 22 18:13:27 2006
@@ -23,6 +23,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
@@ -38,6 +39,14 @@
   extends AbstractParser 
   implements Parser {
 
+  public FOMParser() {
+    super();
+  }
+  
+  public FOMParser(Abdera abdera) {
+    super(abdera);
+  }
+  
   /**
    * The current set of default ParserOptions.
    *
@@ -49,9 +58,11 @@
     FOMFactory factory = 
       (options != null && options.getFactory() != null) ? 
         (FOMFactory)options.getFactory() : null;
-    if (factory == null)
-      factory = (Factory.INSTANCE instanceof FOMFactory) ? 
-        (FOMFactory)Factory.INSTANCE : new FOMFactory();
+    if (factory == null) {
+      Factory f = getFactory();
+      factory = (f instanceof FOMFactory) ? 
+        (FOMFactory)f : new FOMFactory();
+    }
     return factory;
   }
   

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java Tue Aug 22 18:13:27 2006
@@ -17,20 +17,32 @@
 */
 package org.apache.abdera.parser.stax;
 
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.parser.NamedParser;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserFactory;
-import org.apache.abdera.util.ServiceUtil;
 
 public class FOMParserFactory 
   implements ParserFactory {
 
+  private Abdera abdera = null;
+  
+  public FOMParserFactory() {
+    this.abdera = new Abdera();
+  }
+  
+  public FOMParserFactory(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
+  protected Abdera getAbdera() {
+    return abdera;
+  }
+  
   public Parser getParser() {
-    return Parser.INSTANCE;
+    return getAbdera().getParser();
   }
 
   public Parser getParser(String name) {
@@ -38,18 +50,8 @@
       loadParsers().get(name) : getParser();
   }
 
-  private static Map<String,NamedParser> parsers = null;
-  
-  public static Map<String,NamedParser> loadParsers() {
-    if (parsers == null) {
-      List<NamedParser> _parsers = 
-        ServiceUtil._loadimpls(
-          "META-INF/services/org.apache.abdera.parser.NamedParser");
-      parsers = new HashMap<String,NamedParser>();
-      for (NamedParser parser : _parsers) {
-        parsers.put(parser.getName(), parser);
-      }
-    }
-    return parsers;
+  private Map<String,NamedParser> loadParsers() {
+    return getAbdera().getConfiguration().getNamedParsers();
   }
+  
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java Tue Aug 22 18:13:27 2006
@@ -25,7 +25,7 @@
   extends AbstractParserOptions {
 
   protected void initFactory() {
-    factory = (Factory.INSTANCE instanceof FOMFactory) ? (FOMFactory)Factory.INSTANCE : new FOMFactory();
+    factory = new FOMFactory();
   }
   
   protected void checkFactory(Factory factory) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.IRI;
 import org.apache.abdera.model.Person;
@@ -40,7 +39,7 @@
   private static final long serialVersionUID = 2147684807662492625L; 
   
   public FOMPerson(QName qname) { 
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname);
   }
   
   public FOMPerson(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java Tue Aug 22 18:13:27 2006
@@ -21,7 +21,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Service;
 import org.apache.abdera.model.Workspace;
@@ -33,7 +32,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMService
   extends FOMExtensibleElement 
   implements Service {
@@ -41,7 +39,7 @@
   private static final long serialVersionUID = 7982751563668891240L;
 
   public FOMService() {
-    super(Constants.SERVICE, new FOMDocument(), (OMFactory)Factory.INSTANCE);
+    super(Constants.SERVICE, new FOMDocument(), new FOMFactory());
   }
   
   public FOMService(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java Tue Aug 22 18:13:27 2006
@@ -25,7 +25,6 @@
 import javax.activation.MimeTypeParseException;
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.AtomDate;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.DateTime;
@@ -53,7 +52,7 @@
   private static final long serialVersionUID = 9153127297531238021L; 
   
   public FOMSource() {
-    super(Constants.SOURCE, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.SOURCE);
   }
   
   public FOMSource(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Text;
@@ -42,7 +41,7 @@
   protected Type type = null;
   
   public FOMText(QName qname, Text.Type type) {
-    super(qname, null, (OMFactory)Factory.INSTANCE);
+    super(qname);
     init(type);
   }
   

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java Tue Aug 22 18:13:27 2006
@@ -22,7 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.factory.Factory;
 import org.apache.abdera.model.Collection;
 import org.apache.abdera.model.Workspace;
 import org.apache.abdera.util.Constants;
@@ -33,7 +32,6 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
-
 public class FOMWorkspace
   extends FOMExtensibleElement 
   implements Workspace {
@@ -41,7 +39,7 @@
   private static final long serialVersionUID = -421749865550509424L; 
 
   public FOMWorkspace() {
-    super(Constants.WORKSPACE, null, (OMFactory)Factory.INSTANCE);
+    super(Constants.WORKSPACE);
   }
   
   public FOMWorkspace(String title) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriter.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriter.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriter.java Tue Aug 22 18:13:27 2006
@@ -22,11 +22,16 @@
 import java.io.OutputStream;
 import java.io.Writer;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Base;
 
 public class FOMWriter 
   implements org.apache.abdera.writer.Writer {
 
+  public FOMWriter() {}
+  
+  public FOMWriter(Abdera abdera) {}
+  
   public void writeTo(
     Base base, 
     OutputStream out) 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java Tue Aug 22 18:13:27 2006
@@ -17,11 +17,9 @@
 */
 package org.apache.abdera.parser.stax;
 
-import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
-import org.apache.abdera.util.ServiceUtil;
+import org.apache.abdera.Abdera;
 import org.apache.abdera.writer.NamedWriter;
 import org.apache.abdera.writer.Writer;
 import org.apache.abdera.writer.WriterFactory;
@@ -29,8 +27,22 @@
 public class FOMWriterFactory 
   implements WriterFactory {
 
+  private Abdera abdera = null;
+  
+  public FOMWriterFactory() {
+    this.abdera = new Abdera();
+  }
+  
+  public FOMWriterFactory(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
+  protected Abdera getAbdera() {
+    return abdera;
+  }
+  
   public Writer getWriter() {
-    return Writer.INSTANCE;
+    return getAbdera().getWriter();
   }
 
   public Writer getWriter(String name) {
@@ -38,18 +50,8 @@
       loadWriters().get(name) : getWriter();
   }
 
-  private static Map<String,NamedWriter> writers = null;
-  
-  public static Map<String,NamedWriter> loadWriters() {
-    if (writers == null) {
-      List<NamedWriter> _writers = 
-        ServiceUtil._loadimpls(
-          "META-INF/services/org.apache.abdera.writer.NamedWriter");
-      writers = new HashMap<String,NamedWriter>();
-      for (NamedWriter writer : _writers) {
-        writers.put(writer.getName(), writer);
-      }
-    }
-    return writers;
+  private Map<String,NamedWriter> loadWriters() {
+    return getAbdera().getConfiguration().getNamedWriters();
   }
+  
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMXPath.java Tue Aug 22 18:13:27 2006
@@ -29,7 +29,7 @@
 import org.jaxen.XPath;
 
 public class FOMXPath extends AbstractXPath {
-
+  
   public static XPath getXPath(String path) throws JaxenException {
     return getXPath(path, null);
   }

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java (original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java Tue Aug 22 18:13:27 2006
@@ -29,14 +29,13 @@
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.model.Text;
-import org.apache.abdera.parser.Parser;
 import org.apache.axiom.om.OMElement;
 
 public class AtomConformanceTest extends BaseParserTestCase {
-
+  
   private static Document<Feed> get(URI uri) {
     try {
-      return Parser.INSTANCE.parse(uri.toURL().openStream(), uri);
+      return getParser().parse(uri.toURL().openStream(), uri);
     } catch (Exception e) {}
     return null;
   }

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/BaseParserTestCase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/BaseParserTestCase.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/BaseParserTestCase.java (original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/BaseParserTestCase.java Tue Aug 22 18:13:27 2006
@@ -19,6 +19,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.parser.Parser;
@@ -28,16 +29,22 @@
 
 public abstract class BaseParserTestCase extends TestCase {
 
+  private static Abdera abdera = new Abdera();
+  
+  protected static Parser getParser() {
+    return abdera.getParser();
+  }
+  
   protected static <T extends Element>Document<T> parse(URI uri) {
     try {
       String uriStr = uri.toString();
       String path = uriStr.substring(uriStr.indexOf("//") + 1);
       InputStream stream = BaseParserTestCase.class.getResourceAsStream(path);
-      return Parser.INSTANCE.parse(stream, uri);
+      return getParser().parse(stream, uri);
     } catch (Exception e) {
       // when getting it local fails, fall back to getting it from the server
       try {
-        return Parser.INSTANCE.parse(uri.toURL().openStream(), uri);
+        return getParser().parse(uri.toURL().openStream(), uri);
       } catch (Exception ex) {}
     }
     return null;

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java (original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java Tue Aug 22 18:13:27 2006
@@ -32,6 +32,7 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.stream.StreamResult;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.filter.ParseFilter;
 import org.apache.abdera.filter.TextFilter;
@@ -56,13 +57,16 @@
 import org.apache.abdera.model.Text;
 import org.apache.abdera.model.Workspace;
 import org.apache.abdera.parser.Parser;
+import org.apache.abdera.parser.ParserFactory;
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.util.AbderaSource;
-import org.apache.abdera.util.BlackListParseFilter;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
 import org.apache.abdera.util.Version;
-import org.apache.abdera.util.WhiteListParseFilter;
+import org.apache.abdera.util.filter.BlackListParseFilter;
+import org.apache.abdera.util.filter.WhiteListParseFilter;
+import org.apache.abdera.writer.Writer;
+import org.apache.abdera.writer.WriterFactory;
 import org.apache.abdera.xpath.XPath;
 import org.apache.axiom.attachments.ByteArrayDataSource;
 
@@ -70,16 +74,45 @@
 
 public class FOMTest extends TestCase   {
 
+  private static Abdera abdera = new Abdera();
+  
+  private static Parser getParser() {
+    return abdera.getParser();
+  }
+  
+  private static Factory getFactory() {
+    return abdera.getFactory();
+  }
+  
+  private static XPath getXPath() {
+    return abdera.getXPath();
+  }
+  
+  private static WriterFactory getWriterFactory() {
+    return abdera.getWriterFactory();
+  }
+  
+  private static ParserFactory getParserFactory() {
+    return abdera.getParserFactory();
+  }
+  
+  private static Writer getWriter() {
+    return abdera.getWriter();
+  }
+  
   public static void testMinimalConfiguration() {
-    assertNotNull(Factory.INSTANCE);
-    assertNotNull(Parser.INSTANCE);
-    assertNotNull(XPath.INSTANCE);
+    assertNotNull(getFactory());
+    assertNotNull(getParser());
+    assertNotNull(getXPath());
+    assertNotNull(getWriterFactory());
+    assertNotNull(getParserFactory());
+    assertNotNull(getWriter());
   }
   
   public void testParser() throws Exception {
     
     InputStream in = FOMTest.class.getResourceAsStream("/simple.xml");
-    Document<Feed> doc = Parser.INSTANCE.parse(in);
+    Document<Feed> doc = getParser().parse(in);
     Feed feed = doc.getRoot();
     
     assertEquals(feed.getTitle(),"Example Feed");
@@ -102,7 +135,7 @@
   }
 
   public void testCreate() throws Exception {
-    Feed feed = Factory.INSTANCE.newFeed();
+    Feed feed = getFactory().newFeed();
     feed.setLanguage("en-US");
     feed.setBaseUri("http://example.org");
     
@@ -147,13 +180,13 @@
     filter.add(Constants.ENTRY);
     filter.add(Constants.TITLE);
     filter.add(Constants.ID);
-    ParserOptions options = Parser.INSTANCE.getDefaultParserOptions();
+    ParserOptions options = getParser().getDefaultParserOptions();
     options.setParseFilter(filter);
     
     URL url = FOMTest.class.getResource("/simple.xml");
     InputStream in = url.openStream();
 
-    Document<Feed> doc = Parser.INSTANCE.parse(in, url.toURI(), options);
+    Document<Feed> doc = getParser().parse(in, url.toURI(), options);
     Feed feed = doc.getRoot();
     
     assertEquals(feed.getTitle(),"Example Feed");
@@ -178,13 +211,13 @@
     
     ParseFilter filter = new BlackListParseFilter();
     filter.add(Constants.UPDATED);
-    ParserOptions options = Parser.INSTANCE.getDefaultParserOptions();
+    ParserOptions options = getParser().getDefaultParserOptions();
     options.setParseFilter(filter);
     
     URL url = FOMTest.class.getResource("/simple.xml");
     InputStream in = url.openStream();
 
-    Document<Feed> doc = Parser.INSTANCE.parse(in, url.toURI(), options);
+    Document<Feed> doc = getParser().parse(in, url.toURI(), options);
     Feed feed = doc.getRoot();
     
     assertEquals(feed.getTitle(),"Example Feed");
@@ -222,12 +255,12 @@
       }
     };
     
-    ParserOptions options = Parser.INSTANCE.getDefaultParserOptions();
+    ParserOptions options = getParser().getDefaultParserOptions();
     options.setTextFilter(filter);
     
     URL url = FOMTest.class.getResource("/simple.xml");
     InputStream in = url.openStream();
-    Document<Feed> doc = Parser.INSTANCE.parse(in, url.toURI(), options);
+    Document<Feed> doc = getParser().parse(in, url.toURI(), options);
     Feed feed = doc.getRoot();
     
     assertEquals(feed.getTitle(),"Example Feed");
@@ -252,9 +285,9 @@
   public void testXPath() throws Exception {
     
     InputStream in = FOMTest.class.getResourceAsStream("/simple.xml");
-    Document<Feed> doc = Parser.INSTANCE.parse(in);
+    Document<Feed> doc = getParser().parse(in);
     Feed feed = doc.getRoot();
-    XPath xpath = XPath.INSTANCE;
+    XPath xpath = getXPath();
     assertEquals(xpath.evaluate("count(/a:feed)", feed), 1.0d);
     assertTrue(xpath.isTrue("/a:feed/a:entry", feed));
     assertEquals(xpath.numericValueOf("count(/a:feed)", feed), 1.0d);
@@ -275,7 +308,7 @@
   }
   
   public void testFactory() throws Exception {
-    Factory factory = Factory.INSTANCE;
+    Factory factory = getFactory();
     Person author = factory.newAuthor();
     assertNotNull(author);
     author = factory.newAuthor();
@@ -649,7 +682,7 @@
   
   public void testRoundtrip() throws Exception {
 
-    Feed feed = Factory.INSTANCE.newFeed();
+    Feed feed = getFactory().newFeed();
     feed.setLanguage("en-US");
     feed.setBaseUri("http://example.org");
     
@@ -676,7 +709,7 @@
     feed.getDocument().writeTo(out);
     
     ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-    Document<Feed> doc = Parser.INSTANCE.parse(in);
+    Document<Feed> doc = getParser().parse(in);
     feed = doc.getRoot();
     
     assertEquals(feed.getLanguage(), "en-US");
@@ -709,10 +742,10 @@
     try {
       // Apply an XSLT transform to the entire Feed
       TransformerFactory factory = TransformerFactory.newInstance();
-      Document xslt = Parser.INSTANCE.parse(FOMTest.class.getResourceAsStream("/test.xslt"));
+      Document xslt = getParser().parse(FOMTest.class.getResourceAsStream("/test.xslt"));
       AbderaSource xsltSource = new AbderaSource(xslt);
       Transformer transformer = factory.newTransformer(xsltSource);
-      Document<Feed> feed = Parser.INSTANCE.parse(FOMTest.class.getResourceAsStream("/simple.xml"));
+      Document<Feed> feed = getParser().parse(FOMTest.class.getResourceAsStream("/simple.xml"));
       AbderaSource feedSource = new AbderaSource(feed);
       ByteArrayOutputStream out = new ByteArrayOutputStream();
       Result result = new StreamResult(out);
@@ -720,10 +753,10 @@
       assertEquals(out.toString(), "This is a test urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6");
       
       // Apply an XSLT transform to XML in the content element
-      xslt = Parser.INSTANCE.parse(FOMTest.class.getResourceAsStream("/content.xslt"));
+      xslt = getParser().parse(FOMTest.class.getResourceAsStream("/content.xslt"));
       xsltSource = new AbderaSource(xslt);
       transformer = factory.newTransformer(xsltSource);
-      feed = Parser.INSTANCE.parse(FOMTest.class.getResourceAsStream("/xmlcontent.xml"));
+      feed = getParser().parse(FOMTest.class.getResourceAsStream("/xmlcontent.xml"));
       Entry entry = feed.getRoot().getEntries().get(0);
       Content content = entry.getContentElement();
       AbderaSource contentSource = new AbderaSource(content.getValueElement());

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedValidatorTest.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedValidatorTest.java (original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedValidatorTest.java Tue Aug 22 18:13:27 2006
@@ -2518,7 +2518,9 @@
      assertNotNull(doc);
      Entry entry = doc.getRoot().getEntries().get(0);
      assertEquals(entry.getContentType(), Content.Type.XHTML);
-     assertEquals(entry.getContent().trim(), "Some &lt;b&gt;bold&lt;/b&gt; text.");
+     String c = entry.getContent().trim();
+     c = c.replaceAll(">", "&gt;");
+     assertEquals(c, "Some &lt;b&gt;bold&lt;/b&gt; text.");
    }
    
    public static void testSection4133ContentXhtmlMixed() throws Exception {
@@ -2528,7 +2530,9 @@
      assertNotNull(doc);
      Entry entry = doc.getRoot().getEntries().get(0);
      assertEquals(entry.getContentType(), Content.Type.XHTML);
-     assertEquals(entry.getContent().trim(), "<b xmlns=\"http://www.w3.org/1999/xhtml\">Example:</b> Some &lt;b&gt;bold&lt;/b&gt; text.");
+     String c = entry.getContent().trim();
+     c = c.replaceAll("Some &lt;b>bold&lt;/b>", "Some &lt;b&gt;bold&lt;/b&gt;");
+     assertEquals(c, "<b xmlns=\"http://www.w3.org/1999/xhtml\">Example:</b> Some &lt;b&gt;bold&lt;/b&gt; text.");
    }
    
    public static void testSection4133ContentXhtmlNoXhtmlDiv() throws Exception {
@@ -2548,7 +2552,9 @@
      assertNotNull(doc);
      Entry entry = doc.getRoot().getEntries().get(0);
      assertEquals(entry.getContentType(), Content.Type.XHTML);
-     assertEquals(entry.getContent(),"Some &lt;x&gt;bold&lt;/x&gt; text.");
+     String c = entry.getContent();
+     c = c.replaceAll(">", "&gt;");
+     assertEquals(c,"Some &lt;x&gt;bold&lt;/x&gt; text.");
    }
    
    public static void testSection4133ContentXhtmlTextChildren() throws Exception {

Modified: incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/ParserTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/ParserTest.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/ParserTest.java (original)
+++ incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/ParserTest.java Tue Aug 22 18:13:27 2006
@@ -17,38 +17,34 @@
 */
 package org.apache.abdera.test.parser.stax;
 
-import org.apache.abdera.factory.Factory;
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.Service;
 import org.apache.abdera.parser.Parser;
-import org.apache.abdera.parser.stax.FOMFactory;
-import org.apache.abdera.parser.stax.FOMParser;
-import org.apache.abdera.parser.stax.FOMXPath;
-import org.apache.abdera.xpath.XPath;
 
 import junit.framework.TestCase;
 
 public class ParserTest extends TestCase {
 
-  public static void testConfiguration() {
-    assertTrue(Factory.INSTANCE instanceof FOMFactory);
-    assertTrue(Parser.INSTANCE instanceof FOMParser);
-    assertTrue(XPath.INSTANCE instanceof FOMXPath);
+  private static Abdera abdera = new Abdera();
+  
+  private static Parser getParser() {
+    return abdera.getParser();
   }
   
   public static void testParse() {
     
-    Document<Feed> feedDoc = Parser.INSTANCE.parse(ParserTest.class.getResourceAsStream("/simpleFeed.xml"));
+    Document<Feed> feedDoc = getParser().parse(ParserTest.class.getResourceAsStream("/simpleFeed.xml"));
     assertTrue(feedDoc.getRoot() instanceof Feed);
     assertEquals(feedDoc.getCharset(), "utf-8");
     
-    Document<Entry> entryDoc = Parser.INSTANCE.parse(ParserTest.class.getResourceAsStream("/simpleEntry.xml"));
+    Document<Entry> entryDoc = getParser().parse(ParserTest.class.getResourceAsStream("/simpleEntry.xml"));
     assertTrue(entryDoc.getRoot() instanceof Entry);
     assertEquals(entryDoc.getCharset(), "utf-8");
     
-    Document<Service> serviceDoc = Parser.INSTANCE.parse(ParserTest.class.getResourceAsStream("/simpleService.xml"));
+    Document<Service> serviceDoc = getParser().parse(ParserTest.class.getResourceAsStream("/simpleService.xml"));
     assertTrue(serviceDoc.getRoot() instanceof Service);
     assertEquals(serviceDoc.getCharset(), "utf-8");
     

Added: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/AbderaSecurity.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/AbderaSecurity.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/AbderaSecurity.java (added)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/AbderaSecurity.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,74 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.security;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.util.AbderaConfiguration;
+import org.apache.abdera.util.ServiceUtil;
+
+public class AbderaSecurity {
+
+  private Abdera abdera = null;
+  private Encryption encryption = null;
+  private Signature signature = null;
+  
+  public AbderaSecurity() {
+    abdera = new Abdera();
+  }
+  
+  public AbderaSecurity(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
+  public AbderaSecurity(AbderaConfiguration config) {
+    this.abdera = new Abdera(config);
+  }
+  
+  private Abdera getAbdera() {
+    return abdera;
+  }
+  
+  public Encryption newEncryption() {
+    return
+      (Encryption) ServiceUtil.newInstance(
+          "org.apache.abdera.security.Encryption", 
+          "org.apache.abdera.security.xmlsec.XmlEncryption",
+          getAbdera());
+  }
+  
+  public Encryption getEncryption() {
+    if (encryption == null)
+      encryption = newEncryption();
+    return encryption;
+  }
+  
+  public Signature newSignature() {
+    return
+      (Signature) ServiceUtil.newInstance(
+        "org.apache.abdera.security.Signature", 
+        "org.apache.abdera.security.xmlsec.XmlSignature",
+        getAbdera());
+  }
+  
+  public Signature getSignature() {
+    if (signature == null)
+      signature = newSignature();
+    return signature;
+  }
+  
+}

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Encryption.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Encryption.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Encryption.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Encryption.java Tue Aug 22 18:13:27 2006
@@ -18,16 +18,9 @@
 package org.apache.abdera.security;
 
 import org.apache.abdera.model.Document;
-import org.apache.abdera.util.ServiceUtil;
-
 
 public interface Encryption {
 
-  public static final Encryption INSTANCE = 
-    (Encryption) ServiceUtil.newInstance(
-      "org.apache.abdera.security.Encryption", 
-      "org.apache.abdera.security.xmlsec.XmlEncryption");
-  
   Document encrypt(Document doc, EncryptionOptions options) throws SecurityException;
   
   Document decrypt(Document doc, EncryptionOptions options) throws SecurityException;

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Signature.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Signature.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Signature.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/Signature.java Tue Aug 22 18:13:27 2006
@@ -19,16 +19,9 @@
 
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
-import org.apache.abdera.util.ServiceUtil;
-
 
 public interface Signature {
 
-  public static final Signature INSTANCE = 
-    (Signature) ServiceUtil.newInstance(
-      "org.apache.abdera.security.Signature", 
-      "org.apache.abdera.security.xmlsec.XmlSignature");
-  
   boolean isSigned(Entry entry) throws SecurityException;
   
   boolean isSigned(Feed feed) throws SecurityException;

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/EncryptionBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/EncryptionBase.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/EncryptionBase.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/EncryptionBase.java Tue Aug 22 18:13:27 2006
@@ -17,6 +17,7 @@
 */
 package org.apache.abdera.security.util;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.security.Encryption;
@@ -26,7 +27,11 @@
 public abstract class EncryptionBase 
   extends SecurityBase
   implements Encryption {
-
+  
+  public EncryptionBase(Abdera abdera) {
+    super(abdera);
+  }
+  
   public boolean isEncrypted(
     Document doc) throws SecurityException {
       Element el = doc.getRoot();

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SecurityBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SecurityBase.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SecurityBase.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SecurityBase.java Tue Aug 22 18:13:27 2006
@@ -23,6 +23,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.security.SecurityOptions;
@@ -31,6 +32,16 @@
 
 
 public abstract class SecurityBase {
+  
+  protected Abdera abdera = null;
+  
+  protected SecurityBase(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
+  protected Abdera getAbdera() {
+    return abdera;
+  }
   
   protected org.w3c.dom.Document fomToDom(
     Document doc, 

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SignatureBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SignatureBase.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SignatureBase.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/SignatureBase.java Tue Aug 22 18:13:27 2006
@@ -17,6 +17,7 @@
 */
 package org.apache.abdera.security.util;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.ExtensibleElement;
 import org.apache.abdera.model.Feed;
@@ -27,6 +28,10 @@
 public abstract class SignatureBase 
   extends SecurityBase
   implements Signature {
+
+  protected SignatureBase(Abdera abdera) {
+    super(abdera);
+  }
 
   public boolean isSigned(
     Entry entry)  throws SecurityException {

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryption.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryption.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryption.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryption.java Tue Aug 22 18:13:27 2006
@@ -19,8 +19,8 @@
 
 import java.security.Key;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
-import org.apache.abdera.security.Encryption;
 import org.apache.abdera.security.EncryptionOptions;
 import org.apache.abdera.security.SecurityException;
 import org.apache.abdera.security.util.EncryptionBase;
@@ -31,13 +31,20 @@
 
 
 public class XmlEncryption 
-  extends EncryptionBase 
-  implements Encryption {
+  extends EncryptionBase {
 
   static {
     if (!org.apache.xml.security.Init.isInitialized())
       org.apache.xml.security.Init.init();
   }
+
+  public XmlEncryption() {
+    super(new Abdera());
+  }
+  
+  public XmlEncryption(Abdera abdera) {
+    super(abdera);
+  }
   
   public Document encrypt(
     Document doc, 
@@ -89,7 +96,7 @@
 
 
   public EncryptionOptions getDefaultEncryptionOptions() {
-    return new XmlEncryptionOptions();
+    return new XmlEncryptionOptions(getAbdera());
   }
 
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java Tue Aug 22 18:13:27 2006
@@ -19,9 +19,9 @@
 
 import java.security.Key;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.security.EncryptionOptions;
 
-
 public class XmlEncryptionOptions 
   extends XmlSecurityOptions
   implements EncryptionOptions {
@@ -31,6 +31,10 @@
   private String kca = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
   private String dca = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
   private boolean setki = false;
+  
+  protected XmlEncryptionOptions(Abdera abdera) {
+    super(abdera);
+  }
   
   public Key getDataEncryptionKey() {
     return dek;

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java Tue Aug 22 18:13:27 2006
@@ -17,6 +17,7 @@
 */
 package org.apache.abdera.security.xmlsec;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.security.SecurityOptions;
 
@@ -25,9 +26,14 @@
   implements SecurityOptions {
 
   protected Parser parser = null;
-
+  protected Abdera abdera = null;
+  
+  protected XmlSecurityOptions(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
   public Parser getParser() {
-    return (parser != null) ? parser : Parser.INSTANCE;
+    return (parser != null) ? parser : abdera.getParser();
   }
 
   public void setParser(Parser parser) {

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignature.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignature.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignature.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignature.java Tue Aug 22 18:13:27 2006
@@ -23,6 +23,7 @@
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
@@ -46,6 +47,14 @@
     if (!org.apache.xml.security.Init.isInitialized())
       org.apache.xml.security.Init.init();
   }
+
+  public XmlSignature() {
+    super(new Abdera());
+  }
+  
+  public XmlSignature(Abdera abdera) {
+    super(abdera);
+  }
   
   private Element _sign(
     Element element, 
@@ -156,7 +165,7 @@
   }
 
   public SignatureOptions getDefaultSignatureOptions() throws SecurityException {
-    return new XmlSignatureOptions();
+    return new XmlSignatureOptions(getAbdera());
   }
 
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java Tue Aug 22 18:13:27 2006
@@ -20,12 +20,16 @@
 import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
 
+import org.apache.abdera.Abdera;
 import org.apache.abdera.security.SignatureOptions;
 
-
 public class XmlSignatureOptions 
   extends XmlSecurityOptions 
   implements SignatureOptions {
+
+  protected XmlSignatureOptions(Abdera abdera) {
+    super(abdera);
+  }
 
   private PrivateKey signingKey = null;
   private X509Certificate cert = null;

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/AbderaServer.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/AbderaServer.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/AbderaServer.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/AbderaServer.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.util.ServiceUtil;
+
+public class AbderaServer {
+
+  public static final String HANDLER_FACTORY = "org.apache.abdera.server.RequestHandlerFactory";
+  
+  private Abdera abdera = null;
+  private RequestHandlerFactory handlerFactory = null;
+  
+  public AbderaServer() {
+    abdera = new Abdera();
+  }
+  
+  public AbderaServer(Abdera abdera) {
+    this.abdera = abdera;
+  }
+  
+  public RequestHandlerFactory newRequestHandlerFactory() {
+    return (RequestHandlerFactory) ServiceUtil.newInstance(
+      HANDLER_FACTORY, "", abdera);
+  }
+  
+  public RequestHandlerFactory getRequestHandlerFactory() {
+    if (handlerFactory == null)
+      handlerFactory = newRequestHandlerFactory();
+    return handlerFactory;
+  }
+  
+}

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/RequestHandlerFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/RequestHandlerFactory.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/RequestHandlerFactory.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/RequestHandlerFactory.java Tue Aug 22 18:13:27 2006
@@ -18,14 +18,8 @@
 package org.apache.abdera.server;
 
 import org.apache.abdera.server.exceptions.AbderaServerException;
-import org.apache.abdera.util.ServiceUtil;
 
 public interface RequestHandlerFactory {
-  
-  public static final String HANDLER_FACTORY = "org.apache.abdera.server.RequestHandlerFactory";
-
-  public static final RequestHandlerFactory INSTANCE = (RequestHandlerFactory) 
-  	ServiceUtil.newInstance(HANDLER_FACTORY, "");
   
   RequestHandler newRequestHandler(
     RequestContext requestContext) 

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/BadRequestException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/BadRequestException.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/BadRequestException.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/BadRequestException.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,33 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.exceptions;
+
+public class BadRequestException 
+  extends RequestException {
+  
+  private static final long serialVersionUID = -3079456119154632842L;
+
+  public BadRequestException() {
+    super(400, null);
+  }
+
+  public BadRequestException(String text) {
+    super(400, text);
+  }
+  
+}

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/ExistenceException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/ExistenceException.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/ExistenceException.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/ExistenceException.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.exceptions;
+
+public abstract class ExistenceException 
+  extends AbderaServerException {
+
+  private static final long serialVersionUID = -8319652197313604062L;
+
+  public ExistenceException(int status, String text) {
+    super(status, text);
+  }
+
+}

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/GoneException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/GoneException.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/GoneException.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/GoneException.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,33 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.exceptions;
+
+public class GoneException 
+  extends ExistenceException {
+
+  private static final long serialVersionUID = -3161208634818367903L;
+
+  public GoneException() {
+    super(410, null);
+  }
+
+  public GoneException(String text) {
+    super(410, text);
+  }
+  
+}

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotFoundException.java?rev=433823&r1=433822&r2=433823&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotFoundException.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotFoundException.java Tue Aug 22 18:13:27 2006
@@ -17,11 +17,8 @@
 */
 package org.apache.abdera.server.exceptions;
 
-public class NotFoundException extends AbderaServerException {
+public class NotFoundException extends ExistenceException {
   
-  /**
-   * 
-   */
   private static final long serialVersionUID = -3161208634818367903L;
 
   public NotFoundException() {

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotModifiedException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotModifiedException.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotModifiedException.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/NotModifiedException.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,32 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.exceptions;
+
+public class NotModifiedException 
+  extends AbderaServerException {
+
+  private static final long serialVersionUID = 1910787283945132627L;
+
+  public NotModifiedException() {
+    super(304, null);
+  }
+  
+  public NotModifiedException(String text) {
+    super(304, text);
+  }
+}

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/RequestException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/RequestException.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/RequestException.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/exceptions/RequestException.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.exceptions;
+
+public abstract class RequestException 
+  extends AbderaServerException {
+
+  private static final long serialVersionUID = -776170778154933680L;
+
+  public RequestException(int status, String text) {
+    super(status, text);
+  }
+
+}

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/impl/BaseRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/impl/BaseRequestHandler.java?rev=433823&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/impl/BaseRequestHandler.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/server/impl/BaseRequestHandler.java Tue Aug 22 18:13:27 2006
@@ -0,0 +1,165 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.server.impl;
+
+import org.apache.abdera.server.RequestContext;
+import org.apache.abdera.server.RequestHandler;
+import org.apache.abdera.server.ResponseContext;
+import org.apache.abdera.server.cache.Cache;
+import org.apache.abdera.server.cache.CacheEntry;
+import org.apache.abdera.server.exceptions.AbderaServerException;
+import org.apache.abdera.server.exceptions.ExistenceException;
+import org.apache.abdera.server.exceptions.MethodNotAllowedException;
+import org.apache.abdera.server.exceptions.NotFoundException;
+import org.apache.abdera.server.exceptions.NotModifiedException;
+import org.apache.abdera.server.exceptions.RequestException;
+
+public abstract class BaseRequestHandler 
+  implements RequestHandler {
+
+  public enum Type {
+    UNKNOWN, INTROSPECTION, COLLECTION, ENTRY, ENTRY_EDIT, MEDIA, MEDIA_EDIT
+  };
+  
+  protected Type resourceType = Type.UNKNOWN;
+  
+  public BaseRequestHandler() {}
+  
+  public ResponseContext invoke(
+    RequestContext requestContext)
+      throws AbderaServerException {
+    try {
+      ResponseContext response = createResponseContext();
+      checkExists(requestContext);
+      checkMethod(requestContext);
+      checkModified(requestContext);
+      checkRequest(requestContext);
+      checkCache(requestContext,response,getCacheKey());
+      internalInvoke(requestContext, response);
+      if (response != null)
+        return response;
+      else
+        return new NotFoundException();
+    } catch (AbderaServerException ase) {
+      throw ase;
+    } catch (Throwable t) {
+      String message = t.getMessage();
+      if (message == null || message.length() == 0)
+        message = "Unknown Server Exception";
+      throw new AbderaServerException(500,message);
+    }
+  }
+
+  protected abstract ResponseContext createResponseContext();
+  
+  /**
+   * Returns this handlers cache (if any)
+   */
+  protected abstract Cache getCache();
+  
+  /**
+   * Return a cache key for this request
+   */
+  protected abstract String getCacheKey();
+  
+  protected abstract boolean useCache();
+  
+  protected CacheEntry.CacheDisposition checkCache(
+    RequestContext requestContext,
+    ResponseContext responseContext, 
+    String cacheKey) {
+      if (useCache()) {
+        Cache cache = getCache();
+        if (cache != null) {
+          return cache.process(requestContext, responseContext, cacheKey);
+        }
+      } 
+      return CacheEntry.CacheDisposition.TRANSPARENT;
+  }
+  
+  /**
+   * Returns the type of the requested resource
+   */
+  protected abstract Type getResourceType(RequestContext requestContext);
+  
+  /**
+   * Check that the requested resource exists.  If not, the method
+   * MUST throw an appropriate ExistenceException (e.g. not found,
+   * gone, moved, etc)
+   */
+  protected void checkExists(RequestContext requestContext) throws ExistenceException{}
+  
+  /**
+   * Check the request method.  If the method is not supported, 
+   * a MethodNotAllowedException MUST be thrown, otherwise the 
+   * method should return with no exceptions
+   */
+  protected void checkMethod(RequestContext requestContext) throws MethodNotAllowedException {
+    String method = requestContext.getMethod();
+    String[] methods = getAllowedMethods(getResourceType(requestContext));
+    java.util.Arrays.sort(methods);
+    if (java.util.Arrays.binarySearch(methods, method) < 0)
+      notAllowed(requestContext);
+  }
+  
+  /**
+   * Check to see if the requested resource has been modified.  If not,
+   * a NotModifiedException MUST be thrown, otherwise the method
+   * should return with no exceptions
+   */
+  protected void checkModified(RequestContext requestContext) throws NotModifiedException {}
+  
+  /**
+   * Check to see if the request is valid. If not, throw an appropriate
+   * RequestException
+   */
+  protected void checkRequest(RequestContext requestContext) throws RequestException {}
+  
+  /**
+   * Handle the request
+   */
+  protected abstract ResponseContext internalInvoke(
+    RequestContext requestContext,
+    ResponseContext responseContext) 
+      throws AbderaServerException;
+  
+  /**
+   * Implementations should override this to specify customizations to the
+   * allowable methods on a particular type of resource
+   */
+  protected String[] getAllowedMethods(Type type) {
+    switch (type) {
+      case COLLECTION:    return new String[] { "GET", "POST" };
+      case ENTRY:         return new String[] { "GET" };
+      case ENTRY_EDIT:    return new String[] { "GET", "DELETE", "PUT" };
+      case INTROSPECTION: return new String[] { "GET" };
+      default:            return new String[] { "GET" };
+    }
+  }
+  
+  /**
+   * Utility method for reporting MethodNotAllowedExceptions properly
+   */
+  protected void notAllowed(RequestContext requestContext) throws MethodNotAllowedException {
+    MethodNotAllowedException notallowed = new MethodNotAllowedException();
+    notallowed.setAllow(getAllowedMethods(getResourceType(requestContext)));
+    throw notallowed;
+  }
+  
+  
+}



Mime
View raw message