On Nov 4, 2008, at 9:30 AM, cgreco16 wrote:


I'm writing a web application and I need to allow the deployer/ administrator
to customize values in the deployment descriptor.  I'm trying to use
<env-entry> elements in the deployment descriptor to do this. The JavaEE 5 spec says on page 71 "If the Application Component Provider provides a value for an environment entry using the env-entry-value element, the value can be
changed later by the Application Assembler or Deployer."

I've always found this statement incomprehensible. AFAICT it means that you can fire up emacs or vi and edit web.xml and sun won't send the ee police after you.

 However, I don't
see how to change these values when deploying an app with Geronimo.
Geronimo appears to have modified my web.xml file, removing the env- entry elements, and used them to create a serialized config object that I can't
change.

The geronimo-web.xml schema does not appear to have anything for this
purpose either.

Unfortunately we don't have a way to override the env-entry values in the geronimo plan. I think someone said they were working on this recently...

I think if you use the car-maven-plugin to "pre-deploy" your app as a geronimo plugin you could use maven to do property substitution in your web.xml.

Another strategy that might work for you -- although it does seem a bit ugly to me -- is to use system properties for the customizable values. We have a SystemPropertiesGBean that can set properties for you. You can override the properties setting in config.xml and include ${varName} substitutions in the override and supply the values for the variables in var/config/config-substitutions.properties. This is easiest to set up if you deploy the system props gbean in a geronimo plugin, either standalone or in the geronimo plan for your app.

in the plan....

    <gbean name="MySystemProperties"
class="org.apache.geronimo.system.properties.SystemProperties">
         <attribute name="systemProperties">
         </attribute>
    </gbean>

in config.xml in the module for your plugin or app...

    <gbean name="MySystemProperties">
         <attribute name="systemProperties">
com.me.prop1=${prop1}
com.me.prop2=${prop2}
         </attribute>
    </gbean>

in var/config/config-substitutions.properties

prop1=value1
prop2=value2

You can arrange for this to get installed with your app using a geronimo-plugin.xml file, which is most easily generated by the car- maven-plugin.

thanks
david jencks




Any help is appreciated.
cgreco16
--
View this message in context: 
http://www.nabble.com/Customizing-deployment-descriptor-values-at-deployment-time--tp20324570s134p20324570.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to