1 /*
2 * Demosys.
3 *
4 * Terms of license - http://opensource.org/licenses/apachepl.php
5 */
6 package org.demosys.web;
7 import org.demosys.task.MemoryTaskService;
8 import org.demosys.task.TaskService;
9 import org.demosys.web.iteration.IterationService;
10 import org.demosys.web.iteration.impl.MemoryIterationService;
11 import org.demosys.web.project.ProjectService;
12 import org.demosys.web.project.impl.MemoryProjectService;
13 import org.demosys.web.story.StoryService;
14 import org.demosys.web.story.impl.MemoryStoryService;
15 import org.demosys.web.user.UserService;
16 import org.demosys.web.user.impl.MemoryUserService;
17 /***
18 * TODO : Voir si on remplace le _service locator par des plugins (cf. struts-exemples.war
19 * de la distribution strtus).
20 */
21 public class ServiceLocator {
22 private static ServiceLocator _locator = null;
23 private StoryService _storyService = new MemoryStoryService();
24 private IterationService iterationService = new MemoryIterationService();
25 private TaskService taskService = new MemoryTaskService();
26 private ProjectService projectService = new MemoryProjectService();
27 private UserService _userService = new MemoryUserService();
28
29 public UserService getUserService() {
30 return _userService;
31 }
32
33
34 public ProjectService getProjectService() {
35 return projectService;
36 }
37
38
39 public TaskService getTaskService() {
40 return taskService;
41 }
42
43
44 /***
45 * Shutdow the current ServiceLocator with all current services.
46 *
47 * <p>
48 * TODO : Make a ServiceInterface with a shutdown method to delegate the call.
49 * </p>
50 */
51 public synchronized void shutdown() {
52 _locator = null;
53 }
54
55
56 /***
57 * Service des Story.
58 *
59 * @return Le _service responsable des story.
60 */
61 public StoryService getStoryService() {
62 return _storyService;
63 }
64
65
66 public IterationService getIterationService() {
67 return iterationService;
68 }
69
70
71 public static final synchronized ServiceLocator getServiceLocator() {
72 if (_locator == null) {
73 _locator = new ServiceLocator();
74 }
75
76 return _locator;
77 }
78 }
This page was automatically generated by Maven