Difference between revisions of "Code Discussion 2008-11-03"

From MPDLMediaWiki
Jump to navigation Jump to search
 
Line 5: Line 5:


== Current situation ==
== Current situation ==
* [https://zim02.gwdg.de/repos/common/trunk/common_services/framework_access/src/main/java/de/mpg/escidoc/services/framework/PropertyReader.java PropertyReader]
* [https://subversion.mpdl.mpg.de/repos/common/trunk/common_services/framework_access/src/main/java/de/mpg/escidoc/services/framework/PropertyReader.java PropertyReader]
<code>
<code>
     public static String getProperty(String key) throws IOException, URISyntaxException
     public static String getProperty(String key) throws IOException, URISyntaxException
Line 36: Line 36:
* 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.
* 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.


* Similar issue with [https://zim02.gwdg.de/repos/common/trunk/common_services/framework_access/src/main/java/de/mpg/escidoc/services/framework/ServiceLocator.java ServiceLocator].
* Similar issue with [https://subversion.mpdl.mpg.de/repos/common/trunk/common_services/framework_access/src/main/java/de/mpg/escidoc/services/framework/ServiceLocator.java ServiceLocator].


== Ideas ==
== Ideas ==

Latest revision as of 16:40, 25 April 2012

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