Code Discussion 2008-11-03

From MPDLMediaWiki
Jump to navigation Jump to search

Previous topic[edit]

Previous topic 2008-10-20

PropertyReader[edit]

Current situation[edit]

   public static String getProperty(String key) throws IOException, URISyntaxException
   {
       // First check system properties
       String value = System.getProperty(key);
       if (value != null)
       {
           return value;
       }
       // Check properties file
       if (properties == null)
       {
           loadProperties();
       }
       // Get the property
       value = properties.getProperty(key);
       return value;
   }

  • Static helper class
  • loads properties from solution-specific properties file (e.g. pubman.properties, faces.properties)

Problem[edit]

If more than one solution is deployed on the same JBoss instance, the following happens:

  • When the first solution reads a property, the appropriate properties file is loaded.
  • When another solution reads a property that was already defined by the first solution, that property is given back (although it may have a wrong value), i.e. that solution does not work correctly.
  • When another solution reads a property that wasn't already defined by the first solution, the according properties file is also read in overwriting the properties that exist in both files. I.e. the first solution doesn't work correctly.

Ideas[edit]

  • Only use unambiguous properties
    • But: e.g. framework url
  • Define properties set per solution (How?)

Solution[edit]

Next topic[edit]

Next topic 2008-11-10