public <T> List<T> getRemoteService(Class<T> service, ID[] filterIDs,
String filter) throws ECFException, InvalidSyntaxException {
List<T> remoteServices = new ArrayList<T>();
IRemoteServiceContainerAdapter remoteServiceContainerAdapter = (IRemoteServiceContainerAdapter) this.containter
.getAdapter(IRemoteServiceContainerAdapter.class);
IRemoteServiceReference[] refs = remoteServiceContainerAdapter
.getRemoteServiceReferences(null, service.getName(), filter);
// cast the remote service references to proxies
for (int serviceNumber = 0; serviceNumber < refs.length; serviceNumber++) {
IRemoteService remoteService = remoteServiceContainerAdapter
.getRemoteService(refs[serviceNumber]);
Assert.isNotNull(remoteService);
IRemoteServiceReference remoteServiceReference = refs[serviceNumber];
ID containerID = remoteServiceReference.getContainerID();
String containerIDName = containerID.getName();
for (ID userID : filterIDs) {
String userIDName = userID.getName();
if (userIDName.equals(containerIDName)) {
// get proxy for remote service and add service to the
// service list
T castedService = service.cast(remoteService.getProxy());
// T castedService = (T) remoteService.getProxy();
Assert.isNotNull(castedService);
remoteServices.add(castedService);
break;
}
}
}
return remoteServices;
}
Have you got an idea what I'm doing wrong?