Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » Question about method asProperties( ) in ServiceProperties (in ECF discovery)
Question about method asProperties( ) in ServiceProperties (in ECF discovery) [message #623462] Fri, 25 April 2008 13:50 Go to next message
Phuong Hoang is currently offline Phuong Hoang
Messages: 10
Registered: July 2009
Junior Member
Hi again,

I have a question about the behavior of method asProperties() in
ServiceProperties

public Properties asProperties( ){

return new Properties(props);

}

=> This does not return copy of Properties object BUT return an empty
Properties with the default list containing the same elements as variable
ServiceProperties.props instead. Is this what it supposed to behave or is
this a bug???

The reason I ask because using the jslp provider for ECF, when register the
service with non-empty ServiceProperties it results in service registered
with no attribute registered. This happens because when jslp enumerates the
list of attributes to register for the service, it applies method
java.util.Dictionary.keys( ) on ServiceProperties.asProperties( ) and got an
empty list returned (since keys in non-empty default list is not considered
as existing keys, I think).



Phuong
Re: Question about method asProperties( ) in ServiceProperties (in ECF discovery) [message #623464 is a reply to message #623462] Fri, 25 April 2008 17:44 Go to previous messageGo to next message
Scott Lewis is currently offline Scott Lewis
Messages: 970
Registered: July 2009
Senior Member
Hi Phuong,

Phuong Hoang wrote:
> Hi again,
>
> I have a question about the behavior of method asProperties() in
> ServiceProperties
>
> public Properties asProperties( ){
>
> return new Properties(props);
>
> }
>
> => This does not return copy of Properties object BUT return an empty
> Properties with the default list containing the same elements as variable
> ServiceProperties.props instead. Is this what it supposed to behave or is
> this a bug???


Seems like the specification of IServiceProperties.asProperties() could
go either way to me. The specification (at least so far) is vague on
this point. Any other opinions/views about whether it should be a copy
or not?

>
> The reason I ask because using the jslp provider for ECF, when register the
> service with non-empty ServiceProperties it results in service registered
> with no attribute registered. This happens because when jslp enumerates the
> list of attributes to register for the service, it applies method
> java.util.Dictionary.keys( ) on ServiceProperties.asProperties( ) and got an
> empty list returned (since keys in non-empty default list is not considered
> as existing keys, I think).


I've modified the bug you filed on a related issue to accomodate this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=228882

The jSLP provider *should* be including service attributes in the
IServiceProperties associated with the IServiceInfo. Currently it is not.

Thanks for the reports/observations.

Scott
Re: Question about method asProperties( ) in ServiceProperties (in ECF discovery) [message #623467 is a reply to message #623464] Mon, 28 April 2008 15:39 Go to previous messageGo to next message
Markus Kuppe is currently offline Markus Kuppe
Messages: 177
Registered: July 2009
Senior Member
Scott Lewis wrote:
> Hi Phuong,
>
> Phuong Hoang wrote:
>> Hi again,
>>
>> I have a question about the behavior of method asProperties() in
>> ServiceProperties
>>
>> public Properties asProperties( ){
>>
>> return new Properties(props);
>>
>> }
>>
>> => This does not return copy of Properties object BUT return an empty
>> Properties with the default list containing the same elements as
>> variable ServiceProperties.props instead. Is this what it supposed to
>> behave or is this a bug???
>
>
> Seems like the specification of IServiceProperties.asProperties() could
> go either way to me. The specification (at least so far) is vague on
> this point. Any other opinions/views about whether it should be a copy
> or not?
>
>>
>> The reason I ask because using the jslp provider for ECF, when
>> register the service with non-empty ServiceProperties it results in
>> service registered with no attribute registered. This happens because
>> when jslp enumerates the list of attributes to register for the
>> service, it applies method java.util.Dictionary.keys( ) on
>> ServiceProperties.asProperties( ) and got an empty list returned
>> (since keys in non-empty default list is not considered as existing
>> keys, I think).

What do people think if we remove
org.eclipse.ecf.discovery.IServiceInfo.getServiceProperties( )? Back when
I added the method it seems reasonable. But with the service
attributes/properties overhaul, the method doesn't make sense any more.

Cheers
Markus
Re: Question about method asProperties( ) in ServiceProperties (in ECF discovery) [message #623468 is a reply to message #623467] Mon, 28 April 2008 15:49 Go to previous message
Markus Kuppe is currently offline Markus Kuppe
Messages: 177
Registered: July 2009
Senior Member
Markus Alexander Kuppe wrote:
> Scott Lewis wrote:
>> Hi Phuong,
>>
>> Phuong Hoang wrote:
>>> Hi again,
>>>
>>> I have a question about the behavior of method asProperties() in
>>> ServiceProperties
>>>
>>> public Properties asProperties( ){
>>>
>>> return new Properties(props);
>>>
>>> }
>>>
>>> => This does not return copy of Properties object BUT return an empty
>>> Properties with the default list containing the same elements as
>>> variable ServiceProperties.props instead. Is this what it supposed to
>>> behave or is this a bug???
>>
>>
>> Seems like the specification of IServiceProperties.asProperties()
>> could go either way to me. The specification (at least so far) is
>> vague on this point. Any other opinions/views about whether it should
>> be a copy or not?
>>
>>>
>>> The reason I ask because using the jslp provider for ECF, when
>>> register the service with non-empty ServiceProperties it results in
>>> service registered with no attribute registered. This happens because
>>> when jslp enumerates the list of attributes to register for the
>>> service, it applies method java.util.Dictionary.keys( ) on
>>> ServiceProperties.asProperties( ) and got an empty list returned
>>> (since keys in non-empty default list is not considered as existing
>>> keys, I think).
>
> What do people think if we remove
> org.eclipse.ecf.discovery.IServiceInfo.getServiceProperties( )? Back when
> I added the method it seems reasonable. But with the service
> attributes/properties overhaul, the method doesn't make sense any more.

Looking at the test cases, maybe size() and equals()/hashCode() should
be exposed in IServiceProperties.

Markus
Previous Topic:How to implement a new provider
Next Topic:Questions about ECF discovery with jSLP provider
Goto Forum:
  


Current Time: Tue Sep 23 08:26:09 GMT 2014

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

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