Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1084

Integrate configuration sources expressed as URLs.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • Configuration
    • None

    Description

      The PropertyFileUtils class can load the properties file as follows :

              String root = System.getProperty("user.dir");
          	String path = root + "/src/test/resources/myurlconfig.properties";
              String urlPath = "file:/" + path;
          	URL propertyFileUrl = new URL(urlPath);
      	Poperties p = PropertyFileUtils.loadProperties(propertyFileUrl);
      

      Using the following code to incorporate the properties does not work:

      public class MyUrlCustomPropertyFileConfig implements PropertyFileConfig
      {
      	
          @Override
          public String getPropertyFileName()
          {
          	String root = System.getProperty("user.dir");
          	String path = root + "/src/test/resources/myurlconfig.properties";
              return "file:/" + path;
          }
      
          @Override
          public boolean isOptional()
          {
              return false;
          }
      }
      

      I get an exception as follows:

      java.lang.IllegalStateException: com.example.MyUrlCustomPropertyFileConfig points to an invalid file: 'file:/D:\Dev\GIT\example-test/src/test/resources/myurlconfig.properties'
      	at org.apache.deltaspike.core.impl.config.ConfigurationExtension.createPropertyConfigSource(ConfigurationExtension.java:210)
      	at org.apache.deltaspike.core.impl.config.ConfigurationExtension.registerUserConfigSources(ConfigurationExtension.java:135)
      	at org.apache.deltaspike.core.impl.config.ConfigurationExtension$Proxy$_$$_WeldClientProxy.registerUserConfigSources(ConfigurationExtension$Proxy$_$$_WeldClientProxy.java)
      

      By looking into the test code in DeltaSpike I do not see any usage of the URL mechanism as a property configuration source. This should be improved.

      There should be a way to integrate easily configuration sources expressed as URLs. As user, I would like that the way to integrate URL paths as configuration sources is also documented (including those starting with file:/).

      Attachments

        Activity

          People

            struberg Mark Struberg
            pleira Pablo Pita Leira
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: