EventClock s4EventClock = (EventClock)s4Clock;
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(configPath);
// 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
configFileNames = getModuleConfigFiles(appsHome, 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);
// attach any beans that implement ProcessingElement to the PE
// Container
String[] processingElementBeanNames = context.getBeanNamesForType(ProcessingElement.class);
for (String processingElementBeanName : processingElementBeanNames) {
Object bean = context.getBean(processingElementBeanName);
try {
Method getS4ClockMethod = bean.getClass().getMethod("getS4Clock");
if (getS4ClockMethod.getReturnType().equals(Clock.class)) {
if (getS4ClockMethod.invoke(bean) == null) {
Method setS4ClockMethod = bean.getClass().getMethod("setS4Clock", Clock.class);
setS4ClockMethod.invoke(bean, coreContext.getBean("clock"));
}
}
}
catch (NoSuchMethodException mnfe) {
// acceptable
}
System.out.println("Adding processing element with bean name "
+ processingElementBeanName + ", id "
+ ((ProcessingElement) bean).getId());
peContainer.addProcessor((ProcessingElement) bean);
}
}
}