Commits

Zemian Deng committed 432e815

Added Scheduler.getCoreServices() to API.

Comments (0)

Files changed (3)

timemachine-scheduler/src/main/java/timemachine/scheduler/Scheduler.java

 	public Service getUserService(String name);
 	
 	public List<String> getUserServiceNames();
+	
+	public CoreServices getCoreServices();
 
 	public SchedulerContext getSchedulerContext();
 

timemachine-scheduler/src/main/java/timemachine/scheduler/service/SchedulerEngine.java

 	public SystemServiceContainer getSystemServiceContainer() {
 		return systemServiceContainer;
 	}
+	
 	public ServiceContainer getUserServiceContainer() {
 		return userServiceContainer;
 	}
 	public Service getUserService(String name) {
 		return userServiceContainer.getService(name);
 	}
+	
+	@Override
+	public CoreServices getCoreServices() {
+		return systemServiceContainer;
+	}
 
 	@Override
 	public SchedulerNode getSchedulerNode() {

timemachine-web/src/main/java/timemachine/scheduler/web/HistoriesServlet.java

 import timemachine.scheduler.EventHistory;
 import timemachine.scheduler.Scheduler;
 import timemachine.scheduler.service.DataStore;
-import timemachine.scheduler.service.SchedulerEngine;
 
 /**
  * Serve the scheduler event histories page.
 	{
 		logger.trace("Getting scheduler event histories page.");
 		Scheduler scheduler = (Scheduler)getServletContext().getAttribute("scheduler");
-		// We assume we use the one and only SchedulerEngine impl.
-		SchedulerEngine schedulerEngine = (SchedulerEngine)scheduler;
-		DataStore dataStore = schedulerEngine.getSystemServiceContainer().getDataStoreService();
+		DataStore dataStore = scheduler.getCoreServices().getDataStoreService();
 		List<EventHistory> eventHistories = dataStore.findEventHistories(scheduler.getSchedulerNode().getId());
 		req.setAttribute("eventHistories", eventHistories);
 		req.getRequestDispatcher(VIEW).forward(req, resp);