public class Refactory
extends java.lang.Object
public
access, they are intended
for use only by the JiBX developers and may change from one release to the next. To make use of this class from your
own code, call the main(String[])
method with an appropriate argument list.Modifier and Type | Class and Description |
---|---|
private static class |
Refactory.SchemaNameFilter
File name pattern matcher.
|
Modifier and Type | Field and Description |
---|---|
private static long |
BLOCK_NAME_INHERIT_MASK
Mask for schema elements which block name inheritance downward.
|
private static QName[] |
DEFAULT_REPLACEMENTS
Default type replacements applied.
|
private BindingOrganizer |
m_bindingDirectory
Directory for constructed bindings.
|
private java.util.ArrayList |
m_definitions
Definitions to be generated (may be global schema definitions, or reused nested components with classes).
|
private SchemasetCustom |
m_global
Code generation customizations.
|
private java.io.File |
m_schemaDir
Root directory for schemas.
|
private java.net.URL |
m_schemaRoot
Root URL for schemas.
|
private java.io.File |
m_targetDir
Target directory for code generation.
|
private ValidationContext |
m_validationContext
Context for loading and processing schemas.
|
private static org.apache.log4j.Logger |
s_logger
Logger for class.
|
private static long |
TYPE_DEFINE_MASK
Mask for schema elements which define a type.
|
private static long |
TYPE_DERIVE_MASK
Mask for schema elements which derive from a type.
|
Constructor and Description |
---|
Refactory(RefactoryCommandLine parms)
Constructor.
|
Refactory(SchemasetCustom custom,
ValidationContext vctx)
Constructor used by tests.
|
Modifier and Type | Method and Description |
---|---|
private static void |
addCustomizedSchemas(java.net.URL base,
java.io.File dir,
SchemasetCustom custom,
InsertionOrderedSet fileset)
Add the schemas specified by customizations to the set to be loaded.
|
void |
applyAndNormalize()
Apply extensions and normalize all schemas.
|
boolean |
customizeSchemas()
Validate and apply customizations to loaded schemas.
|
private SchemasetCustom |
findSchemaset(SchemaElement schema,
SchemasetCustom custom)
Find the most specific schemaset owning a schema.
|
private SchemaElement[] |
load(java.util.List list)
Load and validate the root schema list.
|
static void |
main(java.lang.String[] args)
Run the schema refactoring using command line parameters.
|
private boolean |
processExtensions()
Process substitutions and deletions defined by extensions.
|
void |
pruneDefinitions()
Processes the schemas to remove unused global definitions.
|
private static boolean |
reportProblems(ValidationContext vctx)
Report problems using console output.
|
void |
validateSchemas(SchemaElement[] schemas)
Validate the schemas.
|
private void |
writeSchemas(java.io.File destdir)
Write schema definitions to file system.
|
private static final org.apache.log4j.Logger s_logger
private static final QName[] DEFAULT_REPLACEMENTS
private static final long TYPE_DERIVE_MASK
private static final long TYPE_DEFINE_MASK
private static final long BLOCK_NAME_INHERIT_MASK
private final SchemasetCustom m_global
private final java.net.URL m_schemaRoot
private final java.io.File m_schemaDir
private final java.io.File m_targetDir
private final ValidationContext m_validationContext
private java.util.ArrayList m_definitions
private BindingOrganizer m_bindingDirectory
public Refactory(RefactoryCommandLine parms)
parms
- command line parameterspublic Refactory(SchemasetCustom custom, ValidationContext vctx)
custom
- vctx
- private SchemasetCustom findSchemaset(SchemaElement schema, SchemasetCustom custom)
schema
- custom
- schema set customizationnull
if nonepublic void validateSchemas(SchemaElement[] schemas)
schemas
- schemas to be validatedprivate SchemaElement[] load(java.util.List list) throws JiBXException, java.io.IOException
list
- resolvers for schemas to be loadedJiBXException
- on unrecoverable error in schemasjava.io.IOException
- on error reading schemaspublic boolean customizeSchemas()
true
if successful, false
if errorprivate boolean processExtensions()
true
if any changes to the schemas, false
if notpublic void applyAndNormalize()
public void pruneDefinitions()
private void writeSchemas(java.io.File destdir) throws JiBXException, java.io.IOException
destdir
- destination directoryJiBXException
- on error in marshallingjava.io.IOException
- on error writingprivate static boolean reportProblems(ValidationContext vctx)
vctx
- true
if one or more errors, false
if notprivate static void addCustomizedSchemas(java.net.URL base, java.io.File dir, SchemasetCustom custom, InsertionOrderedSet fileset) throws java.net.MalformedURLException
base
- root URL for schemasdir
- root directory for schemascustom
- schema set customizationfileset
- set of schema files to be loadedjava.net.MalformedURLException
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- java.lang.Exception