You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/11/30 12:43:25 UTC

DO NOT REPLY [Bug 37714] New: - [resources] ResourcesFactory API changes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37714>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37714

           Summary: [resources] ResourcesFactory API changes
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Resources
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: niallp@apache.org


The Commons Resources's ResourcesFactory is pretty much the same as the Struts 
MessageResourcesFactory that it was derived from. Working with Struts 
MessageResourcesFactory I've come to the conclusion that there is an inherent 
weaknesses/inelegance in the way that its factory method only allows one String 
parameter and that the "returnNull" configuration property has to be duplicated 
in both the Resources and ResourcesFactory API. A good example of this is the 
JDBCResources implementation, which has resorted to reading in a separate 
properties file containing its configuration parameters.

I would like to propose removing the "returnNull" property from 
ResourcesFactory and changing the current factory method from...

  public Resources getResources(String name, String config) 

to

  public Resources getResources(String name, ResourcesConfig config)

and adding a new ResourcesConfig interface with the following definition:

  public interface ResourcesConfig extends Serializable {

      public boolean isReturnNull()
      public void setReturnNull(boolean returnNull)

      public String getBaseUrl()
      public void setBaseURL(String url)

      public String getProperty(String property)
      public void setProperty(String property, String value)
      public String[] getPropertyNames()
      
  }

Also change the Resources API to remove the setReturnNull()/getReturnNull() 
methods and add setConfig()/getConfig() methods.

These changes would allow something like the JDBCResources implementation to 
either have a customized ResourceConfig implementation - or use the generice 
set/getProperty() methods for its configuration rather than having to use a 
separate properties configuration file. It also means that returnNull would not 
have to be duplicated.

The ResourcesFactory getResources() method would create the Resources object 
and simply call the setConfig() method and then the init() method and it would 
be done.

Marking this as "blocker" because I think it needs to be decided one way or the 
other before Resources 1.0.0 is released.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org