geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Kirby" <ted.ki...@gmail.com>
Subject Re: How to configure port and smtp host in openejb-jar.xml at installation.
Date Sat, 10 Feb 2007 17:50:17 GMT
On 2/9/07, Geronimo User <geronimouser@gmail.com> wrote:
> Hi:
>
> We have an MDB EJB in an EJB .jar inside an .ear.
>
> The MDB sends Java mail.
>
> When the application's .ear is installed, the customer must supply the
> name of the SMTP host and port for the MDB to use.
>
> Currently the host and port are hard-coded in the MDB's
> openejb-jar.xml, which follows.
>
> What is the best way to change this to enable the app to use the
> values the customer chooses when the app is installed, instead of the
> hard-coded values?

One way is to update config.xml, but only when the server is not
running.  Some GBeans have custom edit screens in the admin console,
that allow values to be changed and saved dynamically into config.xml
by geronimo.  You could provide a custom edit screen, or use another
way to invoke this mechanism.

Ted Kirby

> Thanks.
>
> sendEmail<?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
>         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
>         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
>
>         <sys:environment>
>                 <sys:moduleId>
>                         <sys:groupId>com.company</sys:groupId>
>                         <sys:artifactId>app-mailservice-2.9.jar</sys:artifactId>
>                         <sys:version>2.9</sys:version>
>                 </sys:moduleId>
>                 <sys:dependencies>
>
>                         <sys:dependency>
>                                 <sys:groupId>geronimo</sys:groupId>
>                                 <sys:artifactId>activemq</sys:artifactId>
>                                 <sys:version>1.1.1</sys:version>
>                                 <sys:type>car</sys:type>
>                         </sys:dependency>
>                         <sys:dependency>
>                                 <sys:groupId>geronimo</sys:groupId>
>                                 <sys:artifactId>activemq-broker</sys:artifactId>
>                                 <sys:version>1.1.1</sys:version>
>                                 <sys:type>car</sys:type>
>                         </sys:dependency>
>                         <sys:dependency>
>                                 <sys:groupId>org.apache.geronimo.specs</sys:groupId>
>                                 <sys:artifactId>geronimo-javamail_1.3.1_spec</sys:artifactId>
>                                 <sys:version>1.1</sys:version>
>                         </sys:dependency>
>                         <sys:dependency>
>                                 <sys:groupId>geronimo</sys:groupId>
>                                 <sys:artifactId>geronimo-mail</sys:artifactId>
>                                 <sys:version>1.1.1</sys:version>
>                         </sys:dependency>
>                         <sys:dependency>
>                                 <sys:groupId>geronimo</sys:groupId>
>                                 <sys:artifactId>geronimo-javamail-transport</sys:artifactId>
>                                 <sys:version>1.1.1</sys:version>
>                         </sys:dependency>
>                 </sys:dependencies>
>         </sys:environment>
>
>         <enterprise-beans>
>                 <message-driven>
>                         <ejb-name>MailMDBean</ejb-name>
>                         <resource-adapter>
>                                 <resource-link>ActiveMQ RA</resource-link>
>                         </resource-adapter>
>                         <activation-config>
>                                 <activation-config-property>
>                                         <activation-config-property-name>destination</activation-config-property-name>
>                                         <activation-config-property-value>SendReceiveQueue</activation-config-property-value>
>                                 </activation-config-property>
>                         </activation-config>
>                         <resource-ref>
>                                 <ref-name>mail/MailSession</ref-name>
>                                 <resource-link>CompanyMailGBean</resource-link>
>                         </resource-ref>
>                 </message-driven>
>         </enterprise-beans>
>
>         <gbean name="CompanySMTPTransportGBean"
> class="org.apache.geronimo.mail.SMTPTransportGBean">
>                 <attribute name="port">25</attribute>
>         </gbean>
>
>         <gbean name="CompanyMailGBean" class="org.apache.geronimo.mail.MailGBean">
>                 <attribute name="debug">false</attribute>
>                 <attribute name="useDefault">false</attribute>
>                 <attribute name="host">smtp.host.name</attribute>
>                 <attribute name="transportProtocol">smtp</attribute>
>                 <reference name="Protocols">
>                         <name>CompanySMTPTransportGBean</name>
>                 </reference>
>         </gbean>
>
> </openejb-jar>
>

Mime
View raw message