As the suggestion to change the RunData into an interface was supported,
below are the updates that Jon promissed to check in:
1) The RunData class has been changed to an interface, the most dangerous
looking setters have been removed (don't panic, they are still in the
implementation and can be easily returned, if needed :) and the rest
rearranged to
group related methods more close to each other.
2) A new class, TurbineRunData, implements the interface and contains all
the methods of the original RunData class. The setters, which are not part
of
the interface, have been changed to protected. All fields have been changed
to
private. New getters/setters have been added for formerly public fields that
didn't have them. In addition, TurbineRunData implements the Recyclable
interface, which supports pooling of its implementations.
3) Two new services (thanks to the idea from John) have been added:
The FactoryService can be used for instantiating objects from any class. It
provides three benefits compared to Class.forName():
-- it supports parameters for constructors,
-- it supports both a call specific class loader and an internal class
loader repository, which can be specified in resources
(services.TurbineFactoryService.class.loaders)
-- instances created by it can be pooled.
The PoolService extends the FactoryService with methods for instantiating
objects from direct class references (without loaders) and a method for
returning used instances back to the service. When requesting objects from
the
PoolService, it first checks if any returned ones are available. If not, it
either
creates a new one from the class reference, or, if a class name is given,
forwards the request to the FactoryService. The capacity of the pool can be
specified with a resource. The capacity means the size of a separate buffer
for
each different class active in the
service(services.TurbinePoolService.pool.capacity).
4) The Recyclable interface defines methods that are called by the pool
service when intances are returned to the pool, and when returned instances
are
taken from the pool to be reused. Implementations of the methods should
clear
and initialize the pooled instances correspondingly (objects that don't
implement the interface can also be pooled, if they don't need to perform
any
specific actions during pooling). A RecyclableSupport class can be extended
to
get minimal implementation of the interface.
5) The RunDataFactory has been updated to use the PoolService when
intantiating RunData implementations. In addition, it has a new static
method for
returning used RunData implementations back to the pool. It supports only
TurbineRunData instances, but can be easily revised to support other
implementations
specified with a class name.
6) The Turbine class has been updated to return used RunData instances back
to the RunDataFactory.
7) Error, VelocityErrorScreen, WebMacroSiteErrorScreen and
DefaultBottomNavigation have been updated to use getters instead of direct
references to
RunData fields.
I hope you'll find these updates useful. They have been tested with a quite
small Velocity based demo application and seemed to work without any
problems.
-- Ilkka
--
Nokia Networks
http://www.nokia.com/networks
mail: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]