|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javagen.agile.core.ioc.spring.SpringMain
public abstract class SpringMain
Loads XML configuration and executes code generation pipeline using Spring framework IoC BeanFactory.
This is an extremely flexible way to configure the code generator, avoiding a one-size-fits-all approach.
Your Main class should extended this class:
public class Main extends SpringMain {
public static void main(String[] args) {
SpringMain main = new SpringMain();
main.setArgs(args);
main.runPipeline();
}
}
This is the only Spring dependency in JavaGen Agile. If you don't like having to use Spring XML files to configure
the generator then by all means write a non-Spring Main and contribute your code for inclusion in the framework!
| Field Summary | |
|---|---|
protected org.springframework.beans.factory.BeanFactory |
beanFactory
|
protected String |
configFile
|
static String |
DEFAULT_CONFIG_FILE
|
static String |
DEFAULT_CONFIGURER_BEAN_ID
|
static String |
DEFAULT_PIPELINE_BEAN_ID
|
static String |
DEFAULT_ROOT_BEAN_NAME_ID
|
static String |
DEFAULT_TEMPLATE_GENERATOR_BEAN_ID
|
protected Properties |
properties
|
protected String |
propertyFile
|
protected String |
startModelBeanId
|
| Constructor Summary | |
|---|---|
SpringMain()
|
|
| Method Summary | |
|---|---|
Object |
getBean(String beanId)
Uses underlying IoC container to access bean instance by ID. |
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory()
Load config and properties. |
String |
getConfigFile()
Any type of configuration can be achieved using XXXSpringConfig.xml including:
Pipeline components and order of execution
Template names, locations and types and their artifact naming patterns and relative output locations
Per-template overwrite predicates
Binding templates to model instances
Root structure of model tree including global properties and parent containers for generated model instances
Default and artifact-specific naming patterns using model and emitter contexts
Reading, writing and merging of metadata
Code naming and conversion implementations
Anything that gen.properties can specify
|
String |
getConfigurerBeanId()
|
String |
getPipelineBeanId()
|
String |
getStartModelBeanId()
The bean id of the model instance to use as input to the pipeline. |
Model |
runPipeline()
Pulls pipeline bean out of factory
and calls the gen method. |
void |
setArgs(String[] args)
Scans arguments for config and/or property file. |
void |
setConfigFile(String configFile)
|
void |
setProperties(Properties properties)
Overrides default properties set in configFile. |
void |
setPropertyFile(String propertyFile)
The properties file is meant to be the first (ie easiest) level of generator configuration specifying: Generated project name and directory location Source folder layout Output types |
void |
setStartModelBeanId(String parentNodeBeanId)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_CONFIGURER_BEAN_ID
public static final String DEFAULT_PIPELINE_BEAN_ID
public static final String DEFAULT_TEMPLATE_GENERATOR_BEAN_ID
public static final String DEFAULT_ROOT_BEAN_NAME_ID
public static final String DEFAULT_CONFIG_FILE
protected String configFile
protected String propertyFile
protected Properties properties
protected org.springframework.beans.factory.BeanFactory beanFactory
protected String startModelBeanId
| Constructor Detail |
|---|
public SpringMain()
| Method Detail |
|---|
public void setArgs(String[] args)
args - takes an optional Spring XML configuration file location and/or a properties file.
Files can be any valid URL or classpath location. File types are recognized by their extension,
names and order are not important. Here are some valid examples:
public Object getBean(String beanId)
public Model runPipeline()
pipeline bean out of factory
and calls the gen method.
factory - - configured BeanFactory instanceprotected org.springframework.beans.factory.BeanFactory getBeanFactory()
Properties inputs have the following precedence from lowest to highest:
GlobalPropertyHolder bean within the SpringConfig.xml file.propertyFile. Note: this can be specified as a GlobalPropertyHolder property and overridden here.properties instance. Note: these are usually set by the invoking tool (i.e. Maven).
http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-extension-factory-postprocessorspublic String getConfigFile()
XXXSpringConfig.xml including:
gen.properties can specify
configFile - Spring xml context file.public void setConfigFile(String configFile)
public void setProperties(Properties properties)
configFile.
properties - public void setPropertyFile(String propertyFile)
public String getConfigurerBeanId()
public String getPipelineBeanId()
public String getStartModelBeanId()
Note: normally the startModel is set directly on the pipeline in the SpringConfig.xml file.
public void setStartModelBeanId(String parentNodeBeanId)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||