cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1452275 - in /cocoon/branches/BRANCH_2_1_X: lib/ lib/optional/ misc/notes/ src/blocks/fop/java/org/apache/cocoon/components/ src/blocks/fop/java/org/apache/cocoon/components/renderer/
Date Mon, 04 Mar 2013 12:28:01 GMT
Author: ilgrosso
Date: Mon Mar  4 12:28:01 2013
New Revision: 1452275

URL: http://svn.apache.org/r1452275
Log:
[COCOON-2295] Back to FOP 1.0

Added:
    cocoon/branches/BRANCH_2_1_X/lib/optional/fop-1.0.jar   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/
    cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/
    cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
  (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
  (with props)
Removed:
    cocoon/branches/BRANCH_2_1_X/lib/optional/fop-1.1.jar
Modified:
    cocoon/branches/BRANCH_2_1_X/lib/jars.xml
    cocoon/branches/BRANCH_2_1_X/misc/notes/review-jars.txt

Modified: cocoon/branches/BRANCH_2_1_X/lib/jars.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/lib/jars.xml?rev=1452275&r1=1452274&r2=1452275&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/lib/jars.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/lib/jars.xml Mon Mar  4 12:28:01 2013
@@ -447,7 +447,7 @@
       the XSL recommendation and then turns it into a PDF document.
     </description>
     <used-by>FOP serializer (fop block)</used-by>
-    <lib>optional/fop-1.1.jar</lib>
+    <lib>optional/fop-1.0.jar</lib>
     <homepage>http://xml.apache.org/fop/</homepage>
   </file>
 

Added: cocoon/branches/BRANCH_2_1_X/lib/optional/fop-1.0.jar
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/lib/optional/fop-1.0.jar?rev=1452275&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/branches/BRANCH_2_1_X/lib/optional/fop-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/jar

Modified: cocoon/branches/BRANCH_2_1_X/misc/notes/review-jars.txt
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/misc/notes/review-jars.txt?rev=1452275&r1=1452274&r2=1452275&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/misc/notes/review-jars.txt (original)
+++ cocoon/branches/BRANCH_2_1_X/misc/notes/review-jars.txt Mon Mar  4 12:28:01 2013
@@ -239,7 +239,7 @@ R: excalibur-datasource-2.1
 
 L: lib/optional/fop-0.95.jar
 F: C:
-R: fop-1.1 (J: 4)
+R: fop-1.0 (J: 4)
 http://xmlgraphics.apache.org/fop/
 U: Done.
 

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java?rev=1452275&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
Mon Mar  4 12:28:01 2013
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+package org.apache.cocoon.components.renderer;
+
+import org.apache.fop.render.Renderer;
+import org.apache.fop.render.pcl.PCLRenderer;
+import org.apache.fop.render.pdf.PDFRenderer;
+import org.apache.fop.render.ps.PSRenderer;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * An extendable FOP Renderer factory.
+ * When given a MIME type, find a Renderer which supports that MIME
+ * type. This factory is extendable as new <code>Renderer</code>s can
+ * be added at runtime.
+ * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
+ * @version CVS $Id$
+ */
+public class ExtendableRendererFactory implements RendererFactory {
+
+  protected final static Map renderers = new HashMap();
+
+  protected final static RendererFactory singleton = new ExtendableRendererFactory();
+
+  private ExtendableRendererFactory() {
+    // Add the default renderers which come with Apache FOP.
+    addRenderer("application/pdf", PDFRenderer.class);
+    addRenderer("application/postscript", PSRenderer.class);
+    addRenderer("application/vnd.hp-PCL", PCLRenderer.class);
+  }
+
+  /**
+   * Get a reference to this Renderer Factory.
+   */
+  public final static RendererFactory getRendererFactoryImplementation() {
+    return singleton;
+  }
+
+  /**
+   * Create a renderer for a specified MIME type.
+   * @param mimeType The MIME type of the destination format
+   * @return A suitable renderer, or <code>null</code> if one cannot be found
+   */
+  public Renderer createRenderer(String mimeType) {
+    Class rendererClass = (Class)renderers.get(mimeType);
+    if (rendererClass == null) {
+      return null;
+    } else {
+      try {
+        return (Renderer)rendererClass.newInstance();
+      } catch (Exception ex) {
+        return null;
+      }
+    }
+  }
+
+  /**
+   * Add a mapping from the specified MIME type to a renderer.
+   * Note: The renderer must have a no-argument constructor.
+   * @param mimeType The MIME type of the Renderer
+   * @param rendererClass The <code>Class</code> object for the Renderer.
+   */
+  public void addRenderer(String mimeType, Class rendererClass) {
+    renderers.put(mimeType, rendererClass);
+  }
+
+  /**
+   * Remove the mapping from a specified MIME type.
+   * @param mimeType The MIME type to remove from the mapping.
+   */
+  public void removeRenderer(String mimeType) {
+    renderers.remove(mimeType);
+  }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java?rev=1452275&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
Mon Mar  4 12:28:01 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ */
+package org.apache.cocoon.components.renderer;
+
+import org.apache.fop.render.Renderer;
+
+/**
+ * Apache FOP Renderer factory.
+ * When given a MIME type, find a Renderer which supports that MIME type.
+ * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
+ * @version CVS $Id$
+ */
+public interface RendererFactory {
+
+  /**
+   * Create a transcoder for a specified MIME type.
+   * @param mimeType The MIME type of the destination format
+   * @return A suitable renderer, or <code>null> if one cannot be found
+   */
+  Renderer createRenderer(String mimeType);
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/fop/java/org/apache/cocoon/components/renderer/RendererFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message