public class SchemaBuilder extends Object
Constructor and Description |
---|
SchemaBuilder() |
Modifier and Type | Method and Description |
---|---|
protected static void |
buildDataDictionarySchemaValidationType(String ddAttributeName,
Collection typesSchemaLines,
Set<String> builtTypes)
Constructs new AttributeSchemaValidationBuilder for the given attribute name to build the type XML lines which are added to
the given collection
|
protected static void |
buildSchemaFile(File buildSchemFile,
String outSchemaFilePathName,
boolean useDataDictionaryValidation,
Collection typesSchemaLines,
String externalizableContentUrl,
Set<String> builtTypes,
boolean rebuildDDTypes)
Process a single schema file (setting validation and externalizable token) and outputs to static directory.
|
protected static void |
buildSchemaFiles(Collection buildSchemaFiles,
String staticDirectoryPath,
String buildDirectoryPath,
boolean useDataDictionaryValidation,
String externalizableContentUrl,
boolean rebuildDDTypes)
Iterates through build schema files processing validation place-holders and outputting to static directory.
|
protected static Collection |
finalizeDataDictionaryTypesSchema()
Builds footer XML lines for the data dictionary types include .
|
protected static Collection |
getBuildSchemaFiles(String buildDirectoryPath)
Returns Collection of File objects for all .xsd files found in given directory (including sub-directories)
|
protected static String |
getRelativeFilePathName(File file,
String parentPath)
Determines what the relative path of the given file is relative to the given parent path.
|
protected static Collection |
initalizeDataDictionaryTypesSchema()
Builds header XML lines for the data dictionary types include
|
protected static void |
logAndThrowException(String msg)
Helper method for logging an error and throwing a new RuntimeException
|
static void |
main(String[] args)
Performs schema build process.
|
protected static String |
processValidationPlaceholder(String validationPlaceholder,
String buildLine,
String fileName,
int lineCount,
boolean useDataDictionaryValidation,
Collection typesSchemaLines,
Set<String> builtTypes,
boolean rebuildDDTypes)
Performs logic to processes a validation place-holder for a line.
|
public SchemaBuilder()
public static void main(String[] args)
Performs schema build process. Build directory path containing the schema files, static directory that schema files will be outputted to, and flag for whether to use data dictionary validation all must given as arguments. Schema files in build directory should contain place-holders for which the validation will be substituted. The place-holder begin symbol is ${, and the end symbol is }. Then the place-holder should contain two parts, first the xsd type to use if data dictionary validation is not on. The second is the data dictionary entry (businessObjectEntry.attributeName) prefixed with 'dd:' that will be pulled for dd validation. The parts should be separated with a comma. Any type values without a place-holder will not be modified. Program also fills in externalizable.static.content.url place-holder. Value to set should be passed as the fourth program argument
args
- protected static Collection getBuildSchemaFiles(String buildDirectoryPath)
buildDirectoryPath
- Directory to look for schema filesprotected static void buildSchemaFiles(Collection buildSchemaFiles, String staticDirectoryPath, String buildDirectoryPath, boolean useDataDictionaryValidation, String externalizableContentUrl, boolean rebuildDDTypes) throws IOException
buildSchemaFiles
- collection of File objects for build schema filesstaticDirectoryPath
- path that processed schema files will be written tobuildDirectoryPath
- path of build schema filesuseDataDictionaryValidation
- indicates whether data dictionary validation should be used, if false the general xsd
datatype in the place-holder will be usedexternalizableContentUrl
- URL to set for externalizable.static.content.url tokenIOException
- thrown for any read/write errors encounteredprotected static void buildSchemaFile(File buildSchemFile, String outSchemaFilePathName, boolean useDataDictionaryValidation, Collection typesSchemaLines, String externalizableContentUrl, Set<String> builtTypes, boolean rebuildDDTypes) throws IOException
buildSchemFile
- build schema file that should be processedoutSchemaFilePathName
- full file path name for the outputted schemauseDataDictionaryValidation
- indicates whether data dictionary validation should be used, if false the general xsd
datatype in the place-holder will be usedtypesSchemaLines
- collection of type XML lines to add to for any new typesexternalizableContentUrl
- URL to set for externalizable.static.content.url tokenbuiltTypes
- - Set of attribute names for which a schema validation type has been builtIOException
- thrown for any read/write errors encounteredprotected static String processValidationPlaceholder(String validationPlaceholder, String buildLine, String fileName, int lineCount, boolean useDataDictionaryValidation, Collection typesSchemaLines, Set<String> builtTypes, boolean rebuildDDTypes)
ex. type="${xsd:token,dd:Chart.chartOfAccountsCode}" with useDataDictionaryValidation=false becomes type="xsd:token" type="${xsd:token,dd:Chart.chartOfAccountsCode}" with useDataDictionaryValidation=true becomes type="dd:Chart.chartOfAccountsCode" and XML lines created for dd Types file
validationPlaceholder
- the parsed place-holder contentsbuildLine
- the complete line being readfileName
- the name for the file being processedlineCount
- count for the line being readuseDataDictionaryValidation
- indicates whether data dictionary validation should be used, if false the general xsd
datatype in the place-holder will be usedtypesSchemaLines
- collection of type XML lines to add to for any new typesbuiltTypes
- - Set of attribute names for which a schema validation type has been builtprotected static void buildDataDictionarySchemaValidationType(String ddAttributeName, Collection typesSchemaLines, Set<String> builtTypes)
ddAttributeName
- attribute entry name (business object class and attribute name) with dd: namespace prefixtypesSchemaLines
- collection of type XML lines to add to for any new typesbuiltTypes
- - Set of attribute names for which a schema validation type has been builtAttributeSchemaValidationBuilder
protected static Collection initalizeDataDictionaryTypesSchema()
protected static Collection finalizeDataDictionaryTypesSchema()
protected static String getRelativeFilePathName(File file, String parentPath)
eg. File path - /build/project/xsd/gl/collector.xsd, Parent Path - /build/project/xsd returns gl/collector.xsd
file
- File for which we want to find the relative pathparentPath
- Path to parent directoryprotected static void logAndThrowException(String msg)
msg
- message for logging and exceptionCopyright © 2004–2015 The Kuali Foundation. All rights reserved.