sk.baka.xml.gene
Class ExporterInfo

java.lang.Object
  extended by sk.baka.xml.gene.ExporterInfo
All Implemented Interfaces:
INamespaceAcceptor

public class ExporterInfo
extends Object
implements INamespaceAcceptor

Contains information about single exporter. Returned by the exporter factory. If the factory instance wants to store additional properties into this object (for example exporter class instance, etc) it may extend this class. Derived class should preserve immutability.

Object is equal to other exporter info object if and only if a) their factory classes are equal, b) their ids are equal.

Author:
Martin Vysny

Field Summary
 String displayableName
          The name of the exporter that can be displayed on a screen.
 IExporterFactory factory
          The factory that is able to produce this exporter.
 String id
          Unique identifier of this exporter.
 int priority
          A number between 0 and 100.
 String sourceNamespaceURI
          The namespace of the source document.
 
Constructor Summary
ExporterInfo(String id, String displayableName, EnumSet<SourceEnum> sourceTypes, String sourceNamespaceURI, Map<String,EnumSet<SourceEnum>> targets, int priority, IExporterFactory factory)
          Contains information about single exporter.
 
Method Summary
 boolean equals(Object obj)
           
 Set<String> getNamespaces()
          Set containing all namespaces that this acceptor accepts.
 INamespaceAcceptor getProducts()
          Set of all namespaces that this exporter may ever produce.
 EnumSet<SourceEnum> getSource(String namespace)
          Returns kinds of sources for this namespace.
 EnumSet<SourceEnum> getSourceTypes()
          Set of all types of sources that are readable by this exporter.
 int hashCode()
           
 ExporterInfo modifySourceNamespace(String sourceNamespaceURI, int priority)
          Returns a copy of this exporter info with modified source namespace and priority.
 IExporter newExporter()
          Produces new instance of this exporter.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceNamespaceURI

public final String sourceNamespaceURI
The namespace of the source document. Ignored when denoting wildcard exporter, must be null.


id

public final String id
Unique identifier of this exporter. Unique in context of a factory instance.


displayableName

public final String displayableName
The name of the exporter that can be displayed on a screen.


priority

public final int priority
A number between 0 and 100. Generally, exporter with higher priority is preferred. Priority is stated by the exporter factory and cannot be changed by user.


factory

public final IExporterFactory factory
The factory that is able to produce this exporter.

Constructor Detail

ExporterInfo

public ExporterInfo(String id,
                    String displayableName,
                    EnumSet<SourceEnum> sourceTypes,
                    String sourceNamespaceURI,
                    Map<String,EnumSet<SourceEnum>> targets,
                    int priority,
                    IExporterFactory factory)
Contains information about single exporter.

Parameters:
id - unique identifier of this exporter, in the context of given factory instance. It should provide short and accurate description of the exporter.
sourceTypes - type of Source object that this exporter processes.
sourceNamespaceURI - the namespace of the source document. Ignored when denoting wildcard exporter, may be null.
targets - set of all namespaces that this exporter may ever produce. It must not be empty. It should be able to produce DOM or SAX result type if this set contains more than one item.
displayableName - the name of the exporter that can be displayed on a screen.
priority - a number between 0 and 100. Generally, exporter with higher priority is preferred. 0 is a 'normal' priority.
factory - the factory that is able to produce this exporter.
Method Detail

modifySourceNamespace

public ExporterInfo modifySourceNamespace(String sourceNamespaceURI,
                                          int priority)
Returns a copy of this exporter info with modified source namespace and priority.

Parameters:
sourceNamespaceURI - the source namespace identifier. Cannot be changed if current sourceNamespaceURI is not null (current info does not denote a wildcard exporter).
priority - the priority to set.
Returns:
new info instance equal to this instance.

getSourceTypes

public final EnumSet<SourceEnum> getSourceTypes()
Set of all types of sources that are readable by this exporter. Exporter is not required to support all kinds of sources - export engine can automatically convert between some source kinds. However, the Exporter should support all kinds of sources for which it is optimized.

Returns:
a copy of sourcetypes enum.

getProducts

public final INamespaceAcceptor getProducts()
Set of all namespaces that this exporter may ever produce. It must not be empty. Each namespace has a result kind in which the namespace will be produced. Exporter is not required to support all kinds of results - export engine can automatically convert between some result kinds. However, the Exporter should support all kinds of results for which it is optimized.

Returns:
the acceptor, never null.

toString

public String toString()
Overrides:
toString in class Object

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

newExporter

public final IExporter newExporter()
                            throws ExportException,
                                   IOException
Produces new instance of this exporter.

Returns:
new instance of this exporter.
Throws:
ExportException - if exporter construction fails.
IOException - if i/o error occurs.

getSource

public EnumSet<SourceEnum> getSource(String namespace)
Description copied from interface: INamespaceAcceptor
Returns kinds of sources for this namespace.

Specified by:
getSource in interface INamespaceAcceptor
Parameters:
namespace - the namespace URI
Returns:
kinds of sources that this coordinator accepts as input for given namespace. null if namespace is not accepted by the acceptor.

getNamespaces

public Set<String> getNamespaces()
Description copied from interface: INamespaceAcceptor
Set containing all namespaces that this acceptor accepts.

Specified by:
getNamespaces in interface INamespaceAcceptor
Returns:
set of string namespace URI


Copyright © 2006 Martin Vysny - baka. All Rights Reserved.