Essentials
Models
Get Involved
Documentation
Database
|
Factory Service
|
The Factory Service instantiates objects from the given class name
using either the given class loader or an applicable one found from the class
loader repository. If neither one is specified, the default class loader
will be used.
The service provides the following benefits compared to Class.forName():
- support for parameters in constructors,
- internal class loader repository, which can be specified in resources,
- optional class specific factories, which can be used for customized instantiation, and
- integration with the Pool Service supporting recycling of instances created by the service.
|
Configuration
|
 |
 |
 |
 |
# -------------------------------------------------------------------
#
# S E R V I C E S
#
# -------------------------------------------------------------------
# Classes for Turbine Services should be defined here.
# Format: services.[name].classname=[implementing class]
#
# To specify properties of a service use the following syntax:
# service.[name].[property]=[value]
services.FactoryService.classname=org.apache.turbine.services.factory.TurbineFactoryService
.
.
.
# -------------------------------------------------------------------
#
# F A C T O R Y S E R V I C E
#
# -------------------------------------------------------------------
# A comma separated list of classloaders (very optional)
#
# Example: org.foo.bar.MyClassLoader, org.ack.joe.YourClassLoader
#
#services.FactoryService.class.loaders=
# Customized factories to be used instead of the default factory.
# E.g. to instantiate XML parsers, SSL sockets, etc., which require
# specific instantiation not supported by the default factory.
# The property name is prefixed with "factory" followed by the
# name of the production class. The value is the class name of
# the factory implementing the Factory interface. The factory
# will be instantiated by using the service itself.
#
# Examples:
#
#services.FactoryService.factory.javax.xml.parsers.DocumentBuilder=org.foo.xml.DomBuilderFactory
#services.FactoryService.factory.javax.xml.parsers.SAXParser=org.foo.xml.SaxParserFactory
#services.FactoryService.factory.java.net.ServerSocket=org.foo.net.SslServerSocketFactory
|
 |
 |
 |
 |
|
|