Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » JMDNSDiscoveryContainer issue
JMDNSDiscoveryContainer issue [message #591806] Tue, 29 November 2005 00:42 Go to next message
Bill Joy is currently offline Bill JoyFriend
Messages: 60
Registered: July 2009
Member
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.
Re: JMDNSDiscoveryContainer issue [message #591817 is a reply to message #591806] Tue, 29 November 2005 05:52 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 974
Registered: July 2009
Senior Member
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.
>
>
Re: JMDNSDiscoveryContainer issue [message #591826 is a reply to message #591817] Tue, 29 November 2005 15:17 Go to previous messageGo to next message
Bill Joy is currently offline Bill JoyFriend
Messages: 60
Registered: July 2009
Member
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.


"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.
Re: JMDNSDiscoveryContainer issue [message #591831 is a reply to message #591826] Tue, 29 November 2005 16:40 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 974
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.
>
>
>
Re: JMDNSDiscoveryContainer issue [message #591838 is a reply to message #591831] Tue, 29 November 2005 16:48 Go to previous message
Bill Joy is currently offline Bill JoyFriend
Messages: 60
Registered: July 2009
Member
Looks good, thanks.


"Scott Lewis" <slewis@composent.com> wrote in message
news:438C8486.8040905@composent.com...
>
> 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
Previous Topic:Skype / VOIP Status
Next Topic:About the ClassLoader in SharedObjectDescription
Goto Forum:
  


Current Time: Wed Nov 26 13:11:34 GMT 2014

Powered by FUDForum. Page generated in 0.16504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software