morciuch    2002/10/08 08:09:03

  Modified:    docs/site changes.html config_guide.html
               src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
               src/java/org/apache/jetspeed/services/psmlmanager/db
                        DatabasePsmlManagerService.java
               src/java/org/apache/jetspeed/services/registry
                        CastorRegistryService.java
               xdocs    changes.xml config_guide.xml
  Added:       docs/site override_props.html
               src/java/org/apache/jetspeed/services/resources
                        JetspeedResourceService.java
               webapp/WEB-INF/conf my.properties
               xdocs    override_props.xml
  Log:
  Added optional feature to override default properties without modifying 
"out-of-the-box" property files (see /docs/override_props.html for documentation).
  
  Also, modified psml manager and registry services to init any dependent services - 
this was necessary to be able to override their properties.
  
  JetspeedResourceService is a replacement for TurbineResourceService which makes it 
all possible.
  
  Revision  Changes    Path
  1.60      +3 -0      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- changes.html      3 Oct 2002 21:50:41 -0000       1.59
  +++ changes.html      8 Oct 2002 15:09:02 -0000       1.60
  @@ -129,6 +129,9 @@
   </li>
   -->
   <li>
  +  Add - 2002/10/08 - Added optional functionality to override settings in default 
property files (MO)
  +</li>
  +<li>
     Add - 2002/10/03 - Implemented "_control" parameter for portlet registry entries 
(MO) Thanks to Scott Weaver.
   </li>
   <li>
  
  
  
  1.19      +22 -0     jakarta-jetspeed/docs/site/config_guide.html
  
  Index: config_guide.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/config_guide.html,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- config_guide.html 13 Sep 2002 18:44:05 -0000      1.18
  +++ config_guide.html 8 Oct 2002 15:09:02 -0000       1.19
  @@ -145,6 +145,7 @@
           <li><a href="psml_db.html">Configure and build PSML database</a></li>
           <li><a href="#Configure User Database">Configure and build user 
database</a></li>
   -->
  +        <li><a href="override_props.html">Override any properties in default 
property files (jr.props, tr.props, Torque.props)</a></li>
           <li><a href="#Define portlets in local-portlets">Define portlets in 
local-portlets</a></li>
           <li><a href="#Define skins in local-skins.xreg">Define skins in 
local-skins.xreg</a></li>
           <li><a href="#Define local controls and controllers in 
local-managers.xreg">Define local controls and controllers in 
local-managers.xreg</a></li>
  @@ -162,6 +163,27 @@
           <li><a href="#Automatic Password Expiration">Automatic Password 
Expiration</a></li>        
           <li><a href="#Backup and Test">Backup and Test</a></li>
         </ul>
  +                            </blockquote>
  +        </p>
  +      </td></tr>
  +      <tr><td><br/></td></tr>
  +    </table>
  +                                                <table border="0" cellspacing="0" 
cellpadding="2" width="100%">
  +      <tr><td bgcolor="#525D76">
  +        <font color="#ffffff" face="arial,helvetica,sanserif">
  +          <a name="Override any properties in default property files (jr.props, 
tr.props, Torque.props)"><strong>Override any properties in default property files 
(jr.props, tr.props, Torque.props)</strong></a>
  +        </font>
  +      </td></tr>
  +      <tr><td>
  +        <blockquote>
  +                                    <p>
  +        Any site specific property settings may be placed in a custom property file 
(see /WEB-INF/conf/my.properties for an example).
  +        Using a custom property file makes future Jetspeed upgrades easier because 
the default property files remain unchanged.
  +        The following steps are required to activate such custom property file
  +      </p>
  +                                                <p>
  +        See the <a href="catalog">Portlet Catalog</a> for portlet configuration 
documentation.
  +      </p>
                               </blockquote>
           </p>
         </td></tr>
  
  
  
  1.1                  jakarta-jetspeed/docs/site/override_props.html
  
  Index: override_props.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
  
  <!-- Content Stylesheet for Site -->
  
          
  <!-- start the processing -->
      <!-- ====================================================================== -->
      <!-- Main Page Section -->
      <!-- ====================================================================== -->
      <html>
          <head>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
  
                          
             
                                      
              <title>Jetspeed - Properties Override How-To</title>
          </head>
  
          <body bgcolor="#ffffff" text="#000000" link="#525D76">        
              <table border="0" width="100%" cellspacing="0">
                  <!-- TOP IMAGE -->
                  <tr>
                      <td align="left">
  <a href="http://jakarta.apache.org";><img 
src="http://jakarta.apache.org/images/jakarta-logo.gif"; border="0"/></a>
  </td>
  <td align="right">
  <a href="http://jakarta.apache.org/jetspeed/";><img src="./images/logo.gif" 
alt="Jetspeed" border="0"/></a>
  </td>
                  </tr>
              </table>
              <table border="0" width="100%" cellspacing="4">
                  <tr><td colspan="2">
                      <hr noshade="" size="1"/>
                  </td></tr>
                  
                  <tr>
                      <!-- LEFT SIDE NAVIGATION -->
                      <td width="20%" valign="top" nowrap="true">
                                  <p><strong>Essentials</strong></p>
          <ul>
                      <li>    <a href="./index.html">Overview</a>
  </li>
                      <li>    <a href="./features.html">Features</a>
  </li>
                      <li>    <a href="./license.html">License</a>
  </li>
                      <li>    <a href="./install.html">Installation</a>
  </li>
                      <li>    <a href="./faq.html">FAQ</a>
  </li>
                      <li>    <a href="./usejetspeed.html">Sample Sites</a>
  </li>
                      <li>    <a href="./resources.html">Resources</a>
  </li>
                      <li>    <a href="./todo.html">Todo</a>
  </li>
                      <li>    <a href="./changes.html">Changes</a>
  </li>
                  </ul>
              <p><strong>Download</strong></p>
          <ul>
                      <li>    <a 
href="http://jakarta.apache.org/site/binindex.html";>Binaries</a>
  </li>
                      <li>    <a 
href="http://jakarta.apache.org/site/sourceindex.html";>Source Code</a>
  </li>
                  </ul>
              <p><strong>Documentation</strong></p>
          <ul>
                      <li>    <a href="./config_guide.html">Configuration Guide</a>
  </li>
                      <li>    <a 
href="http://jakarta.apache.org/jetspeed/api/index.html";>Javadocs</a>
  </li>
                      <li>    <a href="./application-development.html">Development</a>
  </li>
                      <li>    <a 
href="http://www.bluesunrise.com/jetspeed-docs/PortletHowTo.htm";>Portlet Howto</a>
  </li>
                      <li>    <a href="./catalog.html">Portlet Catalog</a>
  </li>
                      <li>    <a 
href="http://mml.hpl.hp.com:9090/jetspeed/trailmap/index.html";>Jetspeed Trailmap</a>
  </li>
                  </ul>
              <p><strong>Components</strong></p>
          <ul>
                      <li>    <a href="./security.html">Security</a>
  </li>
                      <li>    <a href="./content-syndication.html">Syndication</a>
  </li>
                      <li>    <a href="./wap.html">WAP</a>
  </li>
                      <li>    <a href="./customizer.html">Customization</a>
  </li>
                      <li>    <a href="./diskcache.html">Cache</a>
  </li>
                      <li>    <a href="./psml.html">PSML</a>
  </li>
                  </ul>
              <p><strong>Get Involved</strong></p>
          <ul>
                      <li>    <a href="./contributors.html">Contributors</a>
  </li>
                      <li>    <a 
href="http://jakarta.apache.org/site/cvsindex.html";>CVS Repository</a>
  </li>
                      <li>    <a href="./branches.html">CVS Branches</a>
  </li>
                      <li>    <a href="./code-standards.html">Coding Spec</a>
  </li>
                      <li>    <a 
href="http://nagoya.apache.org/bugzilla/query.cgi?product=Jetspeed";>Bug Database</a>
  </li>
                  </ul>
                          </td>
                      <td width="80%" align="left" valign="top">
                                                                      <table 
border="0" cellspacing="0" cellpadding="2" width="100%">
        <tr><td bgcolor="#525D76">
          <font color="#ffffff" face="arial,helvetica,sanserif">
            <a name="Creating custom property file"><strong>Creating custom property 
file</strong></a>
          </font>
        </td></tr>
        <tr><td>
          <blockquote>
                                      <p>
        Any site specific property settings may be placed in a custom property file 
(see /WEB-INF/conf/my.properties for an example).
        Using a custom property file makes future Jetspeed upgrades easier because the 
default property files remain unchanged.
        </p>
                                                  <p>
        In order to use this feature, first create a custom property file. In the 
example below, "out-of-the-box" settings are overriden
        as follows: default logging is set to "debug", registry is refreshed every 
minute, portlet logging service is activated, 
        customizer portlet preview is enabled, automatic logon is enabled and 
passwords expire every 90 days.
        </p>
                                                      <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre>
  # ###################################################################
  # 
  #  T u r b i n e R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  # -------------------------------------------------------------------
  # 
  #  L O G S
  #
  # -------------------------------------------------------------------
  services.LoggingService.default = debug
  
  # -------------------------------------------------------------------
  #
  #  S E R V I C E S
  #
  # -------------------------------------------------------------------
  services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService
  
  # ###################################################################
  # 
  #  J e t s p e e d R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  #########################################
  # Registry Service                      #
  #########################################
  services.Registry.refreshRate = 60
  
  #########################################
  # Portlet Usage Service                 #
  #########################################
  services.PortletStats.enabled = true
  
  #########################################
  # Customization                         #
  #########################################
  customizer.preview.enable = true
  
  #########################################
  # New User Registration mail support    #
  #########################################
  automatic.logon.enable = true
  
  # ###################################################################
  # 
  #  J e t s p e e d S e c u r i t y . p r o p e r t i e s :
  #
  # ###################################################################
  
  services.JetspeedSecurity.password.expiration.period = 90
  
  # -------------------------------------------------------------------
  #
  #  A D D I T I O N A L  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  # The full path name to an additional properties file. Properties in
  # this file will be included in this property set. Duplicate name
  # values will be replaced, so be careful.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  include = TurbineResources.properties      
        </pre></td>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
      </div>
                                                  <p>
        Note that there are two required entries in custom property file:
        </p>
                                                      <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre>
  services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService
  include = TurbineResources.properties      
        </pre></td>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
      </div>
                                                  <p>
        The first one makes JetspeedResourceService as the ResourceService which makes 
it all possible. The second one
        includes default properties from TurbineResources.properties.
        </p>
                              </blockquote>
          </p>
        </td></tr>
        <tr><td><br/></td></tr>
      </table>
                                                  <table border="0" cellspacing="0" 
cellpadding="2" width="100%">
        <tr><td bgcolor="#525D76">
          <font color="#ffffff" face="arial,helvetica,sanserif">
            <a name="Modifying web app descriptor (web.xml)"><strong>Modifying web app 
descriptor (web.xml)</strong></a>
          </font>
        </td></tr>
        <tr><td>
          <blockquote>
                                      <p>
        The web app descriptor must be changed to use your custom property file and 
JetspeedResourceService:
        </p>
                                                      <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre>
  &lt;web-app&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;
             jetspeed
          &lt;/servlet-name&gt;
          
          &lt;servlet-class&gt;
              org.apache.turbine.Turbine
          &lt;/servlet-class&gt;
  
          &lt;init-param&gt;
              &lt;param-name&gt;properties&lt;/param-name&gt;
              &lt;param-value&gt;WEB-INF/conf/my.properties&lt;/param-value&gt;        
    
          &lt;/init-param&gt;
          
                &lt;init-param&gt;
                        &lt;param-name&gt;resources&lt;/param-name&gt;
              &lt;param-value&gt;&lt;/param-value&gt;
                &lt;/init-param&gt;                
      &lt;/servlet&gt;
      ....
  &lt;/web-app&gt;      
        </pre></td>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
      </div>
                              </blockquote>
          </p>
        </td></tr>
        <tr><td><br/></td></tr>
      </table>
                                                  <table border="0" cellspacing="0" 
cellpadding="2" width="100%">
        <tr><td bgcolor="#525D76">
          <font color="#ffffff" face="arial,helvetica,sanserif">
            <a name="Using ${variable} substitution"><strong>Using ${variable} 
substitution</strong></a>
          </font>
        </td></tr>
        <tr><td>
          <blockquote>
                                      <p>
        You may use ${variable} substitution with any property regardless of data 
type. For example, the following
        property references are valid:
        </p>
                                                      <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre>
  confRoot = /WEB-INF/conf
  ...
  services.URLManager.url = ${confRoot}/datasources.properties
  ...      
  services.Registry.mapping=${confRoot}/registry.xml
  ...                                   
  defaultRefresh = 60
  ...
  services.Registry.refreshRate = ${defaultRefresh}
  ...
  refresh.portlet.default = ${defaultRefresh}
        </pre></td>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
      </div>
                              </blockquote>
          </p>
        </td></tr>
        <tr><td><br/></td></tr>
      </table>
                                                  <table border="0" cellspacing="0" 
cellpadding="2" width="100%">
        <tr><td bgcolor="#525D76">
          <font color="#ffffff" face="arial,helvetica,sanserif">
            <a name="Notes on overriding services"><strong>Notes on overriding 
services</strong></a>
          </font>
        </td></tr>
        <tr><td>
          <blockquote>
                                      <p>
        Order of initializing services may be important. Overriding a service may 
change this order and cause init failures. 
        It is important that services attempt to initialize dependent services in 
their early init methods. 
        For example, to make sure that ServletService is running, the following code 
should be invoked:
        </p>
                                                      <div align="left">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre>
  TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);
        </pre></td>
        <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" 
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" 
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
      </div>
                              </blockquote>
          </p>
        </td></tr>
        <tr><td><br/></td></tr>
      </table>
                                                  <table border="0" cellspacing="0" 
cellpadding="2" width="100%">
        <tr><td bgcolor="#525D76">
          <font color="#ffffff" face="arial,helvetica,sanserif">
            <a name="Notes on overriding Torque properties"><strong>Notes on 
overriding Torque properties</strong></a>
          </font>
        </td></tr>
        <tr><td>
          <blockquote>
                                      <p>
        In order to override properties in Torque.properties, you must include your 
custom property file
        at the beginning or Torque.properties.
        </p>
                              </blockquote>
          </p>
        </td></tr>
        <tr><td><br/></td></tr>
      </table>
                                          </td>
                  </tr>
  
                  <!-- FOOTER -->
                  <tr><td colspan="2">
                      <hr noshade="" size="1"/>
                  </td></tr>
                  <tr><td colspan="2">
                      <div align="center"><font color="#525D76" size="-1"><em>
                      Copyright &#169; 1999-2002, Apache Software Foundation
                      </em></font></div>
                  </td></tr>
              </table>
          </body>
      </html>
  <!-- end the processing -->
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  1.31      +5 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
  
  Index: CastorPsmlManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- CastorPsmlManagerService.java     27 Sep 2002 17:16:35 -0000      1.30
  +++ CastorPsmlManagerService.java     8 Oct 2002 15:09:02 -0000       1.31
  @@ -74,6 +74,7 @@
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.servlet.TurbineServlet;
   import org.apache.turbine.services.resources.ResourceService;
  +import org.apache.turbine.services.servlet.ServletService;
   
   import org.apache.jetspeed.om.security.JetspeedUser;
   import org.apache.jetspeed.om.security.Role;
  @@ -183,6 +184,9 @@
           {
               return;
           }
  +
  +        //Ensure that the servlet service is initialized
  +        TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, 
conf);
         
           // get configuration parameters from Jetspeed Resources
           ResourceService serviceConf = 
((TurbineServices)TurbineServices.getInstance())
  
  
  
  1.27      +8 -1      
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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DatabasePsmlManagerService.java   24 Sep 2002 21:33:36 -0000      1.26
  +++ DatabasePsmlManagerService.java   8 Oct 2002 15:09:02 -0000       1.27
  @@ -81,6 +81,7 @@
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.resources.ResourceService;
   import org.apache.turbine.services.servlet.TurbineServlet;
  +import org.apache.turbine.services.servlet.ServletService;
   
   // torque
   import org.apache.torque.Torque;
  @@ -207,6 +208,10 @@
       private void initConfiguration(ServletConfig conf)
                               throws InitializationException
       {
  +
  +        //Ensure that the servlet service is initialized
  +        TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, 
conf);
  +
           ResourceService serviceConf =
                         ((TurbineServices)TurbineServices.getInstance())
                                 .getResources(PsmlManagerService.SERVICE_NAME);
  @@ -243,7 +248,9 @@
   
               // psml castor mapping file
               mapFile = serviceConf.getString("mapping",DEFAULT_MAPPING);
  +            Log.debug("DatabasePsmlManagerService: mapFile = " + mapFile);
               mapFile = TurbineServlet.getRealPath( mapFile );
  +            Log.debug("DatabasePsmlManagerService: mapFile = " + mapFile);
               loadMapping();
           }
           catch (Throwable t)
  
  
  
  1.20      +7 -2      
jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java
  
  Index: CastorRegistryService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/CastorRegistryService.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CastorRegistryService.java        15 Sep 2002 16:18:17 -0000      1.19
  +++ CastorRegistryService.java        8 Oct 2002 15:09:02 -0000       1.20
  @@ -67,6 +67,7 @@
   import org.apache.turbine.services.TurbineBaseService;
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.servlet.TurbineServlet;
  +import org.apache.turbine.services.servlet.ServletService;
   import org.apache.turbine.services.resources.ResourceService;
   
   // castor marshalling
  @@ -324,6 +325,9 @@
       public void init(ServletConfig conf) throws InitializationException
       {
   
  +        //Ensure that the servlet service is initialized
  +        TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, 
conf);
  +
           ResourceService serviceConf = ((TurbineServices) 
TurbineServices.getInstance())
                                                        
.getResources(RegistryService.SERVICE_NAME);
           String mapFile = null;
  @@ -334,13 +338,13 @@
           try
           {
               directory = serviceConf.getString("directory");
  +            Log.debug("CastorRegistryService: directory = " + directory);
               mapFile = serviceConf.getString("mapping", DEFAULT_MAPPING);
               extension = serviceConf.getString("extension", DEFAULT_EXTENSION);
               refreshRate = serviceConf.getInt("refreshRate", DEFAULT_REFRESH);
   
               mapFile = TurbineServlet.getRealPath(mapFile);
               directory = TurbineServlet.getRealPath(directory);
  -
           }
           catch (Throwable t)
           {
  @@ -406,6 +410,7 @@
   
           // Set directory watcher if directory exists
           
  +        Log.debug("CastorRegistryService: directory = " + directory);
           File base = new File(directory);
           File[] files = null;
   
  
  
  
  1.1                  
jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedResourceService.java
  
  Index: JetspeedResourceService.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.services.resources;
  
  // Turbine stuff
  import org.apache.turbine.util.Log;
  import org.apache.turbine.services.resources.TurbineResourceService;
  import org.apache.turbine.services.resources.ResourceService;
  
  // Stratum stuff
  import org.apache.stratum.configuration.Configuration;
  
  /**
   * <p>This service subclasses <code>TurbineResourceService</code> and
   * provides functionality for overriding properties in default resource
   * files. This override behavior is extended to non-string properties</p>
   * 
   * <P>To override properties:
   * <ul>
   * <li>Define your own property file containing properties you want to override (for 
example, my.properties)</li>
   * <li>Add the following property in my.properties file:
   * <code>services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService</code></li>
   * <li>Include TurbineResources.properties at the end of my.properties file</li>
   * <li>Set <code>properties</code> init parameter in web.xml to 
<code>my.properties</code></li>
   * <li>Set <code>resources</code> init parameter in web.xml to
   * <code>org.apache.jetspeed.services.resources.JetspeedResourceService</code></li>
   * </ul>
   * 
   * <P><B>Important note on overriding services.</B>Order of initializing services 
may be important.
   * Overriding a service may change this order. It is important that services attempt 
to initialize
   * dependent services in their early init methods. For example, to make sure that 
ServletService is
   * running, invoke the following code:
   * <PRE>
   * TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);
   * </PRE>
   * </P>
   * 
   * <P>Also, ${variable} substitution is extended to non-string properties. For 
example, the following
   * property references are valid:
   * <PRE>
   * confRoot=/WEB-INF/conf
   * 
   * psmlMapFile=${confRoot}/psml-mapping.xml
   * registryMapFile=${confRoot}/registry-mapping.xml
   * 
   * defaultRefresh=60
   * 
   * registryRefresh=${defaultRefresh}
   * psmlRefresh=${defaultRefresh}
   * </PRE>
   * </P>
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]";>Mark Orciuch</a>
   * @version $Id: JetspeedResourceService.java,v 1.1 2002/10/08 15:09:02 morciuch Exp 
$
   */
  public class JetspeedResourceService
  extends TurbineResourceService
  {
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a boolean value.
       *
       * @param name The resource name.
       * @return The value of the named resource as a boolean.
       */
      public boolean getBoolean(String name)
      {
  
          return new 
Boolean(interpolate(getConfiguration().getString(name))).booleanValue();
      }
  
      /**
       * The purppose of this method is to get the configuration
       * resource with the given name as a boolean value, or a default
       * value.
       *
       * @param name The resource name.
       * @param def The default value of the resource.
       * @return The value of the named resource as a boolean.
       */
      public boolean getBoolean(String name, boolean def)
      {
  
          String temp = interpolate(getConfiguration().getString(name));
          return temp != null ? new Boolean(temp).booleanValue() : def;
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a double.
       *
       * @param name The resoource name.
       * @return The value of the named resource as double.
       */
      public double getDouble(String name)
      {
  
          return new 
Double(interpolate(getConfiguration().getString(name))).doubleValue();
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a double, or a default value.
       *
       * @param name The resource name.
       * @param def The default value of the resource.
       * @return The value of the named resource as a double.
       */
      public double getDouble(String name, double def)
      {
  
          String temp = interpolate(getConfiguration().getString(name));
          return temp != null ? new Double(temp).doubleValue() : def;
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a float.
       *
       * @param name The resource name.
       * @return The value of the resource as a float.
       */
      public float getFloat(String name)
      {
  
          return new 
Float(interpolate(getConfiguration().getString(name))).floatValue();
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a float, or a default value.
       *
       * @param name The resource name.
       * @param def The default value of the resource.
       * @return The value of the resource as a float.
       */
      public float getFloat(String name, float def)
      {
  
          String temp = interpolate(getConfiguration().getString(name));
          return temp != null ? new Float(temp).floatValue() : def;
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as an integer.
       *
       * @param name The resource name.
       * @return The value of the resource as an integer.
       */
      public int getInt(String name)
      {
  
          return new 
Integer(interpolate(getConfiguration().getString(name))).intValue();
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as an integer, or a default value.
       *
       * @param name The resource name.
       * @param def The default value of the resource.
       * @return The value of the resource as an integer.
       */
      public int getInt(String name, int def)
      {
  
          String temp = interpolate(getConfiguration().getString(name));
          return temp != null ? new Integer(temp).intValue() : def;
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a long.
       *
       * @param name The resource name.
       * @return The value of the resource as a long.
       */
      public long getLong(String name)
      {
  
          return new Long(interpolate(getConfiguration().getString(name))).longValue();
      }
  
      /**
       * The purpose of this method is to get the configuration resource
       * with the given name as a long, or a default value.
       *
       * @param name The resource name.
       * @param def The default value of the resource.
       * @return The value of the resource as a long.
       */
      public long getLong(String name, long def)
      {
  
          String temp = interpolate(getConfiguration().getString(name));
          return temp != null ? new Long(temp).longValue() : def;
      }
  
      /**
       * The purpose of this method is to extract a subset of configuraton
       * resources sharing a common name prefix. The prefix is stripped
       * from the names of the resulting resources.
       *
       * @param prefix the common name prefix
       * @return A ResourceService providing the subset of configuration.
       */
      public ResourceService getResources(String prefix)
      {
          Configuration config = getConfiguration().subset(prefix);
  
          if (config == null)
          {
              return null;
          }
  
          JetspeedResourceService res = new JetspeedResourceService();
          try 
          {
              res.init(config);
          }
          catch (Exception e)
          {
              Log.error(e);
          }
  
          return (ResourceService) res;
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/webapp/WEB-INF/conf/my.properties
  
  Index: my.properties
  ===================================================================
  # -------------------------------------------------------------------
  # $Id: my.properties,v 1.1 2002/10/08 15:09:02 morciuch Exp $
  #
  # This file contains site specific properties. These properties 
  # are basically overrides of properties found in TurbineResources,
  # JetspeedResources, JetspeedSecurity and Torque.properties.
  #
  #
  # Note that strings containing "," (comma) characters must backslash 
  # escape the comma (i.e. '\,')
  #
  # -------------------------------------------------------------------
  
  # ###################################################################
  # 
  #  T u r b i n e R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  # -------------------------------------------------------------------
  # 
  #  L O G S
  #
  # -------------------------------------------------------------------
  services.LoggingService.default = debug
  
  # -------------------------------------------------------------------
  #
  #  S E R V I C E S
  #
  # -------------------------------------------------------------------
  services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService
  
  # ###################################################################
  # 
  #  J e t s p e e d R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  #########################################
  # Registry Service                      #
  #########################################
  services.Registry.refreshRate = 60
  
  #########################################
  # Portlet Usage Service                 #
  #########################################
  services.PortletStats.enabled = true
  
  #########################################
  # Customization                         #
  #########################################
  customizer.preview.enable = true
  
  #########################################
  # New User Registration mail support    #
  #########################################
  automatic.logon.enable = true
  
  # ###################################################################
  # 
  #  J e t s p e e d S e c u r i t y . p r o p e r t i e s :
  #
  # ###################################################################
  
  services.JetspeedSecurity.password.expiration.period = 90
  
  # -------------------------------------------------------------------
  #
  #  A D D I T I O N A L  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  # The full path name to an additional properties file. Properties in
  # this file will be included in this property set. Duplicate name
  # values will be replaced, so be careful.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  include = TurbineResources.properties
  
  
  
  1.78      +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- changes.xml       3 Oct 2002 21:50:41 -0000       1.77
  +++ changes.xml       8 Oct 2002 15:09:03 -0000       1.78
  @@ -23,6 +23,9 @@
   </li>
   -->
   <li>
  +  Add - 2002/10/08 - Added optional functionality to override settings in default 
property files (MO)
  +</li>
  +<li>
     Add - 2002/10/03 - Implemented "_control" parameter for portlet registry entries 
(MO) Thanks to Scott Weaver.
   </li>
   <li>
  
  
  
  1.13      +11 -0     jakarta-jetspeed/xdocs/config_guide.xml
  
  Index: config_guide.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/config_guide.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- config_guide.xml  13 Sep 2002 18:44:07 -0000      1.12
  +++ config_guide.xml  8 Oct 2002 15:09:03 -0000       1.13
  @@ -32,6 +32,7 @@
           <li><a href="psml_db.html">Configure and build PSML database</a></li>
           <li><a href="#Configure User Database">Configure and build user 
database</a></li>
   -->
  +        <li><a href="override_props.html">Override any properties in default 
property files (jr.props, tr.props, Torque.props)</a></li>
           <li><a href="#Define portlets in local-portlets">Define portlets in 
local-portlets</a></li>
           <li><a href="#Define skins in local-skins.xreg">Define skins in 
local-skins.xreg</a></li>
           <li><a href="#Define local controls and controllers in 
local-managers.xreg">Define local controls and controllers in 
local-managers.xreg</a></li>
  @@ -59,6 +60,16 @@
         </p>
       </section>
   -->
  +    <section name="Override any properties in default property files (jr.props, 
tr.props, Torque.props)">
  +      <p>
  +        Any site specific property settings may be placed in a custom property file 
(see /WEB-INF/conf/my.properties for an example).
  +        Using a custom property file makes future Jetspeed upgrades easier because 
the default property files remain unchanged.
  +        The following steps are required to activate such custom property file
  +      </p>
  +      <p>
  +        See the <a href="catalog">Portlet Catalog</a> for portlet configuration 
documentation.
  +      </p>
  +    </section>
       <section name="Define portlets in local-portlets">
         <p>
           Any site specific portlets should be define in 
<tt>&lt;jetspeed_home&gt;/WEB-INF/conf/local-portlets.xreg</tt>.
  
  
  
  1.1                  jakarta-jetspeed/xdocs/override_props.xml
  
  Index: override_props.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document>
    <properties>
      <title>Properties Override How-To</title>
      <subtitle>Instructions to override properties in default properties 
file</subtitle>
      <authors>
       <person name="Mark Orciuch" email="[EMAIL PROTECTED]"/>
      </authors>
    </properties>
  
    <body>
      <section name="Creating custom property file">
        <p>
        Any site specific property settings may be placed in a custom property file 
(see /WEB-INF/conf/my.properties for an example).
        Using a custom property file makes future Jetspeed upgrades easier because the 
default property files remain unchanged.
        </p>
        <p>
        In order to use this feature, first create a custom property file. In the 
example below, "out-of-the-box" settings are overriden
        as follows: default logging is set to "debug", registry is refreshed every 
minute, portlet logging service is activated, 
        customizer portlet preview is enabled, automatic logon is enabled and 
passwords expire every 90 days.
        </p>
        <source>
  # ###################################################################
  # 
  #  T u r b i n e R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  # -------------------------------------------------------------------
  # 
  #  L O G S
  #
  # -------------------------------------------------------------------
  services.LoggingService.default = debug
  
  # -------------------------------------------------------------------
  #
  #  S E R V I C E S
  #
  # -------------------------------------------------------------------
  services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService
  
  # ###################################################################
  # 
  #  J e t s p e e d R e s o u r c e s . p r o p e r t i e s :
  #
  # ###################################################################
  
  #########################################
  # Registry Service                      #
  #########################################
  services.Registry.refreshRate = 60
  
  #########################################
  # Portlet Usage Service                 #
  #########################################
  services.PortletStats.enabled = true
  
  #########################################
  # Customization                         #
  #########################################
  customizer.preview.enable = true
  
  #########################################
  # New User Registration mail support    #
  #########################################
  automatic.logon.enable = true
  
  # ###################################################################
  # 
  #  J e t s p e e d S e c u r i t y . p r o p e r t i e s :
  #
  # ###################################################################
  
  services.JetspeedSecurity.password.expiration.period = 90
  
  # -------------------------------------------------------------------
  #
  #  A D D I T I O N A L  P R O P E R T I E S
  #
  # -------------------------------------------------------------------
  # The full path name to an additional properties file. Properties in
  # this file will be included in this property set. Duplicate name
  # values will be replaced, so be careful.
  #
  # Default: none
  # -------------------------------------------------------------------
  
  include = TurbineResources.properties      
        </source>  
        
        <p>
        Note that there are two required entries in custom property file:
        </p>                
        <source>
  services.ResourceService.classname = 
org.apache.jetspeed.services.resources.JetspeedResourceService
  include = TurbineResources.properties      
        </source>
        <p>
        The first one makes JetspeedResourceService as the ResourceService which makes 
it all possible. The second one
        includes default properties from TurbineResources.properties.
        </p>
      </section>
  
      <section name = "Modifying web app descriptor (web.xml)">
        <p>
        The web app descriptor must be changed to use your custom property file and 
JetspeedResourceService:
        </p>    
        <source>
  &lt;web-app&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;
             jetspeed
          &lt;/servlet-name&gt;
          
          &lt;servlet-class&gt;
              org.apache.turbine.Turbine
          &lt;/servlet-class&gt;
  
          &lt;init-param&gt;
              &lt;param-name&gt;properties&lt;/param-name&gt;
              &lt;param-value&gt;WEB-INF/conf/my.properties&lt;/param-value&gt;        
    
          &lt;/init-param&gt;
          
                &lt;init-param&gt;
                        &lt;param-name&gt;resources&lt;/param-name&gt;
              
&lt;param-value&gt;<b>org.apache.jetspeed.services.resources.JetspeedResourceService</b>&lt;/param-value&gt;
                &lt;/init-param&gt;                
      &lt;/servlet&gt;
      ....
  &lt;/web-app&gt;      
        </source>            
      </section>
      
      <section name = "Using ${variable} substitution">
        <p>
        You may use ${variable} substitution with any property regardless of data 
type. For example, the following
        property references are valid:
        </p>               
        <source>
  confRoot = /WEB-INF/conf
  ...
  services.URLManager.url = ${confRoot}/datasources.properties
  ...      
  services.Registry.mapping=${confRoot}/registry.xml
  ...                                   
  defaultRefresh = 60
  ...
  services.Registry.refreshRate = ${defaultRefresh}
  ...
  refresh.portlet.default = ${defaultRefresh}
        </source>
      </section>
      
      <section name = "Notes on overriding services">
        <p>
        Order of initializing services may be important. Overriding a service may 
change this order and cause init failures. 
        It is important that services attempt to initialize dependent services in 
their early init methods. 
        For example, to make sure that ServletService is running, the following code 
should be invoked:
        </p> 
        <source>
  TurbineServices.getInstance().initService(ServletService.SERVICE_NAME, conf);
        </source>
      </section>
      
      <section name = "Notes on overriding Torque properties">
        <p>
        In order to override properties in Torque.properties, you must include your 
custom property file
        at the beginning or Torque.properties.
        </p>         
      </section>
    </body>
  </document>
  
  

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

Reply via email to