You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Anil Chawla <ac...@us.ibm.com> on 2010/08/25 17:35:05 UTC

Substitution variables in gbean attribute value


Hi,
Is there a way to use substitution variables when defining gbeans in
geronimo-web.xml? For example, I would like to define a SharedLib for our
application with an APP_HOME variable that points to the actual location of
files on the user's filesystem:

  <gbean name="SharedLib"
class="org.apache.geronimo.system.sharedlib.SharedLib">
       <attribute name="libDirs">${APP_HOME}/lib</attribute>
        <attribute name="classesDirs">${APP_HOME}/conf</attribute>
        <reference name="ServerInfo">
            <name>ServerInfo</name>
        </reference>
  </gbean>

I've tried setting an APP_HOME environment variable as well as passing
APP_HOME as a Java system property. I even tried
org.apache.geronimo.config.substitution.APP_HOME but that seems to be
specific to config.xml.

Thanks,

Anil Chawla

Re: Substitution variables in gbean attribute value

Posted by Ivan <xh...@gmail.com>.
Create a Geronimo plugin should be the best way to do it, or you might
extend the Sharelib gbean, so that you could do anything you like :-)

2010/8/26 Kevan Miller <ke...@gmail.com>

>
> On Aug 25, 2010, at 12:50 PM, David Jencks wrote:
>
> >
> > On Aug 25, 2010, at 9:10 AM, Anil Chawla wrote:
> >
> >> Ivan, thanks for the prompt response. Our intention is to provide our
> users with a WAR/EAR file and perhaps a simple startup script that they can
> edit to set the correct environment variables for their environment. It is
> good to know that there is a work-around like this but it might be a little
> too complicated for our users.
> >>
> >
> > If you are willing to distribute your app as a "predeployed" geronimo
> plugin rather than an app that must be deployed on each server, you can
> include this config.xml info in the plugin.  The easy way is to use a maven
> project and the car-maven-plugin to package your app as a plugin.  The
> geronimo build has lots and lots of examples of how to set up the config.xml
> bits and default values for config-substitutions.properties such as the
> plugins/tomcat/tomcat subproject.
>
> Right. To summarize, deploying as a geronimo plugin could simplify things
> to the point that a user would only need to modify a
> config-substitutions.properties property (or you provide a tool to do this
> or you allow the plugin deployment plan to be customized, prior to
> installation within the geronimo server.
>
> --kevan
>



-- 
Ivan

Re: Substitution variables in gbean attribute value

Posted by Kevan Miller <ke...@gmail.com>.
On Aug 25, 2010, at 12:50 PM, David Jencks wrote:

> 
> On Aug 25, 2010, at 9:10 AM, Anil Chawla wrote:
> 
>> Ivan, thanks for the prompt response. Our intention is to provide our users with a WAR/EAR file and perhaps a simple startup script that they can edit to set the correct environment variables for their environment. It is good to know that there is a work-around like this but it might be a little too complicated for our users.
>> 
> 
> If you are willing to distribute your app as a "predeployed" geronimo plugin rather than an app that must be deployed on each server, you can include this config.xml info in the plugin.  The easy way is to use a maven project and the car-maven-plugin to package your app as a plugin.  The geronimo build has lots and lots of examples of how to set up the config.xml bits and default values for config-substitutions.properties such as the plugins/tomcat/tomcat subproject.

Right. To summarize, deploying as a geronimo plugin could simplify things to the point that a user would only need to modify a config-substitutions.properties property (or you provide a tool to do this or you allow the plugin deployment plan to be customized, prior to installation within the geronimo server.

--kevan

Re: Substitution variables in gbean attribute value

Posted by David Jencks <da...@yahoo.com>.
On Aug 25, 2010, at 9:10 AM, Anil Chawla wrote:

> Ivan, thanks for the prompt response. Our intention is to provide our users with a WAR/EAR file and perhaps a simple startup script that they can edit to set the correct environment variables for their environment. It is good to know that there is a work-around like this but it might be a little too complicated for our users.
> 

If you are willing to distribute your app as a "predeployed" geronimo plugin rather than an app that must be deployed on each server, you can include this config.xml info in the plugin.  The easy way is to use a maven project and the car-maven-plugin to package your app as a plugin.  The geronimo build has lots and lots of examples of how to set up the config.xml bits and default values for config-substitutions.properties such as the plugins/tomcat/tomcat subproject.
> 
> Is there any other option for configuring external folders in our classpath without putting a fixed path in geronimo-web.xml? For example, is there an easy way to append to the classpath of the server when running geronimo.sh? If so, we can just ask our users to set APP_HOME as an environment variable and provide a startup script that runs gernonimo.sh with the right parameters.
> 

that won't work, sorry.

thanks
david jencks

> 
> Thanks,
> 
> Anil Chawla
> 
> 
> <graycol.gif>Ivan ---08/25/2010 11:46:15 AM---You could NOT use the substitution directly in geronimo-web.xml, but you might try a workaround solu
> 
> <ecblank.gif>
> From:	<ecblank.gif>
> Ivan <xh...@gmail.com>
> <ecblank.gif>
> To:	<ecblank.gif>
> user@geronimo.apache.org
> <ecblank.gif>
> Date:	<ecblank.gif>
> 08/25/2010 11:46 AM
> <ecblank.gif>
> Subject:	<ecblank.gif>
> Re: Substitution variables in gbean attribute value
> 
> 
> 
> You could NOT use the substitution directly in geronimo-web.xml, but you might try a workaround solution below, it should work :-)
> 
> a. After deploying your application into the server, then stop the server. 
> b. Open the var/config/config.xml, and find the segment for your application.
> c. Let's take the SharedLib as an example, add a xml fragment like :
>     <gbean name="SharedLib">
>         <attribute name="libDirs">${APP_HOME}/lib</attribute>
> <attribute name="classesDirs">${APP_HOME}/conf</attribute>
> 
>     </gbean>
> d. add the APP_HOME and its real value in the var/config/config-substitutions.properties
> e. Start the server, now it should use the value configured in the config-substitutions.properties.
> 
> 2010/8/25 Anil Chawla <ac...@us.ibm.com>
> 
> Hi,
> Is there a way to use substitution variables when defining gbeans in geronimo-web.xml? For example, I would like to define a SharedLib for our application with an APP_HOME variable that points to the actual location of files on the user's filesystem:
> 
> <gbean name="SharedLib" class="org.apache.geronimo.system.sharedlib.SharedLib">
> <attribute name="libDirs">${APP_HOME}/lib</attribute>
> <attribute name="classesDirs">${APP_HOME}/conf</attribute>
> <reference name="ServerInfo">
> <name>ServerInfo</name>
> </reference>
> </gbean>
> 
> I've tried setting an APP_HOME environment variable as well as passing APP_HOME as a Java system property. I even tried org.apache.geronimo.config.substitution.APP_HOME but that seems to be specific to config.xml.
> 
> Thanks,
> 
> Anil Chawla
> 
> 
> 
> 
> -- 
> Ivan
> 


Re: Substitution variables in gbean attribute value

Posted by Anil Chawla <ac...@us.ibm.com>.
Ivan, thanks for the prompt response. Our intention is to provide our users
with a WAR/EAR file and perhaps a simple startup script that they can edit
to set the correct environment variables for their environment. It is good
to know that there is a work-around like this but it might be a little too
complicated for our users.

Is there any other option for configuring external folders in our classpath
without putting a fixed path in geronimo-web.xml? For example, is there an
easy way to append to the classpath of the server when running geronimo.sh?
If so, we can just ask our users to set APP_HOME as an environment variable
and provide a startup script that runs gernonimo.sh with the right
parameters.

Thanks,

Anil Chawla



|------------>
| From:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Ivan <xh...@gmail.com>                                                                                                                 |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |user@geronimo.apache.org                                                                                                                |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |08/25/2010 11:46 AM                                                                                                                     |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Re: Substitution variables in gbean attribute value                                                                                     |
  >----------------------------------------------------------------------------------------------------------------------------------------|





You could NOT use the substitution directly in geronimo-web.xml, but you
might try a workaround solution below, it should work :-)

a. After deploying your application into the server, then stop the server.
b. Open the var/config/config.xml, and find the segment for your
application.
c. Let's take the SharedLib as an example, add a xml fragment like :
    <gbean name="SharedLib">
        <attribute name="libDirs">${APP_HOME}/lib</attribute>


<attribute name="classesDirs">${APP_HOME}/conf</attribute>


    </gbean>
d. add the APP_HOME and its real value in the
var/config/config-substitutions.properties
e. Start the server, now it should use the value configured in the
config-substitutions.properties.

2010/8/25 Anil Chawla <ac...@us.ibm.com>
  Hi,
  Is there a way to use substitution variables when defining gbeans in
  geronimo-web.xml? For example, I would like to define a SharedLib for our
  application with an APP_HOME variable that points to the actual location
  of files on the user's filesystem:

  <gbean name="SharedLib"
  class="org.apache.geronimo.system.sharedlib.SharedLib">
  <attribute name="libDirs">${APP_HOME}/lib</attribute>
  <attribute name="classesDirs">${APP_HOME}/conf</attribute>
  <reference name="ServerInfo">
  <name>ServerInfo</name>
  </reference>
  </gbean>

  I've tried setting an APP_HOME environment variable as well as passing
  APP_HOME as a Java system property. I even tried
  org.apache.geronimo.config.substitution.APP_HOME but that seems to be
  specific to config.xml.

  Thanks,

  Anil Chawla





--
Ivan


Re: Substitution variables in gbean attribute value

Posted by Ivan <xh...@gmail.com>.
You could NOT use the substitution directly in geronimo-web.xml, but you
might try a workaround solution below, it should work :-)

a. After deploying your application into the server, then stop the server.
b. Open the var/config/config.xml, and find the segment for your
application.
c. Let's take the SharedLib as an example, add a xml fragment like :
    <gbean name="SharedLib">
        <attribute name="libDirs">${APP_HOME}/lib</attribute>

<attribute name="classesDirs">${APP_HOME}/conf</attribute>
    </gbean>
d. add the APP_HOME and its real value in the
var/config/config-substitutions.properties
e. Start the server, now it should use the value configured in the
config-substitutions.properties.

2010/8/25 Anil Chawla <ac...@us.ibm.com>

> Hi,
> Is there a way to use substitution variables when defining gbeans in
> geronimo-web.xml? For example, I would like to define a SharedLib for our
> application with an APP_HOME variable that points to the actual location of
> files on the user's filesystem:
>
> <gbean name="SharedLib"
> class="org.apache.geronimo.system.sharedlib.SharedLib">
> <attribute name="libDirs">${APP_HOME}/lib</attribute>
> <attribute name="classesDirs">${APP_HOME}/conf</attribute>
> <reference name="ServerInfo">
> <name>ServerInfo</name>
> </reference>
> </gbean>
>
> I've tried setting an APP_HOME environment variable as well as passing
> APP_HOME as a Java system property. I even tried
> org.apache.geronimo.config.substitution.APP_HOME but that seems to be
> specific to config.xml.
>
> Thanks,
>
> Anil Chawla
>



-- 
Ivan