Community
Participate
Working Groups
Follow code exists in the class RegistrySharedObject: final ID[] targets = getTargetsFromProperties(properties); if (targets == null) sendAddRegistration(null, reg); else for (int i = 0; i < targets.length; i++) sendAddRegistration(targets[i], reg); ECF has classes extends RegistrySharedObject wish can have own implementation of method getTargetsFromProperties (i.e. org.eclipse.ecf.internal.provider.xmpp.XMPPRemoteServiceAdapterFactory). This implementations can return null or empty array of IDs. if its return null we send AddRegistrations to null, if its return empty array (as XMPPRemoteServiceAdapterFactory) we send AddRegistrations to NOBODY. We should discuss about what should we do. May be we should documented method getTargetsFromProperties (it should return null or no empty array) or we should fix this code, for example: final ID[] targets = getTargetsFromProperties(properties); if (targets == null || targets.length == 0) sendAddRegistration(null, reg);
Hmmm. this is an interesting case. I would be inclined to do as you describe: final ID[] targets = getTargetsFromProperties(properties); if (targets == null || targets.length == 0) sendAddRegistration(null, reg); ...as I can't think of a decent use case for having getTargetsFromProperties not send out any add registration messages. If we can think of a decent use case then we can document getTargetsFromProperties as you describe.
We can register service with any properties, but without Constants.SERVICE_REGISTRATION_TARGETS Follows code is contained in the XMPPRemoteServiceAdapterFactory: List results = new ArrayList(); Object o = properties.get(Constants.SERVICE_REGISTRATION_TARGETS); if (o != null) { ... } return (ID[]) results.toArray(new ID[] {}); if Constants.SERVICE_REGISTRATION_TARGETS is not contains in properties code will return empty array
(In reply to comment #2) > We can register service with any properties, but without > Constants.SERVICE_REGISTRATION_TARGETS > Follows code is contained in the XMPPRemoteServiceAdapterFactory: > > List results = new ArrayList(); > Object o = properties.get(Constants.SERVICE_REGISTRATION_TARGETS); > if (o != null) { > ... > } > return (ID[]) results.toArray(new ID[] {}); > > if Constants.SERVICE_REGISTRATION_TARGETS is not contains in properties code > will return empty array Oh yes, now I remember. The XMPP provider doesn't support sending to a 'group' when service registration targets is not set...because there is no pre-defined group. So if null is passed to the send* methods the XMPP provider will throw an IOException.
Yes. it is, bug we has not only XMPP provider and we have potential bug for other providers and especially for new (not development) providers. I think we should document this aspect.
(In reply to comment #4) > Yes. it is, bug we has not only XMPP provider and we have potential bug for > other providers and especially for new (not development) providers. I think we > should document this aspect. I agree. I can't do it myself immediately due to other commitments, but please remind and I will get to it when I can.