1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package ch.elca.el4j.services.remoting.protocol;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import org.springframework.util.StringUtils;
24
25 import ch.elca.el4j.services.monitoring.notification.CoreNotificationHelper;
26 import ch.elca.el4j.services.remoting.AbstractRemotingProtocol;
27 import ch.elca.el4j.services.remoting.RemotingProxyFactoryBean;
28 import ch.elca.el4j.services.remoting.RemotingServiceExporter;
29
30
31
32
33
34
35
36
37
38 public class RemotingDisabled extends AbstractRemotingProtocol {
39
40
41
42
43 private Map m_serviceObjects = new HashMap();
44
45
46
47
48 public Object createProxyBean(RemotingProxyFactoryBean proxyBean,
49 Class serviceInterfaceWithContext) {
50
51 Object result = null;
52
53 String serviceName = proxyBean.getServiceName();
54 if (StringUtils.hasText(serviceName)) {
55 Object serviceObject = m_serviceObjects.get(serviceName);
56 if (serviceObject == null) {
57 CoreNotificationHelper.notifyMisconfiguration(
58 "There is no service for service name '" + serviceName
59 + "'. Be sure that server side is started "
60 + "before client side.");
61 } else {
62 result = serviceObject;
63 }
64 } else {
65 CoreNotificationHelper.notifyMisconfiguration(
66 "Service name can not be null or empty!");
67 }
68
69 return result;
70 }
71
72
73
74
75 public Object createExporterBean(RemotingServiceExporter exporterBean,
76 Class serviceInterfaceWithContext, Object serviceProxy) {
77 String serviceName = exporterBean.getServiceName();
78 if (StringUtils.hasText(serviceName)) {
79 m_serviceObjects.put(serviceName, serviceProxy);
80 } else {
81 CoreNotificationHelper.notifyMisconfiguration(
82 "Service name can not be null or empty!");
83 }
84 return serviceProxy;
85 }
86
87
88
89
90 public Class getProxyObjectType() {
91 return Object.class;
92 }
93
94
95
96
97 public Class getExporterObjectType() {
98 return Object.class;
99 }
100
101
102
103
104 public void afterPropertiesSet() throws Exception {
105
106 }
107 }