Good catch, Mohammad.
I will try figureout a way to override the values from a ejb-jar.xml using
the system properties but with no special changes within the ejb-jar.xml. I
think I have an idea... let me see... thats going to be fun... :O)
tkx a lot,
Thiago.

On Thu, Oct 28, 2010 at 5:49 AM, Mohammad Nour El-Din <
nour.moham...@gmail.com> wrote:

> Hi Thiago...
>
>   Brilliant idea :), but the problem is that will make the
> ejb-jar.xml not compliant with the stds, and hence if you wanted to
> use the same ejb-jar with some other AppSrvr/Cntnr you will have to
> modify it which breaks the very basic concept of having a standard DD.
> But this should be done from the OEJB side, like the property to
> specify which DP to use or any other mechanism provided or can be
> provided by OEJB.
>
> On Wed, Oct 27, 2010 at 5:24 PM, Thiago Veronezi <thi...@veronezi.org>
> wrote:
> > Devs,
> >
> > A friend of mine just faced a configuration issue with openejb. He has
> > multiple clients (companies) and each client should use a custom
> > "ejb-jar.xml" with specific configuration values (some MDB
> configurations).
> > My advice to him was to create the ejb jar with multiples "ejb-jar.xml"
> and
> > then to use the "openejb.altdd.prefix" property to specify the file to be
> > used.
> >
> > I had an idea to make it more configurable, but I need your advice. What
> do
> > you think if we add a property like "*openejb.altdd.replace.<numeric
> value>*
> > "?
> > Imagine an ejb-jar.xml file like:
> >
> > <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"; version="3.0"
> > metadata-complete="false">
> >  <enterprise-beans>
> >    <session>
> >      <ejb-name>MessageReaderImpl</ejb-name>
> >      <env-entry>
> >        <description>email user</description>
> >
> >
>  
> <env-entry-name>embedded.applicationejb.ejb.service.impl.message.MessageReaderImpl/user</env-entry-name>
> >        <env-entry-type>java.lang.String</env-entry-type>
> >        <env-entry-value>*{0}*</env-entry-value>
> >      </env-entry>
> >      <env-entry>
> >        <description>email password</description>
> >
> >
>  
> <env-entry-name>embedded.applicationejb.ejb.service.impl.message.MessageReaderImpl/password</env-entry-name>
> >        <env-entry-type>java.lang.String</env-entry-type>
> >        <env-entry-value>*{1}*</env-entry-value>
> >      </env-entry>
> >    </session>
> >  </enterprise-beans>
> > </ejb-jar>
> >
> > We could replace the values {0} and {1} by system properties like...
> > *openejb.altdd.replace.**0*=myUser
> > *openejb.altdd.replace.1*=aReallyGoodPassword
> >
> > This should be done when the system is reading the ejb-jar.xml file
> (Using
> > the MessageFormat utility class).
> > Here:
> >
> ***************************************************************************************************
> >
> /openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
> >
> >    public static EjbJar readEjbJar(URL url) throws OpenEJBException {
> >        try {
> >            if (isEmpty(url, "ejb-jar")) return new EjbJar();
> >            return (EjbJar) JaxbJavaee.unmarshal(EjbJar.class,
> > url.openStream());
> >        } catch (SAXException e) {
> >            throw new OpenEJBException("Cannot parse the ejb-jar.xml file:
> "
> > + url.toExternalForm(), e);
> >        } catch (JAXBException e) {
> >            throw new OpenEJBException("Cannot unmarshall the ejb-jar.xml
> > file: " + url.toExternalForm(), e);
> >        } catch (IOException e) {
> >            throw new OpenEJBException("Cannot read the ejb-jar.xml file:
> "
> > + url.toExternalForm(), e);
> >        } catch (Exception e) {
> >            throw new OpenEJBException("Encountered unknown error parsing
> > the ejb-jar.xml file: " + url.toExternalForm(), e);
> >        }
> >    }
> >
> ***************************************************************************************************
> >
> > What do you think?
> >
> > thanks,
> > Thiago.
> >
>
>
>
> --
> Thanks
> - Mohammad Nour
>   Author of (WebSphere Application Server Community Edition 2.0 User Guide)
>   http://www.redbooks.ibm.com/abstracts/sg247585.html
> - LinkedIn: http://www.linkedin.com/in/mnour
> - Blog: http://tadabborat.blogspot.com
> ----
> "Life is like riding a bicycle. To keep your balance you must keep moving"
> - Albert Einstein
>
> "Writing clean code is what you must do in order to call yourself a
> professional. There is no reasonable excuse for doing anything less
> than your best."
> - Clean Code: A Handbook of Agile Software Craftsmanship
>
> "Stay hungry, stay foolish."
> - Steve Jobs
>

Reply via email to