You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by dl...@apache.org on 2001/03/19 04:11:21 UTC

cvs commit: jakarta-turbine/src/java/org/apache/turbine/services package.html

dlr         01/03/18 19:11:21

  Modified:    src/java/org/apache/turbine/services package.html
  Log:
  Added a section describing the initialization of services outside of the
  Turbine servlet.  Annoying FAQ item begone from our list!
  
  Revision  Changes    Path
  1.3       +29 -2     jakarta-turbine/src/java/org/apache/turbine/services/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/package.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- package.html	2001/01/29 13:37:06	1.2
  +++ package.html	2001/03/19 03:11:21	1.3
  @@ -31,7 +31,7 @@
   <li> Can execute some action upon system shutdown e.g. close the 
        opened connections.
   </ul>		  
  -<h3> The life cycle of a Service </h3>
  +<h3>The life cycle of a Service</h3>
   <p>
   A Service (or any other Initable, if we had any) is not supposed 
   to do much in it's constructor. Especialy it should not allocate
  @@ -74,8 +74,35 @@
   system is shutting down), the shutdown() method is called.
   shutdown() should deallocate all resources. If any error conditions
   occur they are ignored.
  +<h3>Initialization of services outside of the Turbine servlet</h3>
  +<p>
  +In the case where specific Turbine services are desired outside the
  +context of the <code>Turbine</code> servlet, a Turbine JAR file can be
  +used in conjunction with a <i>properly configured</i>
  +<code>TurbineResources.properties</code> file to initialize a specific
  +set of services to use in your application.  The following sample
  +code performs such initialization:
  +<p>
  +<blockquote><code><pre>
  +String webAppRoot = "/var/httpd/webapps";
  +String trProps = "/var/httpd/TurbineResources.properties";
  +try
  +{
  +    TurbineConfig cfg = new TurbineConfig(webAppRoot, trProps);
  +    cfg.init();
  +}
  +catch (Exception e)
  +{
  +    // If Turine fails to initialize, no logging service will be available.
  +    String msg = "Failed to initialize Turbine: " + e.getMessage();
  +    // Write directly to stderr to preserve the full stack trace.
  +    System.err.println(msg);
  +    e.printStackTrace();
  +    throw new Error(msg);
  +}
  +</pre></code></blockquote>
   </td></tr></table>
   <br>
  -<font size="-2">$Id: package.html,v 1.2 2001/01/29 13:37:06 mpoeschl Exp $</font>
  +<font size="-2">$Id: package.html,v 1.3 2001/03/19 03:11:21 dlr Exp $</font>
   </body>
   </html>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org