Hi Dave,
Thanks for your patch. After getting your patch, I
again studied the properties configuration. One thing
I have noticied that there is no point to create a
separate properties object. We can use a single
properties object and change the prefix in different
sub configurations. It will reduce the complexity and
the memory requirement as well.
Today I shall try to modify the properties
configuration.
Thanks,
Rana Bhattacharyya
--- Dave Roberts <[EMAIL PROTECTED]>
wrote:
> I have a need to extend the
> org.apache.ftpserver.config.PropertiesConfiguration
> class and made a
> couple of minor changes to the class to make it
> easier to do so.
>
> Firstly, most of the code within getConfiguration()
> has been moved
> into a new method getPropertySubset() which returns
> the Properties
> being searched for.
>
> Secondly, the getConfiguration() method is now
> simplified by calling
> getPropertySubset() before creating the new
> constructor.
>
> This makes the class more extendible, because
> getConfiguration() can
> be implemented in the sub-class in order to return
> the correct
> instance of the Congfiguration.
>
> I've attached a context diff from the October source
> release for
> consideration and comment.
>
> - Dave.
> > *** PropertiesConfiguration.java~ Tue Oct 25
> 11:32:52 2005
> --- PropertiesConfiguration.java Tue Dec 20
> 13:35:27 2005
> ***************
> *** 207,216 ****
> return retVal;
> }
>
> ! /**
> ! * Get sub configuration - if not found throws
> FtpException.
> ! */
> ! public Configuration getConfiguration(String
> param) throws FtpException {
> Properties prop = new Properties();
> Enumeration propNames =
> m_prop.propertyNames();
> String prefix = param + '.';
> --- 207,213 ----
> return retVal;
> }
>
> ! public Properties getPropertySubset( String
> param ) throws FtpException {
> Properties prop = new Properties();
> Enumeration propNames =
> m_prop.propertyNames();
> String prefix = param + '.';
> ***************
> *** 228,233 ****
> --- 225,238 ----
> if(prop.isEmpty()) {
> throw new FtpException("Not found : "
> + param);
> }
> + return prop;
> + }
> +
> + /**
> + * Get sub configuration - if not found throws
> FtpException.
> + */
> + public Configuration getConfiguration(String
> param) throws FtpException {
> + Properties prop = getPropertySubset( param
> );
> return new PropertiesConfiguration(prop);
> }
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com