sk.uniba.euromath.gene.exportgraph
Class ExportGraphBuilder

java.lang.Object
  extended by sk.uniba.euromath.gene.exportgraph.ExportGraphBuilder

public final class ExportGraphBuilder
extends Object

Builds the export graph due to specified requirements. Thread-safe.

Author:
Martin Vysny

Field Summary
 Set<String> forbidden
          Forbidden namespaces.
 Set<ExporterInfo> preferred
          Sets priority of this exporter to 200, regardless of previous priority.
 
Constructor Summary
ExportGraphBuilder()
          The constructor.
 
Method Summary
 ExportGraph newGraph(Collection<? extends String> sourceNamespaces, CoordinatorInfo info)
           For each namespace, a regular export path is constructed via newGraph(String, String).
 ExportGraph newGraph(Collection<? extends String> sourceNamespaces, String coordinatorId)
           For each namespace, a regular export path is constructed via newGraph(String, String).
 GraphNode newGraph(String sourceNamespace, EnumSet<ResultEnum> provides, INamespaceAcceptor requires)
           Produces a graph of exporters, that are able to process given namespace and return namespaces from given set.
 GraphNode newGraph(String sourceNamespace, EnumSet<ResultEnum> provides, Map<String,EnumSet<SourceEnum>> requires)
           Produces a graph of exporters, that are able to process given namespace and return namespaces from given set.
 GraphNode newGraph(String sourceNamespace, String coordinatorId)
           Produces a graph of exporters, that are able to process given namespace and return namespaces from given set.
 GraphNode newWildcardGraphNode(String sourceNamespace, CoordinatorInfo info)
          Constructs a new graph node, able to deliver given namespace to the coordinator using a wildcard exporter.
 void prefer(String sourceNamespace, String targetNamespace)
          Prefers all exporters that transforms source namespace to target namespace.
 void prefer(TransformationInfo info)
          Prefers all exporters contained in given transformation object.
 TransformGraph toTransformationInfo(ExportGraph graph, ExportHelper helper, String coordinatorId, IGraphEdgeSelector selector)
          For each graph node in given graph produces a transformation info.
 TransformationInfo toTransformationInfo(GraphNode node, ExportHelper c, CoordinatorInfo coordinatorInfo, IGraphEdgeSelector selector)
          Produces the transformation info instance.
 TransformationInfo toTransformationInfo(GraphNode node, ExportHelper c, EnumSet<ResultEnum> provides, INamespaceAcceptor requires, IGraphEdgeSelector selector)
          Produces the transformation info instance.
 TransformationInfo toTransformationInfo(GraphNode node, ExportHelper c, EnumSet<ResultEnum> provides, Map<String,EnumSet<SourceEnum>> requires, IGraphEdgeSelector selector)
          Produces the transformation info instance.
 TransformationInfo toTransformationInfo(GraphNode node, ExportHelper c, String coordinatorId, IGraphEdgeSelector selector)
          Produces the transformation info instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forbidden

public final Set<String> forbidden
Forbidden namespaces. They must not be present in the final graph.


preferred

public final Set<ExporterInfo> preferred
Sets priority of this exporter to 200, regardless of previous priority.

Constructor Detail

ExportGraphBuilder

public ExportGraphBuilder()
The constructor.

Method Detail

toTransformationInfo

public TransformationInfo toTransformationInfo(GraphNode node,
                                               ExportHelper c,
                                               EnumSet<ResultEnum> provides,
                                               Map<String,EnumSet<SourceEnum>> requires,
                                               IGraphEdgeSelector selector)
                                        throws ExportException
Produces the transformation info instance. When multiple choices can be taken then the first one is preferred. Priorities are ignored. If node does not have target node for some namespace then the namespace must be accepted by the coordinator.

Parameters:
node - a starting node
c - the exporter helper
provides - which kinds of input shall be provided to first exporter. If transforming from XMLAccess then it should be ResultEnum.DOM.
requires - which kinds of input is required from last exporters. Maps namespace URI to the types enum.
selector - may select from multiple edges oriented from given graph node. If null then GraphEdgeSelectors.getFirstOptionSelector() is used.
Returns:
the transformation info instance. May return null if document may be directly passed to the coordinator.
Throws:
ExportException - if exporter fails to initialize.

toTransformationInfo

public TransformationInfo toTransformationInfo(GraphNode node,
                                               ExportHelper c,
                                               String coordinatorId,
                                               IGraphEdgeSelector selector)
                                        throws ExportException
Produces the transformation info instance. When multiple choices can be taken then the first one is preferred. Priorities are ignored. If node does not have target node for some namespace then the namespace must be accepted by the coordinator.

Parameters:
node - a starting node
c - the exporter context
coordinatorId - the coordinator identifier.
selector - may select from multiple edges oriented from given graph node. If null then GraphEdgeSelectors.getFirstOptionSelector() is used.
Returns:
the transformation info instance. May return null if document may be directly passed to the coordinator.
Throws:
ExportException - if exporter fails to initialize.

toTransformationInfo

public TransformationInfo toTransformationInfo(GraphNode node,
                                               ExportHelper c,
                                               CoordinatorInfo coordinatorInfo,
                                               IGraphEdgeSelector selector)
                                        throws ExportException
Produces the transformation info instance. When multiple choices can be taken then the first one is preferred. Priorities are ignored. If node does not have target node for some namespace then the namespace must be accepted by the coordinator.

Parameters:
node - a starting node
c - the exporter context
coordinatorInfo - the coordinator info.
selector - may select from multiple edges oriented from given graph node. If null then GraphEdgeSelectors.getFirstOptionSelector() is used.
Returns:
the transformation info instance. May return null if document may be directly passed to the coordinator.
Throws:
ExportException - if exporter fails to initialize.

toTransformationInfo

public TransformGraph toTransformationInfo(ExportGraph graph,
                                           ExportHelper helper,
                                           String coordinatorId,
                                           IGraphEdgeSelector selector)
                                    throws ExportException
For each graph node in given graph produces a transformation info.

Parameters:
graph - the graph.
helper - exporter helper instance.
coordinatorId - coordinator identifier
selector - may select from multiple edges oriented from given graph node. If null then GraphEdgeSelectors.getFirstOptionSelector() is used.
Returns:
map that maps namespace string to the transformation info instances - results of toTransformationInfo(GraphNode, ExportHelper, String, IGraphEdgeSelector).
Throws:
ExportException - if exporter fails to initialize.

toTransformationInfo

public TransformationInfo toTransformationInfo(GraphNode node,
                                               ExportHelper c,
                                               EnumSet<ResultEnum> provides,
                                               INamespaceAcceptor requires,
                                               IGraphEdgeSelector selector)
                                        throws ExportException
Produces the transformation info instance. When multiple choices can be taken then the first one is preferred. Priorities are ignored. If node does not have target node for some namespace then the namespace must be accepted by the coordinator.

Parameters:
node - a starting node
c - the exporter context
provides - which kinds of input shall be provided to first exporter. If transforming from XMLAccess then it should be ResultEnum.DOM.
requires - which kinds of input is required from last exporters. Maps namespace URI to the types enum.
selector - may select from multiple edges oriented from given graph node. If null then GraphEdgeSelectors.getFirstOptionSelector() is used.
Returns:
the transformation info instance. May return null if document may be directly passed to the coordinator.
Throws:
ExportException - if exporter fails to initialize.

newGraph

public GraphNode newGraph(String sourceNamespace,
                          EnumSet<ResultEnum> provides,
                          Map<String,EnumSet<SourceEnum>> requires)

Produces a graph of exporters, that are able to process given namespace and return namespaces from given set. If two paths are found in some point then only the one with higher priority is kept (if they have the same priority then both are kept).

Parameters:
sourceNamespace - the source namespace of the document that'll be transformed.
provides - in which format the document is available.
requires - these namespaces is coordinator able to process.
Returns:
a graph of nodes, or null if such graph cannot be constructed

newGraph

public GraphNode newGraph(String sourceNamespace,
                          EnumSet<ResultEnum> provides,
                          INamespaceAcceptor requires)

Produces a graph of exporters, that are able to process given namespace and return namespaces from given set. If two paths are found in some point then only the one with higher priority is kept (if they have the same priority then both are kept).

Parameters:
sourceNamespace - the source namespace of the document that'll be transformed.
provides - in which format the document is available.
requires - these namespaces is coordinator able to process.
Returns:
a graph of nodes, or null if such graph cannot be constructed

newGraph

public GraphNode newGraph(String sourceNamespace,
                          String coordinatorId)

Produces a graph of exporters, that are able to process given namespace and return namespaces from given set. If two paths are found in some point then only the one with higher priority is kept (if they have the same priority then both are kept).

Parameters:
sourceNamespace - the source namespace of the document that'll be transformed.
coordinatorId - the coordinator that'll receive the export output.
Returns:
a graph of nodes, or null if such graph cannot be constructed

newGraph

public ExportGraph newGraph(Collection<? extends String> sourceNamespaces,
                            String coordinatorId)
                     throws ExportException

For each namespace, a regular export path is constructed via newGraph(String, String). If this fails, a wildcard exporter *->XSL-FO is used.

Parameters:
sourceNamespaces - the source namespaces of the document that'll be transformed.
coordinatorId - the coordinator that'll receive the export output.
Returns:
full export graph.
Throws:
ExportException - if construction of the wildcard exporter fails.

newGraph

public ExportGraph newGraph(Collection<? extends String> sourceNamespaces,
                            CoordinatorInfo info)
                     throws ExportException

For each namespace, a regular export path is constructed via newGraph(String, String). If this fails, a wildcard exporter *->XSL-FO is used.

Parameters:
sourceNamespaces - the source namespaces of the document that'll be transformed.
info - the coordinator info instance.
Returns:
full export graph.
Throws:
ExportException - if construction of the wildcard exporter fails.

newWildcardGraphNode

public GraphNode newWildcardGraphNode(String sourceNamespace,
                                      CoordinatorInfo info)
                               throws ExportException
Constructs a new graph node, able to deliver given namespace to the coordinator using a wildcard exporter.

Parameters:
sourceNamespace - the namespace to be delivered.
info - the coordinator info
Returns:
a source graph node, that has wizard exporter graph node attached to itself.
Throws:
ExportException - when coordinator is not able to handle XSL-FO input.

prefer

public void prefer(TransformationInfo info)
Prefers all exporters contained in given transformation object.

Parameters:
info - the exporter tree. All exporters in this tree are added to the preferred set.

prefer

public void prefer(String sourceNamespace,
                   String targetNamespace)
Prefers all exporters that transforms source namespace to target namespace.

Parameters:
sourceNamespace - the source namespace.
targetNamespace - the target namespace.


Copyright 2003-2003-2006 null. All Rights Reserved.