s4EventClock.updateTime(seedTime);
System.out.println("Intializing event clock time with seed time "
+ s4EventClock.getCurrentTime());
}
PEContainer peContainer = (PEContainer) context.getBean("peContainer");
Watcher w = (Watcher) context.getBean("watcher");
w.setConfigFilename(configBase + s4CoreConfFileName);
// load extension modules
// String[] configFileNames = getModuleConfigFiles(extsHome, prop);
// if (configFileNames.length > 0) {
// String[] configFileUrls = new String[configFileNames.length];
// for (int i = 0; i < configFileNames.length; i++) {
// configFileUrls[i] = "file:" + configFileNames[i];
// }
// context = new FileSystemXmlApplicationContext(configFileUrls,
// context);
// }
// load application modules
String applicationConfigFileName = configBase + "app_conf.xml";
String[] configFileUrls = new String[] { "file:"
+ applicationConfigFileName };
context = new FileSystemXmlApplicationContext(configFileUrls, context);
// attach any beans that implement ProcessingElement to the PE
// Container
String[] processingElementBeanNames = context
.getBeanNamesForType(AbstractPE.class);
for (String processingElementBeanName : processingElementBeanNames) {
Object bean = context.getBean(processingElementBeanName);
try {
Method getS4ClockMethod = bean.getClass().getMethod(
"getClock");
if (getS4ClockMethod.getReturnType().equals(Clock.class)) {
if (getS4ClockMethod.invoke(bean) == null) {
Method setS4ClockMethod = bean.getClass().getMethod(
"setClock", Clock.class);
setS4ClockMethod.invoke(bean,
coreContext.getBean("clock"));
}
}
((AbstractPE)bean).setSafeKeeper((SafeKeeper) context.getBean("safeKeeper"));
} catch (NoSuchMethodException mnfe) {
// acceptable
}
System.out.println("Adding processing element with bean name "
+ processingElementBeanName + ", id "
+ ((AbstractPE) bean).getId());
peContainer.addProcessor((AbstractPE) bean);
}
appContext = context;
}