You are viewing a plain text version of this content. The canonical link for it is here.
Posted to phoenix-dev@avalon.apache.org by Juozas Baliuka <ba...@centras.lt> on 2002/05/11 13:46:36 UTC

Configurable

Hi,
Is it possible to configure Block without Configurable implementation.
My configuration attributes are dynamic (not known at codding time ) and I am going to implement  "configure" this way:

  configuration = configuration.getChild("class");

  Object instance = Class.forName( configuration.getAttribute("name"),true,loader )
                                                                                .newInstance();

Configuration[]   properties = configuration.getChildren();

 for (int i = 0; i <= properties.length; i++  ){

  // use intospection and reflection to set properties
  ........................................................... 

 }

Doe's some phoenix service can do this for me ?
It is very usual and don't want to reinvent this way of configuration.











Re: Configurable

Posted by Juozas Baliuka <ba...@mail.lt>.
Hi,
I reinvented some class for configuration, may be it will be interesting for
anybody.
----- Original Message -----
From: "Peter Donald" <pe...@apache.org>
To: "Avalon-Phoenix Developers List" <av...@jakarta.apache.org>
Sent: Sunday, May 12, 2002 3:39 AM
Subject: Re: Configurable


On Sat, 11 May 2002 21:46, Juozas Baliuka wrote:
> Is it possible to configure Block without Configurable implementation.
> My configuration attributes are dynamic (not known at codding time ) and I
> am going to implement  "configure" this way:
>
>   configuration = configuration.getChild("class");
>
>   Object instance = Class.forName(
> configuration.getAttribute("name"),true,loader ) .newInstance();
>
> Configuration[]   properties = configuration.getChildren();
>
>  for (int i = 0; i <= properties.length; i++  ){
>
>   // use intospection and reflection to set properties
>   ...........................................................
>
>  }
>
> Doe's some phoenix service can do this for me ?
> It is very usual and don't want to reinvent this way of configuration.

Theres no phoenix I know of that does this but there is something similar in
the ant project. Check out the jakarta-ant-myrmidon CVS and have a look at
the classes

container/src/java/org/apache/myrmidon/components/configurer/ClassicConfigur
er.java
container/src/java/org/apache/myrmidon/interfaces/configurer/Configurer.java

Which do what you want to do I believe. They basically use the "ant1.x"
patterns to map Configuration object onto an object.

--
Cheers,

Peter Donald


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


Re: Configurable

Posted by Peter Donald <pe...@apache.org>.
On Sat, 11 May 2002 21:46, Juozas Baliuka wrote:
> Is it possible to configure Block without Configurable implementation.
> My configuration attributes are dynamic (not known at codding time ) and I
> am going to implement  "configure" this way:
>
>   configuration = configuration.getChild("class");
>
>   Object instance = Class.forName(
> configuration.getAttribute("name"),true,loader ) .newInstance();
>
> Configuration[]   properties = configuration.getChildren();
>
>  for (int i = 0; i <= properties.length; i++  ){
>
>   // use intospection and reflection to set properties
>   ...........................................................
>
>  }
>
> Doe's some phoenix service can do this for me ?
> It is very usual and don't want to reinvent this way of configuration.

Theres no phoenix I know of that does this but there is something similar in 
the ant project. Check out the jakarta-ant-myrmidon CVS and have a look at 
the classes
 
container/src/java/org/apache/myrmidon/components/configurer/ClassicConfigurer.java
container/src/java/org/apache/myrmidon/interfaces/configurer/Configurer.java

Which do what you want to do I believe. They basically use the "ant1.x" 
patterns to map Configuration object onto an object.

-- 
Cheers,

Peter Donald


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>