org.foray.graphic
Class GraphicServer4a

java.lang.Object
  extended by org.foray.graphic.GraphicServer4a
All Implemented Interfaces:
org.axsl.graphic.GraphicServer

public class GraphicServer4a
extends Object
implements org.axsl.graphic.GraphicServer

create Graphic objects (with a configuration file - not yet implemented).

Author:
Eric SCHAEFFER

Constructor Summary
GraphicServer4a(org.apache.commons.logging.Log logger)
          Constructor.
 
Method Summary
 org.w3c.dom.svg.SVGDocument domToSvgDom(Document dom)
          Converts a generic DOM Document instance that contains a MathML document into an SVGDocument.
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 GraphicOutputFactory getOutputFactory(String mimeType)
          Returns the output factory for a given mime type.
 String getSVGParserClassName()
          Returns the name of the class that should be used to parse SVG graphics.
 boolean graphicOutputFactoryAvailable(String mimeType)
          Reports on the availability of GraphicOutputFactory instances by mime-type.
 Graphic4a makeGraphic(String href, URL[] baseURLs, boolean cachingThisGraphic)
           
 org.w3c.dom.mathml.MathMLDocument makeMathDocument()
           
 org.axsl.graphic.MathGraphic makeMathGraphic(org.w3c.dom.mathml.MathMLDocument mathDocument)
           
 org.w3c.dom.svg.SVGDocument makeSvgDocument()
           
 SVGGraphic makeSvgGraphic(org.w3c.dom.svg.SVGDocument svgDocument)
           
 boolean registerFactory(GraphicFactory factory)
          Registers a third-party GraphicFactory implementation with the Server, so that it can be included in the list of factories that are tried as a Graphic4a is created.
 void registerGraphicOutputFactory(GraphicOutputFactory factory)
          Registers a GraphicOutputFactory for use by this server.
 void resetCache()
          Clear the image cache.
 void writeSvgDocument(org.w3c.dom.svg.SVGDocument svgDocument, OutputStream outputStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicServer4a

public GraphicServer4a(org.apache.commons.logging.Log logger)
Constructor.

Parameters:
logger - The logger.
Method Detail

registerFactory

public boolean registerFactory(GraphicFactory factory)
Registers a third-party GraphicFactory implementation with the Server, so that it can be included in the list of factories that are tried as a Graphic4a is created.

Parameters:
factory - The factory that should be added to the list of factories.
Returns:
True if the factory was successfully registered, false if not.

makeGraphic

public Graphic4a makeGraphic(String href,
                             URL[] baseURLs,
                             boolean cachingThisGraphic)
                      throws org.axsl.graphic.GraphicException
Specified by:
makeGraphic in interface org.axsl.graphic.GraphicServer
Throws:
org.axsl.graphic.GraphicException

makeSvgGraphic

public SVGGraphic makeSvgGraphic(org.w3c.dom.svg.SVGDocument svgDocument)
                          throws org.axsl.graphic.GraphicException
Specified by:
makeSvgGraphic in interface org.axsl.graphic.GraphicServer
Throws:
org.axsl.graphic.GraphicException

resetCache

public void resetCache()
Clear the image cache.


getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

getSVGParserClassName

public String getSVGParserClassName()
Returns the name of the class that should be used to parse SVG graphics.

Returns:
The name of the class that should be used to parse SVG graphics.

makeSvgDocument

public org.w3c.dom.svg.SVGDocument makeSvgDocument()
                                            throws org.axsl.graphic.GraphicException
Specified by:
makeSvgDocument in interface org.axsl.graphic.GraphicServer
Throws:
org.axsl.graphic.GraphicException

writeSvgDocument

public void writeSvgDocument(org.w3c.dom.svg.SVGDocument svgDocument,
                             OutputStream outputStream)
Specified by:
writeSvgDocument in interface org.axsl.graphic.GraphicServer

registerGraphicOutputFactory

public void registerGraphicOutputFactory(GraphicOutputFactory factory)
Registers a GraphicOutputFactory for use by this server. This method can be used both to support custom GraphicOutput types and to override standard types. Note that if a factory was previously registered for the mime-type of the factory now being registered, the new registration overrides the previous registration. If this behavior is not desired, check the return value of graphicOutputFactoryAvailable(String) before registering the new factory.

Parameters:
factory - The factory which should be registered.

getOutputFactory

public GraphicOutputFactory getOutputFactory(String mimeType)
Returns the output factory for a given mime type.

Parameters:
mimeType - The mime type for which an output factory is desired.
Returns:
The appropriate output factory, or null if none is registered for the mime type.

graphicOutputFactoryAvailable

public boolean graphicOutputFactoryAvailable(String mimeType)
Reports on the availability of GraphicOutputFactory instances by mime-type.

Parameters:
mimeType - The mime-type for which a factory is sought.
Returns:
True iff a factory has already been registered for the given mime-type.

makeMathDocument

public org.w3c.dom.mathml.MathMLDocument makeMathDocument()
                                                   throws org.axsl.graphic.GraphicException
Specified by:
makeMathDocument in interface org.axsl.graphic.GraphicServer
Throws:
org.axsl.graphic.GraphicException

makeMathGraphic

public org.axsl.graphic.MathGraphic makeMathGraphic(org.w3c.dom.mathml.MathMLDocument mathDocument)
                                             throws org.axsl.graphic.GraphicException
Specified by:
makeMathGraphic in interface org.axsl.graphic.GraphicServer
Throws:
org.axsl.graphic.GraphicException

domToSvgDom

public org.w3c.dom.svg.SVGDocument domToSvgDom(Document dom)
                                        throws org.axsl.graphic.GraphicException
Converts a generic DOM Document instance that contains a MathML document into an SVGDocument.

Parameters:
dom - A generic DOM Document instance that contains a MathML document.
Returns:
The SVGDocument containing an SVG representation of the MathML document.
Throws:
org.axsl.graphic.GraphicException - For errors during conversion.


Copyright © 2017. All rights reserved.