|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.mojo.jaxb2.helpers.SchemagenHelper
public final class SchemagenHelper
Utility class holding algorithms used by the AbstractSchemagenMojo and decendents.
| Constructor Summary | |
|---|---|
SchemagenHelper()
|
|
| Method Summary | |
|---|---|
static Map<String,SimpleNamespaceResolver> |
getFileNameToResolverMap(File outputDirectory)
Acquires a map relating generated schema filename to its SimpleNamespaceResolver. |
protected static String |
getHumanReadableXml(Node node)
Converts the provided DOM Node to a pretty-printed XML-formatted string. |
static Document |
parseXmlStream(Reader xmlStream)
Parses the provided InputStream to create a dom Document. |
static void |
process(Node node,
boolean recurseToChildren,
NodeProcessor visitor)
Drives the supplied visitor to process the provided Node and all its children, should the recurseToChildren flag be set to true. |
static void |
renameGeneratedSchemaFiles(Map<String,SimpleNamespaceResolver> resolverMap,
List<TransformSchema> configuredTransformSchemas,
org.apache.maven.plugin.logging.Log mavenLog,
File schemaDirectory)
Updates all schemaLocation attributes within the generated schema files to match the 'file' properties within the Schemas read from the plugin configuration. |
static void |
replaceNamespacePrefixes(Map<String,SimpleNamespaceResolver> resolverMap,
List<TransformSchema> configuredTransformSchemas,
org.apache.maven.plugin.logging.Log mavenLog,
File schemaDirectory)
Replaces all namespaces within generated schema files, as instructed by the configured Schema instances. |
static void |
validateSchemasInPluginConfiguration(List<TransformSchema> configuredTransformSchemas)
Validates that the list of Schemas provided within the configuration all contain unique values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SchemagenHelper()
| Method Detail |
|---|
public static Map<String,SimpleNamespaceResolver> getFileNameToResolverMap(File outputDirectory)
throws org.apache.maven.plugin.MojoExecutionException
outputDirectory - The output directory of the generated schema files.
org.apache.maven.plugin.MojoExecutionException - if two generated schema files used the same namespace URI.
public static void validateSchemasInPluginConfiguration(List<TransformSchema> configuredTransformSchemas)
throws org.apache.maven.plugin.MojoExecutionException
configuredTransformSchemas - The List of configuration schemas provided to this mojo.
org.apache.maven.plugin.MojoExecutionException - if any two configuredSchemas instances contain duplicate values for any of the
properties uri, prefix or file. Also throws a MojoExecutionException if the uri of any Schema is null
or empty, or if none of the 'file' and 'prefix' properties are given within any of the
configuredSchema instances.
public static void replaceNamespacePrefixes(Map<String,SimpleNamespaceResolver> resolverMap,
List<TransformSchema> configuredTransformSchemas,
org.apache.maven.plugin.logging.Log mavenLog,
File schemaDirectory)
throws org.apache.maven.plugin.MojoExecutionException
resolverMap - The map relating generated schema file name to SimpleNamespaceResolver instances.configuredTransformSchemas - The Schema instances read from the configuration of this plugin.mavenLog - The active Log.schemaDirectory - The directory where all generated schema files reside.
org.apache.maven.plugin.MojoExecutionException - If the namespace replacement could not be done.
public static void renameGeneratedSchemaFiles(Map<String,SimpleNamespaceResolver> resolverMap,
List<TransformSchema> configuredTransformSchemas,
org.apache.maven.plugin.logging.Log mavenLog,
File schemaDirectory)
resolverMap - The map relating generated schema file name to SimpleNamespaceResolver instances.configuredTransformSchemas - The Schema instances read from the configuration of this plugin.mavenLog - The active Log.schemaDirectory - The directory where all generated schema files reside.
public static void process(Node node,
boolean recurseToChildren,
NodeProcessor visitor)
true. All attributes of the current node are processed before recursing to children (i.e.
breadth first recursion).
node - The Node to process.recurseToChildren - if true, processes all children of the supplied node recursively.visitor - The NodeProcessor instance which should process the nodes.public static Document parseXmlStream(Reader xmlStream)
xmlStream - An InputStream connected to an XML document.
protected static String getHumanReadableXml(Node node)
node - The Node whose children should be converted to a String.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||