jaxg 0.1dev

org.xml.graphics
Class XGProcessorFactory

java.lang.Object
  extended by org.xml.graphics.XGProcessorFactory
Direct Known Subclasses:
XGProcessorFactoryProxy

public abstract class XGProcessorFactory
extends java.lang.Object

An XGProcessorFactory can be used to instantiate new XGProcessor or XGProcessorHandler instances.

Author:
Jeremias Maerki

Constructor Summary
protected XGProcessorFactory()
           
 
Method Summary
abstract  java.lang.Object getAttribute(java.lang.String name)
          Allows the user to retrieve specific attributes on the underlying implementation.
abstract  boolean getFeature(java.lang.String name)
          Look up the value of a feature.
static XGProcessorFactory newInstance()
          Obtain a new instance of a XGProcessorFactory.
static XGProcessorFactory newInstance(java.io.File packageFile)
          Obtain an XGProcessorFactory by specifying a JAXG deployment package.
static XGProcessorFactory newInstance(java.lang.String packageFile)
          Obtain an XGProcessorFactory by specifying a JAXG deployment package.
static XGProcessorFactory newInstance(java.net.URL packageFile)
          Obtain an XGProcessorFactory by specifying an XML file describing a JAXG deployment package that contains all the necessary libraries.
abstract  XGProcessor newXGProcessor()
          Creates a new XGProcessor instance.
abstract  XGProcessorHandler newXGProcessorHandler()
          Create a new XGProcessorHandler instance.
abstract  void setAttribute(java.lang.String name, java.lang.Object value)
          Allows the user to set specific attributes on the underlying implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XGProcessorFactory

protected XGProcessorFactory()
Method Detail

newXGProcessor

public abstract XGProcessor newXGProcessor()
                                    throws XGException
Creates a new XGProcessor instance.

Returns:
an XGProcessor
Throws:
XGException - if the XGProcessor cannot be instantiated

newXGProcessorHandler

public abstract XGProcessorHandler newXGProcessorHandler()
                                                  throws XGException
Create a new XGProcessorHandler instance.

Returns:
an XGProcessorHandler
Throws:
XGException - if the XGProcessor cannot be instantiated

getFeature

public abstract boolean getFeature(java.lang.String name)

Look up the value of a feature.

The feature name is any absolute URI.

Parameters:
name - The feature name, which is an absolute URI.
Returns:
The current state of the feature (true or false).

setAttribute

public abstract void setAttribute(java.lang.String name,
                                  java.lang.Object value)
                           throws java.lang.IllegalArgumentException
Allows the user to set specific attributes on the underlying implementation. An attribute in this context is defined to be an option that the implementation provides.

Parameters:
name - The name of the attribute.
value - The value of the attribute.
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

getAttribute

public abstract java.lang.Object getAttribute(java.lang.String name)
                                       throws java.lang.IllegalArgumentException
Allows the user to retrieve specific attributes on the underlying implementation.

Parameters:
name - The name of the attribute.
Returns:
value The value of the attribute.
Throws:
java.lang.IllegalArgumentException - thrown if the underlying implementation doesn't recognize the attribute.

newInstance

public static XGProcessorFactory newInstance()
Obtain a new instance of a XGProcessorFactory. This static method creates a new factory instance This method uses the following ordered lookup procedure to determine the XGProcessorFactory implementation class to load: Once an application has obtained a reference to a XGProcessorFactory it can use the factory to configure and obtain XGProcessor instances.

Returns:
new XGProcessorFactory instance

newInstance

public static XGProcessorFactory newInstance(java.net.URL packageFile)
                                      throws java.io.IOException

Obtain an XGProcessorFactory by specifying an XML file describing a JAXG deployment package that contains all the necessary libraries. The XGProcessorFactoryProxy is used to create a ClassLoader for this package. Like this you can dynamically load and use different JAXG processor implementations in the same VM.

This is what the package format looks like:

 <package main-class="[classname of the factory implementation]">
   <jar>[URL to a JAR file]</jar>
   <jar>...</jar>
 </package>
 

An example:

 <package main-class="org.maerki.jaxg.fop.branch.FopBranchXGProcessorFactory">
   <jar>lib/jaxg-ref-impl.jar</jar>
   <jar>lib/fop.jar</jar>
   <jar>lib/batik.jar</jar>
   <jar>lib/avalon-framework-4.2.0.jar</jar>
 </package>
 

Relative paths are allowed. The URL of the package file will serve as base URL. To use an implementation deployed on a webserver you would do this:

 String location = "http://localhost/fowebservice/fop-branch/package.xml"
 XGProcessorFactory factory = XGProcessorFactoryProxy.newInstance(location);
 XGProcessor fop = factory.newXGProcessor();
 [..]
 

Parameters:
packageFile - the deployment package file to use
Returns:
new XGProcessorFactory instance
Throws:
java.io.IOException - if an error occurs while loading the package file

newInstance

public static XGProcessorFactory newInstance(java.io.File packageFile)
                                      throws java.io.IOException

Obtain an XGProcessorFactory by specifying a JAXG deployment package.

Parameters:
packageFile - the deployment package file to use
Returns:
new XGProcessorFactory instance
Throws:
java.io.FileNotFoundException - if an error occurs while loading the package file
java.io.IOException
See Also:
newInstance(java.net.URL)

newInstance

public static XGProcessorFactory newInstance(java.lang.String packageFile)
                                      throws java.io.IOException

Obtain an XGProcessorFactory by specifying a JAXG deployment package.

Parameters:
packageFile - the deployment package file to use (URL string)
Returns:
new XGProcessorFactory instance
Throws:
java.io.FileNotFoundException - if an error occurs while loading the package file
java.io.IOException
See Also:
newInstance(java.net.URL)

jaxg 0.1dev

Copyright © 2004-2005 Jeremias Märki. All rights reserved.