You'll probably want to write a Struts plug-in.  There's not much to it... Add an 
entry to your struts-config.xml file, something like so:

<plug-in className="com.company.app.plugins.AppInit" />

And then write a class along these lines:

package com.company.app.plugins;
public class AppInit implements PlugIn {
  public void init(ActionServlet servlet, ModuleConfig config) throws ServletException 
{
    // Do your work here
  }
  public void destroy() {
  }
}

What you actually do in init() is completely up to you (destroy doesn't have to do 
anything, but IIRC you have to implement it).  I know for me when I've done things 
like what you describe, such as reading in a config file as I do in one particular 
app, I simply have a class called AppConfig with a single static HashMap in it where I 
put the config values parsed from my XML at startup.  Simplistic, but it gets the job 
done.  There's no rules though, it's up to you.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Fri, October 29, 2004 1:47 pm, CRANFORD, CHRIS said:
> I want to have a particular XML file read from my struts application at
> startup and be cached so that it does not have to be read from disk each
> time my menu permissions adapter needs to determine access information.
> 
> How would I go about coding something like this?
> 
> _______________________________________________________
> Chris Cranford
> Programmer/Developer
> SETECH Inc. & Companies
> 6302 Fairview Rd, Suite 201
> Charlotte, NC  28210
> Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042
> Email: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to