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(
35 log
.info("Context initialized");
37 ExecutionFlow main
= (ExecutionFlow
)context
.getBean("main");
40 Map<String, ExecutionFlow> eFlows = context
41 .getBeansOfType(ExecutionFlow.class);
42 for (String name : eFlows.keySet()) {
43 log.info("##\n## Execute ExecutionFlow " + name);
44 ExecutionFlow eFlow = eFlows.get(name);
50 private static void describe(String script
){
51 SimpleBeanDefinitionRegistry registry
= new SimpleBeanDefinitionRegistry();
52 XmlBeanDefinitionReader reader
= new XmlBeanDefinitionReader(registry
);
53 reader
.loadBeanDefinitions("file:" + script
);
54 new ConsoleContextDescriber().describeContext(registry
);
57 private static void init() {
58 Properties userProperties
= new Properties();
59 FileInputStream in
= null;
61 in
= new FileInputStream("src/slc/conf/slc.properties");
62 userProperties
.load(in
);
63 } catch (Exception e
) {
66 IOUtils
.closeQuietly(in
);
69 // Set as System properties
70 for (Object obj
: userProperties
.keySet()) {
71 String key
= obj
.toString();
72 System
.setProperty(key
, userProperties
.getProperty(key
));
76 System
.setProperty("log4j.defaultInitOverride", "true");
78 Log4jUtils
.initLog4j(null);
79 log
= LogFactory
.getLog(EfLauncher
.class);