← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 172: Made the Birt report config manager look for system properties before reading in the config file

 

------------------------------------------------------------
revno: 172
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-04-14 17:34:50 +0200
message:
  Made the Birt report config manager look for system properties before reading in the config file
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/ReportConfiguration.java

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/DefaultReportManager.java	2009-04-14 15:34:50 +0000
@@ -43,6 +43,9 @@
 public class DefaultReportManager
     implements ReportManager
 {
+    private static final String BIRT_HOME_SYSTEM_PROPERTY = "birt.home";
+    private static final String BIRT_DIR_SYSTEM_PROPERTY = "birt.context.path";
+    
     // -------------------------------------------------------------------------
     // Properties
     // -------------------------------------------------------------------------
@@ -100,6 +103,22 @@
     public ReportConfiguration getConfiguration()
         throws NoConfigurationFoundException
     {
+        // ---------------------------------------------------------------------
+        // Look for system property
+        // ---------------------------------------------------------------------
+
+        String home = System.getProperty( BIRT_HOME_SYSTEM_PROPERTY );
+        String dir = System.getProperty( BIRT_DIR_SYSTEM_PROPERTY );
+        
+        if ( home != null && dir != null )
+        {
+            return new ReportConfiguration( home, dir );
+        }
+
+        // ---------------------------------------------------------------------
+        // Look for configuration file
+        // ---------------------------------------------------------------------
+
         try
         {
             InputStream in = locationManager.getInputStream( reportConfigFile, reportConfigDir );

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/ReportConfiguration.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/ReportConfiguration.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/manager/ReportConfiguration.java	2009-04-14 15:34:50 +0000
@@ -36,6 +36,8 @@
 public class ReportConfiguration
     implements Serializable
 {
+    private static final String SEPARATOR = "/";
+    
     private String home;
     
     private String directory;
@@ -134,6 +136,11 @@
 
     public String getDirectory()
     {
+        if ( directory != null && directory.startsWith( SEPARATOR ) )
+        {
+            return directory.substring( 1, directory.length() );
+        }
+        
         return directory;
     }
 



--
Trunk
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.