| Re: [ecf-dev] Remote OSGi services |
Hi Scott,It may be that you are not using the correct ID in the filter. For XMPP, the userID/rosterID is not the same as the remote clients containerID. What ID are you passing into the filter? after spendig some time with the remote OSGi services I discovered that my rosterID actually equals the remote clients containerID. But I've created a workaround for filtering services. In addition to that I have a question about registering and retrieving remote services. I have several clients connecting over XMPP and providing remote services. But the last client I connect is not able to get any of the remote services provided by the already connected clients. Only the first client can retrieve all remote services. It seems like a client can only retrieve remote services of clients that connect later on. This is the way how I register remote services: // register ECF remote service getRemoteServiceContainerAdapter().registerRemoteService( new String[] { serviceName }, impl, props); an here how I retrieve remote services: 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? Regards, Eugen Am 17.06.2008 um 21:12 schrieb Scott Lewis:
|