106 |
106 |
|
107 |
107 |
private ICdmRemoteSource remoteSource;
|
108 |
108 |
|
109 |
|
private static Map serviceMap = new HashMap<Class<IService>, IService>();
|
|
109 |
private Map serviceMap = new HashMap<Class<IService>, IService>();
|
110 |
110 |
|
111 |
111 |
private ICdmEntitySessionManager cdmEntitySessionManager;
|
112 |
112 |
|
... | ... | |
120 |
120 |
|
121 |
121 |
public CdmApplicationRemoteConfiguration(ICdmRemoteSource remoteSource) {
|
122 |
122 |
this.remoteSource = remoteSource;
|
123 |
|
serviceMap.clear();
|
|
123 |
|
124 |
124 |
}
|
125 |
125 |
|
126 |
126 |
public void setRemoteSource(ICdmRemoteSource remoteSource) {
|
... | ... | |
128 |
128 |
}
|
129 |
129 |
|
130 |
130 |
private Object getService(Class<?> clazz, String serviceSuffix, CdmAuthenticatedHttpInvokerRequestExecutor executor) {
|
131 |
|
return getService(clazz, serviceSuffix, remoteSource, executor);
|
132 |
|
}
|
133 |
|
|
134 |
|
public static Object getService(Class<?> clazz, String serviceSuffix, ICdmRemoteSource remoteSource, CdmAuthenticatedHttpInvokerRequestExecutor executor) {
|
135 |
131 |
if(serviceMap.containsKey(clazz)) {
|
136 |
132 |
return serviceMap.get(clazz);
|
137 |
133 |
}
|
|
134 |
Object service = getService(clazz, serviceSuffix, remoteSource, executor);
|
|
135 |
serviceMap.put(clazz, service);
|
|
136 |
return service;
|
|
137 |
}
|
|
138 |
|
|
139 |
public static Object getService(Class<?> clazz,
|
|
140 |
String serviceSuffix,
|
|
141 |
ICdmRemoteSource remoteSource,
|
|
142 |
CdmAuthenticatedHttpInvokerRequestExecutor executor) {
|
|
143 |
|
138 |
144 |
String baseUrl;
|
139 |
145 |
if(remoteSource.getContextPath() == null || remoteSource.getContextPath().equals("")) {
|
140 |
146 |
baseUrl = "http://" + remoteSource.getServer() + ":" + String.valueOf(remoteSource.getPort());
|
... | ... | |
149 |
155 |
proxy.setHttpInvokerRequestExecutor(executor);
|
150 |
156 |
}
|
151 |
157 |
proxy.afterPropertiesSet();
|
152 |
|
Object service = proxy.getObject();
|
153 |
|
serviceMap.put(clazz, service);
|
154 |
|
return service;
|
|
158 |
return proxy.getObject();
|
155 |
159 |
}
|
156 |
160 |
|
157 |
161 |
// ****************************** APPLICATION CONTEXT *************************************************/
|
Revert cached services map to be local to configuration class