While working at moving our code as services, I've noticed a confusing
naming pattern in the service name in Turbine :
All the services name declared in the service interface are the
same that the default implementation classname. For example,
VelocityService has a service name of "TurbineVelocityService" thus
creating entries in TurbineResources.properties of this form:
service.TurbineVelocityService.classname=...services.velocity.TurbineVelocityService
This is my opinion is confusing because it doesn't convey the
meaning the TurbineVelocityService is actually th interface name
an that it's possible to provide other implementations of this
service.
I'd propose that the service name declared drop the "Turbine"
prefix and are actually either equal to the name of the interface defining
the service or the part of name without the "Service" suffix which
is redundant both in the TurbineResources.properties since all
the service keys are prefixed by "services." and in the code since this
SERVICE_NAME is only either used with the getService() method.
ex:
services.VelocityService.classname=...services.velocity.TurbineVelocityService
or
services.Velocity.classname=...services.velocity.TurbineVelocityService
This would create the following naming pattern for services :
Let <Name> be "real" service name (for example Velocity, Upload, etc...)
capitalized following Java classname conventions.
A Turbine service should then adhere to these guidelines :
* Live a package named: <base>.services.<name> where name is the lower case
version of <Name>
* Have a <Name>Service interface which define the fuinctionalities of the
service and has a service name of either <Name>Service or simply <Name>
[I'd prefer the later but the former would make the service name equal
to the interface classname and may allow use of introspection]
* Provide a default interface implementation named <ImplPrefix><Name>Service
* When a static accessor class is provided that only relies on the
service interface methods it should simply be called <Name>, when
the static accessor depends on a given implementation use
<ImplPrefix><Name>
Applying these guidelines for the Velocity package would give:
org.apache.turbine.services.velocity/
Velocity.java (generic static accessor not dependant on impl)
VelocityService.java (interface)
TurbineVelocityService.java (default turbine impl)
and in the TurbineResources.properties file:
services.Velocity.classname=org.apache.turbine.services.TurbineVelocityService
--
Rapha�l Luta - [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]