TimeSourceService timeSourceService = makeTimeSource(configSnapshot);
SchedulingServiceSPI schedulingService = SchedulingServiceProvider.newService(timeSourceService);
SchedulingMgmtService schedulingMgmtService = new SchedulingMgmtServiceImpl();
EngineImportService engineImportService = makeEngineImportService(configSnapshot);
EngineSettingsService engineSettingsService = new EngineSettingsService(configSnapshot.getEngineDefaults(), configSnapshot.getPlugInEventTypeResolutionURIs());
DatabaseConfigService databaseConfigService = makeDatabaseRefService(configSnapshot, schedulingService, schedulingMgmtService);
PluggableObjectCollection plugInViews = new PluggableObjectCollection();
plugInViews.addViews(configSnapshot.getPlugInViews(), configSnapshot.getPlugInVirtualDataWindows());
PluggableObjectCollection plugInPatternObj = new PluggableObjectCollection();
plugInPatternObj.addPatternObjects(configSnapshot.getPlugInPatternObjects());
// exception handling
ExceptionHandlingService exceptionHandlingService = initExceptionHandling(epServiceProvider.getURI(), configSnapshot.getEngineDefaults().getExceptionHandling(), configSnapshot.getEngineDefaults().getConditionHandling());
// Statement context factory
Class systemVirtualDWViewFactory = null;
if (configSnapshot.getEngineDefaults().getAlternativeContext().getVirtualDataWindowViewFactory() != null) {
try {
systemVirtualDWViewFactory = Class.forName(configSnapshot.getEngineDefaults().getAlternativeContext().getVirtualDataWindowViewFactory());
if (!JavaClassHelper.isImplementsInterface(systemVirtualDWViewFactory, VirtualDataWindowFactory.class)) {
throw new ConfigurationException("Class " + systemVirtualDWViewFactory.getName() + " does not implement the interface " + VirtualDataWindowFactory.class.getName());
}
}
catch (ClassNotFoundException e) {
throw new ConfigurationException("Failed to look up class " + systemVirtualDWViewFactory);
}
}
StatementContextFactory statementContextFactory = new StatementContextFactoryDefault(plugInViews, plugInPatternObj, systemVirtualDWViewFactory);
long msecTimerResolution = configSnapshot.getEngineDefaults().getThreading().getInternalTimerMsecResolution();
if (msecTimerResolution <= 0)
{
throw new ConfigurationException("Timer resolution configuration not set to a valid value, expecting a non-zero value");
}
TimerService timerService = new TimerServiceImpl(epServiceProvider.getURI(), msecTimerResolution);
VariableService variableService = new VariableServiceImpl(configSnapshot.getEngineDefaults().getVariables().getMsecVersionRelease(), schedulingService, eventAdapterService, null);
initVariables(variableService, configSnapshot.getVariables(), engineImportService);
StatementLockFactory statementLockFactory = new StatementLockFactoryImpl(configSnapshot.getEngineDefaults().getExecution().isFairlock(), configSnapshot.getEngineDefaults().getExecution().isDisableLocking());
StreamFactoryService streamFactoryService = StreamFactoryServiceProvider.newService(epServiceProvider.getURI(), configSnapshot.getEngineDefaults().getViewResources().isShareViews());
FilterServiceSPI filterService = FilterServiceProvider.newService(configSnapshot.getEngineDefaults().getExecution().getFilterServiceProfile());
MetricReportingServiceImpl metricsReporting = new MetricReportingServiceImpl(configSnapshot.getEngineDefaults().getMetricsReporting(), epServiceProvider.getURI());
NamedWindowService namedWindowService = new NamedWindowServiceImpl(schedulingService, statementLockFactory, variableService, engineSettingsService.getEngineSettings().getExecution().isPrioritized(), eventProcessingRWLock, exceptionHandlingService, configSnapshot.getEngineDefaults().getLogging().isEnableQueryPlan(), metricsReporting);
ValueAddEventService valueAddEventService = new ValueAddEventServiceImpl();
valueAddEventService.init(configSnapshot.getRevisionEventTypes(), configSnapshot.getVariantStreams(), eventAdapterService, eventTypeIdGenerator);
StatementEventTypeRef statementEventTypeRef = new StatementEventTypeRefImpl();