org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject
public IRemoteServiceReference[] getRemoteServiceReferences(ID[] idFilter, String clazz, String filter) throws InvalidSyntaxException {
Trace.entering(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_ENTERING, this.getClass(), "getRemoteServiceReferences", new Object[] {idFilter, clazz, filter}); //$NON-NLS-1$
if (clazz == null)
return null;
final IRemoteFilter remoteFilter = (filter == null) ? null : new RemoteFilterImpl(filter);
final List references = new ArrayList();
// Lookup from remote registrys...add to given references List
addReferencesFromRemoteRegistrys(idFilter, clazz, remoteFilter, references);
// Add any from local registry
// If we comment out this code our remote service retrieving seems to work fine. In our opinion this part prevents the execution of the code marked in blue. As we understand the blue code is neccessary in order to get proper working remote services. Could you please comment our suspicion?
// synchronized (localRegistry) {
// addReferencesFromRegistry(clazz, remoteFilter, localRegistry, references);
// }
// If none found the first time we send a registration request and wait
if (references.size() == 0) {
AddRegistrationRequest first = null;
List ourAddRegistrationRequests = new ArrayList();
// It's not already here...so send out AddRegistrationRequests
if (idFilter == null) {
first = new AddRegistrationRequest(null, clazz, filter, first);
ourAddRegistrationRequests.add(first);
} else {
for (int i = 0; i < idFilter.length; i++) {
ID target = idFilter[i];
if (target != null) {
AddRegistrationRequest request = new AddRegistrationRequest(target, clazz, filter, first);
if (i == 0)
first = request;
// Add to list of all know
ourAddRegistrationRequests.add(request);
addRegistrationRequests.put(request.getId(), request);
sendAddRegistrationRequest(target, request, getAddRegistrationRequestCredentials(request));
}
}
}
// Wait here for timeout or response
first.waitForResponse(ADD_REGISTRATION_REQUEST_TIMEOUT);
// Now look again
addReferencesFromRemoteRegistrys(idFilter, clazz, remoteFilter, references);
// In either case, remove all the addRegistrationRequests
for (Iterator i = ourAddRegistrationRequests.iterator(); i.hasNext();) {
AddRegistrationRequest request = (AddRegistrationRequest) i.next();
addRegistrationRequests.remove(request.getId());
}
}
final IRemoteServiceReference[] result = (IRemoteServiceReference[]) references.toArray(new IRemoteServiceReference[references.size()]);
Trace.exiting(Activator.PLUGIN_ID, IRemoteServiceProviderDebugOptions.METHODS_EXITING, this.getClass(), "getRemoteServiceReferences", result); //$NON-NLS-1$
return (result.length == 0) ? null : result;
}
Any answer would be appreciated.
Regards,
Eugen
Am May 14, 2009 um 11:25 schrieb Eugen Reiswich:
Hi,
we are trying now for hours to get an example running with ECF. We would like to use remote services in hour application and thus do the following stuff:
1. Register remote services:
public void registerRemoteService(String serviceName, Object impl,
ID[] targetUserIDs) {
Dictionary<String, ID[]> props = new Hashtable<String, ID[]>();
props.put(Constants.SERVICE_REGISTRATION_TARGETS, targetUserIDs);
// register ECF remote service
getRemoteServiceContainerAdapter().registerRemoteService(
new String[] { serviceName }, impl, props);
}
2. Retrieve remote services:
public <T> List<T> getRemoteService(Class<T> service, ID[] filterUserIDs,
String filter) throws ECFException, InvalidSyntaxException {
List<T> remoteServices = new ArrayList<T>();
IRemoteServiceContainerAdapter remoteServiceContainerAdapter = getRemoteServiceContainerAdapter();
// This method does not work. It doesn't matter which filterIDs we provide, our remote services can not be found!
// The remoteServiceContainerAdapter always finds his own registered remote service but not the those other clients offer
IRemoteServiceReference[] refs = remoteServiceContainerAdapter
.getRemoteServiceReferences(filterUserIDs, service.getName(),
filter);
Is this a known issue or should I open a bug? We are using ECF 3.0.v20090513-0832 with Eclipse 3.5
Regards,
Eugen
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev