You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Dain Sundstrom <da...@iq80.com> on 2005/11/29 19:19:25 UTC
Proposed GBeanInfo xml format
I'm working on the ability to declare new GBeans in the config.xml,
and to do this we need new an xml format for the GBeanInfo. Here is
what I came up with:
<?xml version="1.0" encoding="UTF-8"?>
<attributes>
<configuration name="Menu">
<gbean name="PizzaService">
<info name="pizza" className="o.a.g.food.PizzaService"
j2eeType="Pizza">
<constructor>
<attribute name="cheese"/>
</constructor>
<attribute name="cheese"
type="java.lang.String"
persistent="true"
manageable="true"
readable="true"
writable="true"
getterName="getCheese"
setterName="setCheese"
/>
<operation name="cook" signature="cook(int,
java.lang.String)"/>
<reference name="oven"
referenceType="java.lang.Collection"
proxyType="o.a.g.kitchen.Oven"
setterName="setOven"
nameTypeName="Oven"/>
<interface type="o.a.g.food.Yummie"/>
</info>
<attribute name="cheese">mozzarella</attribute>
<reference name="oven">*:type=gas,*</reference>
</gbean>
</configuration>
</attributes>
This is the full xml, but I'll write the code to not write xml
attributes that represent default values, such as the operation name
equaling the method name.
The other thing to note is we will need to set reference values for
new gbeans, and there an example of that at the bottom of the xml.
What do you think?
-dain
Re: Proposed GBeanInfo xml format
Posted by Dain Sundstrom <da...@iq80.com>.
I went out for lunch and while waiting for my food, it occurred to me
that I'm making this way harder than it needs to be.
If we simply make the compromise that, dynamically added GBeans must
have a GBeanInfo retrieved from:
GBeanInfo.getGBeanInfo(className, classLoader)
we will not need to an xml format for the GBeanInfo at all. With
that small change, the xml will boil down to this:
<attributes>
<configuration name="Menu">
<gbean name="PizzaService" gbeanInfo="o.a.g.food.PizzaService">
<attribute name="cheese">mozzarella</attribute>
<reference name="oven">*:type=gas,*</reference>
</gbean>
</configuration>
</attributes>
The new additions are the gbeanInfo attribute on gbean which
signifies a new gbean in a configuration, and the reference element
for new gbeans.
To make this change I will need to change the following method:
EditableConfigurationManagerImpl.addGBeanToConfiguration(URI
configID, GBeanData gbean, boolean start)
to
EditableConfigurationManagerImpl.addGBeanToConfiguration(URI
configID, String className, GBeanData gbean, boolean start)
What do you think?
-dain
On Nov 29, 2005, at 10:19 AM, Dain Sundstrom wrote:
> I'm working on the ability to declare new GBeans in the config.xml,
> and to do this we need new an xml format for the GBeanInfo. Here
> is what I came up with:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <attributes>
> <configuration name="Menu">
> <gbean name="PizzaService">
> <info name="pizza" className="o.a.g.food.PizzaService"
> j2eeType="Pizza">
> <constructor>
> <attribute name="cheese"/>
> </constructor>
>
> <attribute name="cheese"
> type="java.lang.String"
> persistent="true"
> manageable="true"
> readable="true"
> writable="true"
> getterName="getCheese"
> setterName="setCheese"
> />
>
> <operation name="cook" signature="cook(int,
> java.lang.String)"/>
>
> <reference name="oven"
> referenceType="java.lang.Collection"
> proxyType="o.a.g.kitchen.Oven"
> setterName="setOven"
> nameTypeName="Oven"/>
>
> <interface type="o.a.g.food.Yummie"/>
>
> </info>
> <attribute name="cheese">mozzarella</attribute>
> <reference name="oven">*:type=gas,*</reference>
> </gbean>
> </configuration>
> </attributes>
>
> This is the full xml, but I'll write the code to not write xml
> attributes that represent default values, such as the operation
> name equaling the method name.
>
> The other thing to note is we will need to set reference values for
> new gbeans, and there an example of that at the bottom of the xml.
>
> What do you think?
>
> -dain