]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Hooking the ContentHandlerFactoryRegistry into the FopFactor.
authorJeremias Maerki <jeremias@apache.org>
Tue, 14 Feb 2006 09:11:27 +0000 (09:11 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 14 Feb 2006 09:11:27 +0000 (09:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_API_Finalization@377672 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/FopFactory.java
src/java/org/apache/fop/area/AreaTreeParser.java
src/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java

index 0196f4ecef3a2bddb85fbc0242eb37c357531027..1b1a9e3ff5bd9599364a3eabd095c4a881a5274c 100644 (file)
@@ -34,6 +34,7 @@ import org.apache.fop.fo.ElementMappingRegistry;
 import org.apache.fop.layoutmgr.LayoutManagerMaker;
 import org.apache.fop.render.RendererFactory;
 import org.apache.fop.render.XMLHandlerRegistry;
+import org.apache.fop.util.ContentHandlerFactoryRegistry;
 import org.xml.sax.SAXException;
 
 /**
@@ -61,6 +62,10 @@ public class FopFactory {
     
     /** The registry for ElementMapping instances */
     private ElementMappingRegistry elementMappingRegistry;
+
+    /** The registry for ContentHandlerFactory instance */ 
+    private ContentHandlerFactoryRegistry contentHandlerFactoryRegistry 
+                = new ContentHandlerFactoryRegistry();
     
     /** user configuration */
     private Configuration userConfig = null;
@@ -180,6 +185,11 @@ public class FopFactory {
         return this.elementMappingRegistry;
     }
 
+    /** @return the content handler factory registry */
+    public ContentHandlerFactoryRegistry getContentHandlerFactoryRegistry() {
+        return this.contentHandlerFactoryRegistry;
+    }
+
     /**
      * Add the element mapping with the given class name.
      * @param elementMapping the class name representing the element mapping.
index 0f2cd0a4314b3187ba3099bddcf623eaee7f5a2b..e81896a3e7ad87a3c7ff93b0131922cd45a5d703 100644 (file)
@@ -250,8 +250,9 @@ public class AreaTreeParser {
                         handled = false;
                     }
                 } else {
-                    ContentHandlerFactory factory 
-                            = ContentHandlerFactoryRegistry.getInstance().getFactory(uri);
+                    ContentHandlerFactoryRegistry registry
+                            = userAgent.getFactory().getContentHandlerFactoryRegistry();
+                    ContentHandlerFactory factory = registry.getFactory(uri);
                     if (factory != null) {
                         delegate = factory.createContentHandler();
                         delegateStack.push(qName);
index 68e215b455b6e090b77a0985b6b867b07b6ea1a6..5fd68fd2bc1b34481a31b97ff31add45af1d8227 100644 (file)
@@ -36,21 +36,9 @@ public class ContentHandlerFactoryRegistry {
     /** the logger */
     private static Log log = LogFactory.getLog(ContentHandlerFactoryRegistry.class);
     
-    private static ContentHandlerFactoryRegistry instance;
-    
     /** Map from namespace URIs to ContentHandlerFactories */
     private Map factories = new java.util.HashMap();
     
-    /**
-     * @return a singleton instance of the ContentHandlerFactoryRegistry.
-     */
-    public static ContentHandlerFactoryRegistry getInstance() {
-        if (instance == null) {
-            instance = new ContentHandlerFactoryRegistry();
-        }
-        return instance;
-    }
-    
     /**
      * Default constructor.
      */