You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Mitchell <jm...@telocity.com> on 2002/09/06 17:25:10 UTC

DBMessageResources status and questions

I apologize ahead of time for my confusion/misunderstanding/stupidity ;)

As you may have read recently, I am attempting to tackle a
DBMessageResources implementation, but I am bumping into a couple of issues
related to struts design.

Status:
------
My first DBMessageResources is working fine now.  I have created the sql
scripts and code necessary to run the struts-example using a database
instead of a properties file.  The only changes were to add the class files
and change one line in the struts-config.xml.  It works fine.

Assumption:
----------
>From what I can tell, struts assumes that all MessageResources are cached in
memory.  If this were not true then there would be some way for my code to
tell what sub-app was picked.

So, if my code were to try and get data based on 1)key, 2)locale, and
3)module, there is no way for me to know #3.  This means that my
implementation must retrieve and store the data (HashMap) based on #1 and #2
which eliminates using it in any app other than the default (unless I hard
code it as part of 'parameter' in the struts-config-subapp.xml).

The dtd allows me to specify:

 <message-resources className="some.subclass.of.MessageResourcesConfig" ...
    <set-property property="subapp" value="something"/>

However, MessageResourcesConfig is neither passed on the constructor or
available through some other means, so I would have to do this...

  <message-resources
       	factory="org.apache.struts.util.DBMessageResourcesFactory"
      parameter="something.DBMessageResources"/>
                 ^^^^^^^^^

and worry about parsing it out later (ick, I hate this).


Questions:
---------
-Am I missing something here?  Is there some way to get at servletContext,
 ApplicationConfig, or even MessageResourcesConfig????


Future:
------
I've also got plans for XMLMessageResources, but I think that I will have
the same issues with it as well.


Sorry for the long post.
I would appreciate any enlightening you can give.


James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>