> we have own tables that holds locations, resources and messages,
> I have a persistent class that gets all data from database.
> I need is a class that extends the class that reads messages
> from properties files, override the method that reads from disk file,

You need 2 classes minimum.

public class MyMessageResourcesFactory extends MessageResourcesFactory {
    public MessageResources createResources(String config) {
        return new MyMessageResources(this, config, this.returnNull);
    }
}

public class MyMessageResources extends MessageResources
        implements Serializable {
    public MyMessageResources(MessageResourcesFactory factory, String
config) {
        this(factory, config, false);
    }
    public MyMessageResources(MessageResourcesFactory factory, String
config, boolean returnNull) {
        super(factory, config, returnNull);
    }

    public String getMessage(Locale locale, String key) {
       //call your DAO here
    }
}

You would tell Struts to use your implementation by configuring it in the
struts-config:

  <message-resources
factory="com.company.project.whatever.MyMessageResourcesFactory"
                   parameter="{whatever you put here is passed to the
factory as 'config'}">
  </message-resources>


My hack for supporting multiple keys and Modules was to use the parameter to
designate alternate keys and/or modules.

Let me know if that helps you.


--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx





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

Reply via email to