ggolden     2002/09/19 19:00:40

  Modified:    src/java/org/apache/jetspeed/services/psmlmanager/db
                        DatabasePsmlManagerService.java
  Log:
  cleaned up the init code, which had some bad formatting, and a misleading
  exception if any parameters had trouble...
  also changed the parameter reading to use strings and convert them to type
  here, so we can have multiple settings of these values in our resources.properties
  files (to override un-changed distribution jr.p).
  
  Revision  Changes    Path
  1.24      +30 -13    
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java
  
  Index: DatabasePsmlManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DatabasePsmlManagerService.java   19 Sep 2002 01:24:13 -0000      1.23
  +++ DatabasePsmlManagerService.java   20 Sep 2002 02:00:40 -0000      1.24
  @@ -213,25 +213,43 @@
           try
           {
               // get configuration parameters from Turbine Resources
  -            refreshRate = 
  -                      serviceConf.getLong(REFRESH_RATE, DEFAULT_REFRESH_RATE);
  +            // we'll use only string accessors so the values can be multiply
  +            // specified in the properties files (the first one wins).
  +            String value = serviceConf.getString(REFRESH_RATE);
  +            refreshRate = DEFAULT_REFRESH_RATE;
  +            try
  +            {
  +                refreshRate = Long.parseLong(value);
  +            }
  +            catch (Exception e)
  +            {
  +                Log.warn("DatabasePsmlManagerService: error in refresh-rate 
configuration: using default");
  +            }
   
               // get the name of the torque database pool to use
               poolName = serviceConf.getString(POOL_NAME);
   
  -//            new DatabaseInitializer(this, conf, serviceConf);
               //find out if caching allowed
  -            cachingOn = serviceConf.getBoolean(CACHING_ON, DEFAULT_CACHING_ON);
  -
  -        // psml castor mapping file
  -        mapFile = serviceConf.getString("mapping",DEFAULT_MAPPING);
  -        mapFile = TurbineServlet.getRealPath( mapFile );
  -        loadMapping();
  -
  +            value = serviceConf.getString(CACHING_ON);
  +            cachingOn = DEFAULT_CACHING_ON;
  +            try
  +            {
  +                cachingOn = value.equals("true");
  +            }
  +            catch (Exception e)
  +            {
  +                Log.warn("DatabasePsmlManagerService: error in caching-on 
configuration: using default");
  +            }
  +
  +            // psml castor mapping file
  +            mapFile = serviceConf.getString("mapping",DEFAULT_MAPPING);
  +            mapFile = TurbineServlet.getRealPath( mapFile );
  +            loadMapping();
           }
           catch (Throwable t)
           {
  -            throw new InitializationException("Missing default refresh rate 
parameter, during initializing DatabasePsmlManagerService, using defaults");
  +                     Log.error(this + ".init:" , t);
  +            throw new InitializationException("Exception initializing 
DatabasePsmlManagerService" + t);
           }
   
           if (cachingOn)
  @@ -239,7 +257,6 @@
               this.refresher = new CacheRefresher();
               refresher.start();
           }
  -
       }
   
       /** Late init method from Turbine Service model */
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to