redora.generator
Class ModelProcessor

java.lang.Object
  extended by redora.generator.ModelProcessor

public class ModelProcessor
extends Object

Retrieves all available models from the file system in this project and generated all the sources and resources with the available templates. The maven plugin will use the ModelProcessor directly, so just add the maven plugin to your project's plugins.

Author:
Nanjing RedOrange (http://www.red-orange.cn)

Field Summary
static String APPLICATION_SCHEMA
          Schema file for checking if the application document is correct.
static String INCLUDE_SCHEMA
          Schema file for checking if the include document is correct.
static String MODEL_SCHEMA
          Schema file for checking if the model document is correct.
 
Constructor Summary
ModelProcessor(FileLocations where, String basePackage, String artifactId, String defaultLanguage)
           
 
Method Summary
 String dump()
           
 void dumpAllModelsToLocalFile()
           
 void dumpModelToLocalFile()
           
 void generate()
          Generate sources for project
 boolean schemaValidation(String schema, File testFile)
          Validate the xml file according to schema file MODEL_SCHEMA
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODEL_SCHEMA

public static final String MODEL_SCHEMA
Schema file for checking if the model document is correct.

See Also:
Constant Field Values

APPLICATION_SCHEMA

public static final String APPLICATION_SCHEMA
Schema file for checking if the application document is correct.

See Also:
Constant Field Values

INCLUDE_SCHEMA

public static final String INCLUDE_SCHEMA
Schema file for checking if the include document is correct.

See Also:
Constant Field Values
Constructor Detail

ModelProcessor

public ModelProcessor(@NotNull
                      FileLocations where,
                      @NotNull
                      String basePackage,
                      @NotNull
                      String artifactId,
                      @NotNull
                      String defaultLanguage)
               throws ModelGenerationException
Parameters:
where - (Mandatory)
basePackage - (Mandatory) From Maven pom, like 'com.company'
artifactId - (Mandatory) Project name, from maven pom
defaultLanguage - (Mandatory) From Maven pom, from there it defaults to 'en'.
Throws:
ModelGenerationException - Passing on
Method Detail

generate

public void generate()
              throws ModelGenerationException
Generate sources for project

Throws:
ModelGenerationException - The only exception you could get

schemaValidation

public boolean schemaValidation(@NotNull
                                String schema,
                                @NotNull
                                File testFile)
                         throws ModelGenerationException
Validate the xml file according to schema file MODEL_SCHEMA

Parameters:
schema - (Mandatory) Name of the schema file, like 'model.xsd'.
testFile - (Mandatory) File you want to validate
Returns:
True if the XML file does not match the XSD.
Throws:
ModelGenerationException - Wrapping IO and XML Exceptions

dump

@NotNull
public String dump()

dumpModelToLocalFile

public void dumpModelToLocalFile()
                          throws ModelGenerationException
Throws:
ModelGenerationException

dumpAllModelsToLocalFile

public void dumpAllModelsToLocalFile()
                              throws ModelGenerationException
Throws:
ModelGenerationException


Copyright © 2012 Nanjing RedOrange Co. ltd. All Rights Reserved.