Date: 2005-01-20T19:12:40
   Editor: ScottEade
   Wiki: Jakarta Turbine Wiki
   Page: Turbine2/UsersGuide/Services
   URL: http://wiki.apache.org/jakarta-turbine/Turbine2/UsersGuide/Services

   Migrated page.

New Page:

#pragma section-numbers off
= Turbine 2.x User's Guide: What Is A Service? =

Services    are singletons within the Turbine Framework which have pluggable 
implementation, and are capable of participating in the Turbine startup and 
shutdown. As Services are Singletons, there is only one instance of each 
service in the system. Memory or connections are allocated only once and the 
internal state is common to all requesting clients.  A Service that is never 
used will not allocate resources to itself.  A Service can also execute actions 
upon the system being shutdown, such as closing open connections.

Services are configurable accessing Servlet''''''Config and 
Turbine''''''Resouces.properties at startup.  Uses might include setting paths, 
defaults and similar functionality.  They also access Run''''''Data on the 
first Turbine doGet execution to get the environment Turbine is operating 
within.  Services can also initialize themselves before they are requested by 
the client for the first time.

The Singleton pattern also allows for the Services to be accessed from anywhere 
within your code, which is were the real power of Services comes in to play.  
As separate, testable entities, Services should contain all business logic so 
that screens and actions may become as thin as possible.  Further, business and 
application logic can be separted in an effort to cleanly decouple application 
components.

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

Reply via email to