commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CONFIGURATION-381) Support automatic reloading for configuration files in JBoss VFS
Date Fri, 19 Jun 2009 11:17:08 GMT

     [ https://issues.apache.org/jira/browse/CONFIGURATION-381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Bourg updated CONFIGURATION-381:
-----------------------------------------

    Fix Version/s: 1.7

> Support automatic reloading for configuration files in JBoss VFS
> ----------------------------------------------------------------
>
>                 Key: CONFIGURATION-381
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-381
>             Project: Commons Configuration
>          Issue Type: Improvement
>          Components: File reloading
>    Affects Versions: 1.6
>            Reporter: Panagiotis Astithas
>            Priority: Minor
>             Fix For: 1.7
>
>         Attachments: commons-configuration-vfs.patch
>
>
> Using Commons Configuration with JBoss 5 presents problems when storing files in the
JBoss directories and referencing them with relative paths. This applies to configuration
files stored in the traditional spot for JBoss configuration, like JBOSS_HOME/server/default/conf/.
More specifically, when FileChangedReloadingStrategy tries to resolve the file path it gets
a vfsfile: URL from the JBoss-modified context classloader, that it can't parse. The following
patch adds support for this URL scheme by fixing the resource URL to avoid VFS, and allows
Commons Configuration to properly recognize file modifications in the file system.
> {code:title=FileChangedReloadingStrategy.java|borderStyle=solid}
> Index: FileChangedReloadingStrategy.java
> ===================================================================
> --- FileChangedReloadingStrategy.java	(revision 764760)
> +++ FileChangedReloadingStrategy.java	(working copy)
> @@ -46,6 +46,9 @@
>      /** Constant for the jar URL protocol.*/
>      private static final String JAR_PROTOCOL = "jar";
>  
> +    /** Constant for the JBoss MC VFSFile URL protocol.*/
> +    private static final String VFSFILE_PROTOCOL = "vfsfile";
> +
>      /** Constant for the default refresh delay.*/
>      private static final int DEFAULT_REFRESH_DELAY = 5000;
>  
> @@ -161,7 +164,8 @@
>  
>      /**
>       * Helper method for transforming a URL into a file object. This method
> -     * handles file: and jar: URLs.
> +     * handles file: and jar: URLs, as well as JBoss VFS-specific vfsfile:
> +     * URLs.
>       *
>       * @param url the URL to be converted
>       * @return the resulting file or <b>null </b>
> @@ -181,6 +185,18 @@
>                  return null;
>              }
>          }
> +        else if (VFSFILE_PROTOCOL.equals(url.getProtocol()))
> +        {
> +            String path = url.getPath();
> +            try
> +            {
> +                return ConfigurationUtils.fileFromURL(new URL("file:" + path));
> +            }
> +            catch (MalformedURLException mex)
> +            {
> +                return null;
> +            }
> +        }
>          else
>          {
>              return ConfigurationUtils.fileFromURL(url);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message