You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2013/09/10 22:19:51 UTC

[jira] [Commented] (CONFIGURATION-553) Support custom search strategies for configuration files

    [ https://issues.apache.org/jira/browse/CONFIGURATION-553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13763446#comment-13763446 ] 

Oliver Heger commented on CONFIGURATION-553:
--------------------------------------------

The {{FileSystem}} class provides the methods {{locateFromURL()}} and {{getInputStream(String, String)}}. Both perform a search of the referenced file based on the standard {{locate()}} method.

>From a logic point of view, the latter is just a convenience method of the former: first the URL is determined, then a stream is opened from it. However, in {{VFSFileSystem}}, there is a separate implementation of {{getInputStream()}} which seems to be pretty redundant to the code in {{locateFromURL()}}.

This {{getInputStream()}} method is called only from a single place: {{CatalogResolver.resolveEntity()}}. In the same file for a very similar use case the "official" {{locate()}} method of {{FileLocatorUtils}} is called (which under the hood delegates to {{locateFromURL()}}). I am going to unify this. Then {{getInputStream()}} is no longer used and can be removed from the interface.
                
> Support custom search strategies for configuration files
> --------------------------------------------------------
>
>                 Key: CONFIGURATION-553
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-553
>             Project: Commons Configuration
>          Issue Type: Improvement
>    Affects Versions: 1.9
>            Reporter: Oliver Heger
>             Fix For: 2.0
>
>
> Via the {{FileSystem}} class it is already possible to influence locating and loading of configuration files. However, the API is quite complex, and it is not obvious which methods to override.
> It would be easier to have a specialized interface for a locator strategy. This would make the implementation of custom search strategies straight-forward. A default implementation of this interface can be provided which implements the currently used search algorithm (which is currently hard-coded in {{ConfigurationUtils}}).
> In general, there is room for improvements in the file system implementations. For instance, functionality seems to be partly implemented in {{ConfigurationUtils}} and partly in {{DefaultFileSystem}}. I would like to remove the code related to the localization of configuration files from {{ConfigurationUtils}} and create a specialized utility class in the {{io}} package.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira