public static void main(String[] args) {
		
		if (args.length < 2) {
			throw new IllegalArgumentException("Path and datasource are Mandatory");
		}
		String workspacePath = args[0];
		String databaseName = args[1];
		
		String sourcePath = workspacePath + File.separator + ProjectMetaDataDao.DATA_MODEL_FOLDER_NAME;
		
		try(FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext("classpath:applicationContext-generator-bash.xml", "file:" + sourcePath + File.separator + DATASOURCE_CONTEXT_FILE);){
			logger.info("Context loaded");
			
			Project project;
			
			try {
				logger.info("start loading project");
				
				ProjectMetaDataService projectMetaDataService = appContext.getBean(ProjectMetaDataService.class);
				ProjectLoader projectLoader = appContext.getBean(ProjectLoader.class);
				
				ProjectMetaData projectMetaData = projectMetaDataService.loadProjectMetaData(workspacePath);
				
				ProjectValidationReport report = projectMetaDataService.validate(projectMetaData);
				ValidationPrompter.promptOnValidation(report);
				
				project = projectLoader.loadProject(projectMetaData);
				
				logger.info("loading project " + project.projectName + " completed");
					
			} catch (Exception e) {
				logger.error("failed", e);
				return;
			}
			
			try {
				OutputDataSourceProvider outputDataSourceProvider = appContext.getBean(OutputDataSourceProvider.class);
				DataSource dataSource = outputDataSourceProvider.getDataSource(databaseName);
				
				DatabaseBuilder databaseBuilder = appContext.getBean(DatabaseBuilder.class);
				databaseBuilder.buildDatabase(dataSource, project);
				
			} catch (Exception e) {
				logger.error("failed", e);
				return;
			}
		}
	}
public static void main(String[] args) {
		
		if (args.length < 2) {
			throw new IllegalArgumentException("Path and datasource are Mandatory");
		}
		String workspacePath = args[0];
		String databaseName = args[1];
		
		String sourcePath = workspacePath + File.separator + ProjectMetaDataDao.DATA_MODEL_FOLDER_NAME;
		
		try(FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext("classpath:applicationContext-generator-bash.xml", "file:" + sourcePath + File.separator + DATASOURCE_CONTEXT_FILE);){
			logger.info("Context loaded");
			
			Project project;
			
			try {
				logger.info("start loading project");
				
				ProjectMetaDataService projectMetaDataService = appContext.getBean(ProjectMetaDataService.class);
				ProjectLoader projectLoader = appContext.getBean(ProjectLoader.class);
				
				ProjectMetaData projectMetaData = projectMetaDataService.loadProjectMetaData(workspacePath);
				
				ProjectValidationReport report = projectMetaDataService.validate(projectMetaData);
				ValidationPrompter.promptOnValidation(report);
				
				project = projectLoader.loadProject(projectMetaData);
				
				logger.info("loading project " + project.projectName + " completed");
					
			} catch (Exception e) {
				logger.error("failed", e);
				return;
			}
			
			try {
				OutputDataSourceProvider outputDataSourceProvider = appContext.getBean(OutputDataSourceProvider.class);
				DataSource dataSource = outputDataSourceProvider.getDataSource(databaseName);
				
				DatabaseBuilder databaseBuilder = appContext.getBean(DatabaseBuilder.class);
				databaseBuilder.buildDatabase(dataSource, project);
				
			} catch (Exception e) {
				logger.error("failed", e);
				return;
			}
		}
	}
public static void main ( String [ ] args ) { if ( args . length < 2 ) { throw new IllegalArgumentException ( "Path and datasource are Mandatory" ) ; } String workspacePath = args [ 0 ] ; String databaseName = args [ 1 ] ; String sourcePath = workspacePath + File . separator + ProjectMetaDataDao . DATA_MODEL_FOLDER_NAME ; try ( FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext ( "classpath:applicationContext-generator-bash.xml" , "file:" + sourcePath + File . separator + DATASOURCE_CONTEXT_FILE ) ; ) { logger . info ( "Context loaded" ) ; Project project ; try { logger . info ( "start loading project" ) ; ProjectMetaDataService projectMetaDataService = appContext . getBean ( ProjectMetaDataService . class ) ; ProjectLoader projectLoader = appContext . getBean ( ProjectLoader . class ) ; ProjectMetaData projectMetaData = projectMetaDataService . loadProjectMetaData ( workspacePath ) ; ProjectValidationReport report = projectMetaDataService . validate ( projectMetaData ) ; ValidationPrompter . promptOnValidation ( report ) ; project = projectLoader . loadProject ( projectMetaData ) ; logger . info ( "loading project " + project . projectName + " completed" ) ; } catch ( Exception e ) { logger . error ( "failed" , e ) ; return ; } try { OutputDataSourceProvider outputDataSourceProvider = appContext . getBean ( OutputDataSourceProvider . class ) ; DataSource dataSource = outputDataSourceProvider . getDataSource ( databaseName ) ; DatabaseBuilder databaseBuilder = appContext . getBean ( DatabaseBuilder . class ) ; databaseBuilder . buildDatabase ( dataSource , project ) ; } catch ( Exception e ) { logger . error ( "failed" , e ) ; return ; } } }
main method to be executed
@param args 0->the workspace folder where the "data-model" folder will be detected
@param args 1->the database name, declared in /data-model/CONTEXT/datasource-context.xml
main method to be executed