You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Eric Pugh <ep...@upstate.com> on 2003/09/17 09:40:19 UTC

[configuration] Change Commons-Configuration getVector to getSet?

Hi all,

I am looking at a chunk of code like this:
 Vector packages = Turbine.getConfiguration()
                    .getVector(TurbineConstants.MODULE_PACKAGES);

                ObjectUtils.addOnce(packages,
                        GenericLoader.getBasePackage());

from Layout Loader...

And it seems to me that commons-configuration getVector should be deprecated
in favor of getSet().  I can't think why you would want duplicate values, so
getSet() makes more sense then getList().

Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...

Opinons?  And do we have to deprecate getVector() since we haven't released
from sandbox yet?

Eric Pugh


RE: [configuration] Change Commons-Configuration getVector to getSet?

Posted by Eric Pugh <ep...@upstate.com>.
Is getCollection what is wanted, or getList()?

I was under the impression that a collection isn't ordered..  And then you
would have to cast to a List to pass the collection into anything that
expects an ordered list.

Eric

> -----Original Message-----
> From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
> Sent: Thursday, September 25, 2003 10:02 AM
> To: commons-dev@jakarta.apache.org
> Subject: Re: [configuration] Change Commons-Configuration getVector to
> getSet?
>
>
> Emmanuel Bourg <e....@cross-systems.com> writes:
>
> >--------------ms080101070400050103080207
> >Content-Type: text/plain; charset=us-ascii; format=flowed
> >Content-Transfer-Encoding: 7bit
>
> >A Set is too restrictive i think, there are valid reasons
> for preserving
> >duplicate configuration entries. I would use a Collection or
> better, a
> >List when the element order matters.
>
> -1 on using a set
>
> -1 on deprecating getVector()
>
> +1 on using a Collection
>
> +1 on getCollection()
>
> I have use cases, where I need repeating keys in the sequence that was
> put into the configuration file
>
> - sequence:  list org service.<xxxx> keys in turbine.properties
>
> - repeating keys: list of packages to search for an action/screen
>                   in turbine.properties (here I need the
> exact sequence, too)
>
> So changing this API to use a set without order would damage the
> current Turbine code (which might be one of the main users of
> commons-configuration).
>
> 	Regards
> 		Henning
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>
> Java, perl, Solaris, Linux, xSP Consulting, Web Services
> freelance consultant -- Jakarta Turbine Development  -- hero for hire
>
> "Dominate!! Dominate!! Eat your young and aggregate! I have
> grotty silicon!"
>       -- AOL CD when played backwards  (User Friendly - 200-10-15)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


RE: [configuration] Change Commons-Configuration getVector to getSet?

Posted by Eric Pugh <ep...@upstate.com>.
Is getCollection what is wanted, or getList()?

I was under the impression that a collection isn't ordered..  And then you
would have to cast to a List to pass the collection into anything that
expects an ordered list.

Eric

> -----Original Message-----
> From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
> Sent: Thursday, September 25, 2003 10:02 AM
> To: commons-dev@jakarta.apache.org
> Subject: Re: [configuration] Change Commons-Configuration getVector to
> getSet?
>
>
> Emmanuel Bourg <e....@cross-systems.com> writes:
>
> >--------------ms080101070400050103080207
> >Content-Type: text/plain; charset=us-ascii; format=flowed
> >Content-Transfer-Encoding: 7bit
>
> >A Set is too restrictive i think, there are valid reasons
> for preserving
> >duplicate configuration entries. I would use a Collection or
> better, a
> >List when the element order matters.
>
> -1 on using a set
>
> -1 on deprecating getVector()
>
> +1 on using a Collection
>
> +1 on getCollection()
>
> I have use cases, where I need repeating keys in the sequence that was
> put into the configuration file
>
> - sequence:  list org service.<xxxx> keys in turbine.properties
>
> - repeating keys: list of packages to search for an action/screen
>                   in turbine.properties (here I need the
> exact sequence, too)
>
> So changing this API to use a set without order would damage the
> current Turbine code (which might be one of the main users of
> commons-configuration).
>
> 	Regards
> 		Henning
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/
>
> Java, perl, Solaris, Linux, xSP Consulting, Web Services
> freelance consultant -- Jakarta Turbine Development  -- hero for hire
>
> "Dominate!! Dominate!! Eat your young and aggregate! I have
> grotty silicon!"
>       -- AOL CD when played backwards  (User Friendly - 200-10-15)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Emmanuel Bourg <e....@cross-systems.com> writes:

>--------------ms080101070400050103080207
>Content-Type: text/plain; charset=us-ascii; format=flowed
>Content-Transfer-Encoding: 7bit

>A Set is too restrictive i think, there are valid reasons for preserving 
>duplicate configuration entries. I would use a Collection or better, a 
>List when the element order matters.

-1 on using a set

-1 on deprecating getVector()

+1 on using a Collection

+1 on getCollection()

I have use cases, where I need repeating keys in the sequence that was
put into the configuration file

- sequence:  list org service.<xxxx> keys in turbine.properties

- repeating keys: list of packages to search for an action/screen
                  in turbine.properties (here I need the exact sequence, too)

So changing this API to use a set without order would damage the
current Turbine code (which might be one of the main users of
commons-configuration).

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Emmanuel Bourg <e....@cross-systems.com> writes:

>A Set is too restrictive i think, there are valid reasons for preserving 
>duplicate configuration entries. I would use a Collection or better, a 
>List when the element order matters.

Definitely. I have several cases where I need multiple values for a key.

I thought that Eric was talking about MODULE_PACKAGES, where a set is 
useful, but the sequence of packages must be preserved!

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Emmanuel Bourg <e....@cross-systems.com> writes:

>--------------ms080101070400050103080207
>Content-Type: text/plain; charset=us-ascii; format=flowed
>Content-Transfer-Encoding: 7bit

>A Set is too restrictive i think, there are valid reasons for preserving 
>duplicate configuration entries. I would use a Collection or better, a 
>List when the element order matters.

-1 on using a set

-1 on deprecating getVector()

+1 on using a Collection

+1 on getCollection()

I have use cases, where I need repeating keys in the sequence that was
put into the configuration file

- sequence:  list org service.<xxxx> keys in turbine.properties

- repeating keys: list of packages to search for an action/screen
                  in turbine.properties (here I need the exact sequence, too)

So changing this API to use a set without order would damage the
current Turbine code (which might be one of the main users of
commons-configuration).

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Emmanuel Bourg <e....@cross-systems.com> writes:

>A Set is too restrictive i think, there are valid reasons for preserving 
>duplicate configuration entries. I would use a Collection or better, a 
>List when the element order matters.

Definitely. I have several cases where I need multiple values for a key.

I thought that Eric was talking about MODULE_PACKAGES, where a set is 
useful, but the sequence of packages must be preserved!

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

RE: [configuration] Change Commons-Configuration getVector to getSet?

Posted by Eric Pugh <ep...@upstate.com>.
Re: [configuration] Change Commons-Configuration getVector to getSet?Out of
curiosity, what would be a usecase for multiple duplicate config entries
that are the same?  Maybe to count them or something?  So, does anyone have
an opinion on List?  I definitly can understand why the Set wouldn't work.
I suggested Set thinking order didn't matter, but you are right, it does..

I guess I just don't like the look of Vector in things...

Eric
  -----Original Message-----
  From: Emmanuel Bourg [mailto:e.bourg@cross-systems.com]
  Sent: Wednesday, September 17, 2003 2:45 PM
  To: Jakarta Commons Developers List
  Cc: 'Turbine Developers List'
  Subject: Re: [configuration] Change Commons-Configuration getVector to
getSet?


  A Set is too restrictive i think, there are valid reasons for preserving
  duplicate configuration entries. I would use a Collection or better, a
  List when the element order matters.

  Emmanuel



  Eric Pugh wrote:

  > Hi all,
  >
  > I am looking at a chunk of code like this:
  >  Vector packages = Turbine.getConfiguration()
  >                     .getVector(TurbineConstants.MODULE_PACKAGES);
  >
  >                 ObjectUtils.addOnce(packages,
  >                         GenericLoader.getBasePackage());
  >
  > from Layout Loader...
  >
  > And it seems to me that commons-configuration getVector should be
deprecated
  > in favor of getSet().  I can't think why you would want duplicate
values, so
  > getSet() makes more sense then getList().
  >
  > Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...
  >
  > Opinons?  And do we have to deprecate getVector() since we haven't
released
  > from sandbox yet?
  >
  > Eric Pugh
  >
  >
  > ---------------------------------------------------------------------
  > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
  > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
  >
  >
  >

Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by Emmanuel Bourg <e....@cross-systems.com>.
A Set is too restrictive i think, there are valid reasons for preserving 
duplicate configuration entries. I would use a Collection or better, a 
List when the element order matters.

Emmanuel


Eric Pugh wrote:

> Hi all,
> 
> I am looking at a chunk of code like this:
>  Vector packages = Turbine.getConfiguration()
>                     .getVector(TurbineConstants.MODULE_PACKAGES);
> 
>                 ObjectUtils.addOnce(packages,
>                         GenericLoader.getBasePackage());
> 
> from Layout Loader...
> 
> And it seems to me that commons-configuration getVector should be deprecated
> in favor of getSet().  I can't think why you would want duplicate values, so
> getSet() makes more sense then getList().
> 
> Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...
> 
> Opinons?  And do we have to deprecate getVector() since we haven't released
> from sandbox yet?
> 
> Eric Pugh
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 

Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by Emmanuel Bourg <e....@cross-systems.com>.
A Set is too restrictive i think, there are valid reasons for preserving 
duplicate configuration entries. I would use a Collection or better, a 
List when the element order matters.

Emmanuel


Eric Pugh wrote:

> Hi all,
> 
> I am looking at a chunk of code like this:
>  Vector packages = Turbine.getConfiguration()
>                     .getVector(TurbineConstants.MODULE_PACKAGES);
> 
>                 ObjectUtils.addOnce(packages,
>                         GenericLoader.getBasePackage());
> 
> from Layout Loader...
> 
> And it seems to me that commons-configuration getVector should be deprecated
> in favor of getSet().  I can't think why you would want duplicate values, so
> getSet() makes more sense then getList().
> 
> Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...
> 
> Opinons?  And do we have to deprecate getVector() since we haven't released
> from sandbox yet?
> 
> Eric Pugh
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 

Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Eric Pugh" <ep...@upstate.com> writes:

No. We want to keep the order of the properties and I don't know whether
getSet() does this. 

The underlying structure that uses addOnce() is rotten. This is
intended to be replaced with a
org.apache.commons.collections.decorators.OrderedSet once we have a
commons-collections release that contains this class.

	Regards
		Henning


>Hi all,

>I am looking at a chunk of code like this:
> Vector packages = Turbine.getConfiguration()
>                    .getVector(TurbineConstants.MODULE_PACKAGES);

>                ObjectUtils.addOnce(packages,
>                        GenericLoader.getBasePackage());

>from Layout Loader...

>And it seems to me that commons-configuration getVector should be deprecated
>in favor of getSet().  I can't think why you would want duplicate values, so
>getSet() makes more sense then getList().

>Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...

>Opinons?  And do we have to deprecate getVector() since we haven't released
>from sandbox yet?

>Eric Pugh


>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

Re: [configuration] Change Commons-Configuration getVector to getSet?

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Eric Pugh" <ep...@upstate.com> writes:

No. We want to keep the order of the properties and I don't know whether
getSet() does this. 

The underlying structure that uses addOnce() is rotten. This is
intended to be replaced with a
org.apache.commons.collections.decorators.OrderedSet once we have a
commons-collections release that contains this class.

	Regards
		Henning


>Hi all,

>I am looking at a chunk of code like this:
> Vector packages = Turbine.getConfiguration()
>                    .getVector(TurbineConstants.MODULE_PACKAGES);

>                ObjectUtils.addOnce(packages,
>                        GenericLoader.getBasePackage());

>from Layout Loader...

>And it seems to me that commons-configuration getVector should be deprecated
>in favor of getSet().  I can't think why you would want duplicate values, so
>getSet() makes more sense then getList().

>Then, funky call's like the ObjectUtils.addOnce() wouldn't be needed...

>Opinons?  And do we have to deprecate getVector() since we haven't released
>from sandbox yet?

>Eric Pugh


>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org