1 package org
.argeo
.slc
.executionflow
;
3 import java
.io
.FileInputStream
;
4 import java
.io
.FileNotFoundException
;
5 import java
.io
.IOException
;
8 import java
.util
.Properties
;
10 import org
.apache
.commons
.io
.IOUtils
;
11 import org
.apache
.commons
.logging
.Log
;
12 import org
.apache
.commons
.logging
.LogFactory
;
13 import org
.argeo
.slc
.logging
.Log4jUtils
;
14 import org
.springframework
.beans
.MutablePropertyValues
;
15 import org
.springframework
.beans
.PropertyValue
;
16 import org
.springframework
.beans
.factory
.config
.BeanDefinition
;
17 import org
.springframework
.beans
.factory
.support
.BeanDefinitionRegistry
;
18 import org
.springframework
.beans
.factory
.support
.SimpleBeanDefinitionRegistry
;
19 import org
.springframework
.beans
.factory
.xml
.XmlBeanDefinitionParser
;
20 import org
.springframework
.beans
.factory
.xml
.XmlBeanDefinitionReader
;
21 import org
.springframework
.context
.support
.FileSystemXmlApplicationContext
;
23 public class EfLauncher
{
24 private static Log log
;
26 public static void main(String
[] args
) {
29 String script
= "src/slc/conf/main.xml";
32 FileSystemXmlApplicationContext context
= new FileSystemXmlApplicationContext(
36 ExecutionFlow main
= (ExecutionFlow
)context
.getBean("main");
39 Map<String, ExecutionFlow> eFlows = context
40 .getBeansOfType(ExecutionFlow.class);
41 for (String name : eFlows.keySet()) {
42 log.info("##\n## Execute ExecutionFlow " + name);
43 ExecutionFlow eFlow = eFlows.get(name);
49 private static void describe(String script
){
50 SimpleBeanDefinitionRegistry registry
= new SimpleBeanDefinitionRegistry();
51 XmlBeanDefinitionReader reader
= new XmlBeanDefinitionReader(registry
);
52 reader
.loadBeanDefinitions("file:" + script
);
53 new ConsoleContextDescriber().describeContext(registry
);
56 private static void init() {
57 Properties userProperties
= new Properties();
58 FileInputStream in
= null;
60 in
= new FileInputStream("src/slc/conf/slc.properties");
61 userProperties
.load(in
);
62 } catch (Exception e
) {
65 IOUtils
.closeQuietly(in
);
68 // Set as System properties
69 for (Object obj
: userProperties
.keySet()) {
70 String key
= obj
.toString();
71 System
.setProperty(key
, userProperties
.getProperty(key
));
75 System
.setProperty("log4j.defaultInitOverride", "true");
77 Log4jUtils
.initLog4j(null);
78 log
= LogFactory
.getLog(EfLauncher
.class);