org.inria.ns.reflex.xml.provider.svg
Class BatikSerializer

java.lang.Object
  extended by org.inria.ns.reflex.xml.provider.svg.BatikSerializer
All Implemented Interfaces:
Configurable, Serializer
Direct Known Subclasses:
PDFSerializer, PSSerializer

public class BatikSerializer
extends Object
implements Serializer

A bridge with Batik.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Configurable
Configurable.Impl
 
Field Summary
static String XMLNS_BATIK
           
 
Constructor Summary
BatikSerializer(org.apache.batik.transcoder.Transcoder transcoder)
           
 
Method Summary
 boolean acceptAttribute(QName name)
          Indicates whether this serializer accept an attribute or not.
 PipedOutputStream connect(XMLFilterImpl input, StreamResult outputStream)
          Connect a SAX input to this serializer.
 boolean containsAttribute(Object key)
          Returns true if the attributes set contains a mapping for the specified key.
 Object getAttribute(Object key)
          Returns an attribute that has been defined for the processor.
 Map getAttributes()
          Returns the set of attributes defined.
static BatikSerializer getBatikSerializer(String mimeType)
          Get a specific Batik serializer (SVG to PDF, SVG to PS, etc), or null.
 void mergeAttributes(Map attributes)
          Merges 2 collections.
 void serialize(org.apache.batik.transcoder.TranscoderInput input, StreamResult xmlResult)
           
 void serialize(URIResolver uriResolver, Source xmlSource, StreamResult xmlResult)
          Serialize an (SVG) XML source to a byte stream.
 void setAttribute(Object key, Object data)
          Defines an attribute.
 void setAttributes(Map attributes)
          Defines an attributes set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_BATIK

public static String XMLNS_BATIK
Constructor Detail

BatikSerializer

public BatikSerializer(org.apache.batik.transcoder.Transcoder transcoder)
Method Detail

getBatikSerializer

public static BatikSerializer getBatikSerializer(String mimeType)
                                          throws InstantiationException,
                                                 IllegalAccessException,
                                                 ClassNotFoundException
Get a specific Batik serializer (SVG to PDF, SVG to PS, etc), or null.

Parameters:
mimeType - The MIME type of the expected output.
Returns:
The Batik serializer, according to the MIME type, or null if not supported.
Throws:
ClassNotFoundException - When the class name of the implementation is misspelled or is missing in the classpath.
IllegalAccessException - When the class can't be accessed.
InstantiationException - When the class can't be instanciated.

serialize

public void serialize(URIResolver uriResolver,
                      Source xmlSource,
                      StreamResult xmlResult)
               throws SerializeException
Serialize an (SVG) XML source to a byte stream.

Specified by:
serialize in interface Serializer
Parameters:
uriResolver - The URI resolver that can retrieve resources.
xmlSource - The XML source to serialize.
xmlResult - The stream result.
Throws:
SerializeException

serialize

public void serialize(org.apache.batik.transcoder.TranscoderInput input,
                      StreamResult xmlResult)
               throws SerializeException
Throws:
SerializeException

containsAttribute

public boolean containsAttributeObject key,
  )
Configurable
Returns true if the attributes set contains a mapping for the specified key.

Specified by:
containsAttribute in interface Configurable
Parameters:
key - The key or ociated to the ot.html
Returns:
true if the attributes set contains a mapping for the specified key.

getAttribute

public REF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object&nbs getAttributeObject key,
  )
Configurable
Returns an attribute that has been defined for the processor. If none correspond to the key, null is returned.

Specified by:
getAttribute in interface Configurable
Parameters:
key - The key or ociated to the ot.html
Returns:
The ot.htm defined as an attribute.

getAttributes

public REF="http://java.sun.com/j2se/1.4.2/docs/api/java/langutil/Map.html?is-external=true" title="class or interface in java.util">Map getAttributes()
Configurable
Returns the set of attributes defined.

Specified by:
getAttributes in interface Configurable
Returns:
The set of attributes defined.

acceptAttribute

public boolean acceptAttribute(QName name)
Serializer
Indicates whether this serializer accept an attribute or not.

Specified by:
acceptAttribute in interface Serializer
Parameters:
name - The name of the attribute.
Returns:
true if the attribute can be used to configure this serializer, false otherwise.

mergeAttributes

public void mergeAttributes(Map attributes)
Configurable
Merges 2 collections.

Specified by:
mergeAttributes in interface Configurable
Parameters:
attributes - The attributes set to merge with.

setAttributes

public void setAttributes(Map attributes)
Configurable
Defines an attributes set.

Specified by:
setAttributes in interface Configurable
Parameters:
attributes - The attributes set to define.

setAttribute

public void setAttributeObject key,
  ,
                         REF="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object key,data)
Configurable
Defines an attribute.

Specified by:
setAttribute in interface Configurable
Parameters:
key - The key or ociated to the ot.html
data - The ot.htm to define as an attribute.

connect

public REF="http://java.sun.com/j2se/1.4.2/docs/api/java/langio/PipedOutputStream.html?is-external=true" title="class or interface in java.io">PipedOutputStream connect(XMLFilterImpl input,
                                 REF="http://java.sun.com/j2se/1.4.2/docs/api/java/lanx/xml/transform/stream/StreamResult.html?is-external=true" title="class or interface in javax.xml.transform.stream">StreamResult outputStream)
                          throws TransformerConfigurationException,
                                 SerializeException
Connect a SAX input to this serializer.

Parameters:
input - The SAX inputl
outputStream - Wrap the output stream of this serializer.
Returns:
The pipe used to connect this serializer to the output.
Throws:
TransformerConfigurationException
SerializeException