|
|
|
Re: JMDNSDiscoveryContainer issue [message #591831 is a reply to message #591826] |
Tue, 29 November 2005 16:40 |
Scott Lewis Messages: 1038 Registered: July 2009 |
Senior Member |
|
|
Hi Bill,
Bill Joy wrote:
> That sounds good, thanks.
>
> I have not gotten to the point of trying to use ECF to register a service,
> but now looking at the makeServiceInfoFromIServiceInfo() code, it appears
> like there is an assumption that the property value will always be a String
> when transferring from a Map to the Hashtable used by JmDNS. You will want
> to change that to Serializable or Object if you are going to put the
> property value in a temporary variable.
The new code in makeServiceInfoFromIServiceInfo looks like this:
IServiceProperties svcProps = serviceInfo.getServiceProperties();
if (svcProps != null) {
for (Enumeration e=svcProps.getPropertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
Object val = svcProps.getProperty(key);
if (val != null) {
props.put(key, val);
}
}
}
This uses the IServiceProperties.getProperty(String name) method, and
the resulting value is of type Object, so implementers of the
IServiceProperties interface are free to put whatever they like into the
underlying map.
There is an assumption that the key is of type String, but I don't think
that's a problem. Let me know if you disagree.
Thanks,
Scott
>
>
> "Scott Lewis" <slewis@composent.com> wrote in message
> news:438BECAF.4000205@composent.com...
>
>>Hi Bill,
>>
>>Thanks for the report.
>>
>>I've updated the org.eclipse.ecf.discovery.IServiceInfo interface to
>>return an instance of IServiceProperties (new interface in
>>org.eclipse.ecf.discovery) in response to
>>IServiceInfo.getServicesProperties() rather than a Map in response to
>>IServiceInfo.getProperties(). IServiceProperties has methods
>>
>>String getPropertyString(String name);
>>and
>>byte [] getPropertyBytes(String name);
>>
>>Allowing the receiver to get a given named property as either a String or
>>a byte [] (like JmDNS).
>>
>>IServiceProperties also exposes
>>
>>Object getProperty(String name);
>>
>>To allow for providers that allow the transmission of other types of
>>properties.
>>
>>This is checked in and tested, but won't be in until a 0.5.3 stable build
>>(propbably sometime this or next week).
>>
>>Bill also...if you have contact with others at Borland I would like to
>>solicit your/Borland's participation in ECF. If you could direct me at
>>the appropriate folks to initiate such a conversation I would appreciate
>>it.
>>
>>Thanks,
>>
>>Scott
>>
>>
>>
>>Bill Joy wrote:
>>
>>>I am trying to use the 0.5.2 build of ECF to make Eclipse aware of an
>>>existing service which was already using JmDNS to discovery other
>>>instances of itself. The service makes use of the JmDNS support for
>>>allowing a byte array (containing an encryption public key in this case)
>>>as a property.
>>>
>>>Unfortunately for me, JMDNSDiscoveryContainer is coded to always use
>>>javax.jmdns.ServiceInfo.getPropertyString(). This corrupts binary data
>>>(or even text with international characters which are not UTF encoded) by
>>>invoking the readUTF() method on the bytes on the assumption the property
>>>value always contains UTF text.
>>>
>>>The one good thing is that this problem is not critical to what I am
>>>trying to accomplish, however I thought I would raise the issue.
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.08245 seconds