|
1 |
| package net.sf.crispy.server; |
|
2 |
| |
|
3 |
| import java.util.Hashtable; |
|
4 |
| import java.util.Map; |
|
5 |
| |
|
6 |
| import net.sf.crispy.impl.ServiceManager; |
|
7 |
| import net.sf.crispy.util.Util; |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| public class SingleServiceContainerImpl implements SingleServiceContainer { |
|
19 |
| |
|
20 |
| private Map services = new Hashtable(); |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
248
| public void addService(String pvServiceInterfaceName, Object pvServiceImpl) {
|
|
27 |
248
| services.put(pvServiceInterfaceName, pvServiceImpl);
|
|
28 |
| } |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
5
| public void addService(String pvServiceInterfaceName, String pvServiceImplName) {
|
|
34 |
5
| try {
|
|
35 |
5
| Object lvServiceImpl = Util.createObject(pvServiceImplName);
|
|
36 |
5
| addService(pvServiceInterfaceName, lvServiceImpl);
|
|
37 |
| } catch (Exception e) { |
|
38 |
| if (ServiceManager.DEBUG_MODE_ON) { |
|
39 |
| e.printStackTrace(); |
|
40 |
| } |
|
41 |
| } |
|
42 |
| } |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
4
| public void removeService(String pvServiceInterfaceName) {
|
|
48 |
4
| services.remove(pvServiceInterfaceName);
|
|
49 |
| } |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
190
| public Object getService(String pvServiceInterfaceName) {
|
|
55 |
190
| return services.get(pvServiceInterfaceName);
|
|
56 |
| } |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
15
| public int getServiceSize() {
|
|
62 |
15
| return services.size();
|
|
63 |
| } |
|
64 |
| |
|
65 |
| } |