|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softslate.commerce.businessobjects.core.BusinessObjectFactoryImpl
public class BusinessObjectFactoryImpl
Factory class used to create instances of business layer objects. Objects are
created with the createObject
,
createObjectFromClassName
, or createUtilsObject
methods.
Generally, this class uses its appComponents
property to look
up the fully-qualified class name of the requested interface (taken from the
appComponents.properties
file. Then it uses the Java
reflection API to create the instance.
An instance of BusinessObjectFactory
is created in the Struts
layer. Its properties are populated there with the application's
DAOFactory
,
Settings
,
appComponents
, appSettings
, and with the
User
currently accessing
the system.
Immediately after instantiating the requested business object, this factory passes its own properties to it so that the newly created object can use them to communicate with the rest of the application.
Field Summary | |
---|---|
private java.util.Properties |
appComponents
This factory's component settings. |
private java.util.Properties |
appSettings
This factory's application settings. |
private DAOFactory |
daoFactory
This factory's DAOFactory . |
(package private) static org.apache.commons.logging.Log |
log
|
private Settings |
settings
This factory's Settings instance. |
private User |
user
This factory's User . |
Constructor Summary | |
---|---|
BusinessObjectFactoryImpl()
|
|
BusinessObjectFactoryImpl(Settings settings)
|
Method Summary | |
---|---|
java.lang.Object |
createObject(java.lang.String type)
Creates a business object. |
java.lang.Object |
createObjectFromClassName(java.lang.String className)
Creates a business object. |
java.lang.Object |
createUtilsObject(java.lang.String type)
Given a type corresponding to a key in the appComponents.properties file, creates and returns a
utility object corresponding to the key. |
java.util.Properties |
getAppComponents()
Retrieves the application components previously set for this factory. |
java.util.Properties |
getAppSettings()
Retrieves the application settings previously set for this factory. |
DAOFactory |
getDaoFactory()
Retrieves the DAOFactory previously set for this factory. |
Settings |
getSettings()
Retrieves the Settings previously set for this factory. |
java.util.Map |
getTransferMap()
Creates a Map of this factory's properties. |
User |
getUser()
Retrieves the User previously set for this factory. |
java.util.Collection |
invokeMultipleCollectionProcessors(java.lang.String type,
java.lang.String method,
java.util.Map argument)
Given a type corresponding to a key in the appComponents.properties file, a method name, and a Map as
the argument, loops through all BusinessProcessor s
configured in appComponents.properties , calling each in
turn. |
java.util.Map |
invokeMultipleProcessors(java.lang.String type,
java.lang.String method,
java.util.Map argument)
Given a type corresponding to a key in the appComponents.properties file, a method name, and a
Map as the argument, loops through all
BusinessProcessor s configured in
appComponents.properties , calling each in turn. |
void |
setAppComponents(java.util.Properties appComponents)
Sets this factory's application components. |
void |
setAppSettings(java.util.Properties appSettings)
Sets this factory's application settings. |
void |
setDaoFactory(DAOFactory daoFactory)
Sets this factory's DAOFactory . |
void |
setSettings(Settings settings)
Sets this factory's Settings instance. |
void |
setUser(User user)
Sets this factory's User . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static org.apache.commons.logging.Log log
private User user
User
. The current User
accessing the system, for which business processing is to be performed by
business objects created by this factory. This factory will pass the
User
to every business object it creates.
private Settings settings
Settings
instance. The current
Settings
, containing various settings to be used by
business objects created by this factory. This factory will pass the
Settings
to every business object it creates.
private java.util.Properties appSettings
SettingsBean
, which
stores settings drawn from the database.
private java.util.Properties appComponents
private DAOFactory daoFactory
DAOFactory
. The current
DAOFactory
for the system, which will allow business
objects created by this factory to create data access objects. This
factory will pass the DAOFactory
to every business object
it creates.
Constructor Detail |
---|
public BusinessObjectFactoryImpl()
public BusinessObjectFactoryImpl(Settings settings)
Method Detail |
---|
public User getUser()
BusinessObjectFactory
User
previously set for this factory.
getUser
in interface BusinessObjectFactory
User
object that represents the user currently
accessing the system.public void setUser(User user)
BusinessObjectFactory
User
. This factory will pass the
User
to every business object it creates.
setUser
in interface BusinessObjectFactory
user
- The current User
accessing the system, for
which business processing is to be performed by business
objects created by this factory.public Settings getSettings()
BusinessObjectFactory
Settings
previously set for this factory.
getSettings
in interface BusinessObjectFactory
Settings
object that represents various settings
for the system.public void setSettings(Settings settings)
BusinessObjectFactory
Settings
instance. This factory will
pass the Settings
to every business object it creates.
setSettings
in interface BusinessObjectFactory
settings
- The current Settings
for the system, containing
various settings to be used by business objects created by
this factory.public java.util.Properties getAppSettings()
BusinessObjectFactory
Settings
, which stores settings drawn from the
database.
getAppSettings
in interface BusinessObjectFactory
Properties
object that represents various
settings for the application.public void setAppSettings(java.util.Properties appSettings)
BusinessObjectFactory
Settings
interface, which stores settings drawn from the
database.
setAppSettings
in interface BusinessObjectFactory
appSettings
- The current application settings in effect for the system.public java.util.Properties getAppComponents()
BusinessObjectFactory
getAppComponents
in interface BusinessObjectFactory
Properties
object that represents the components
for the application.public void setAppComponents(java.util.Properties appComponents)
BusinessObjectFactory
setAppComponents
in interface BusinessObjectFactory
appComponents
- The current application components in effect for the system.public DAOFactory getDaoFactory()
BusinessObjectFactory
DAOFactory
previously set for this factory.
getDaoFactory
in interface BusinessObjectFactory
DAOFactory
object that can be used to create
data access objects.public void setDaoFactory(DAOFactory daoFactory)
BusinessObjectFactory
DAOFactory
. This factory will pass
the DAOFactory
to every business object it creates.
setDaoFactory
in interface BusinessObjectFactory
daoFactory
- The current DAOFactory
for the system, which
will allow business objects created by this factory to create
data access objects.public java.lang.Object createObject(java.lang.String type) throws java.lang.Exception
BusinessObjectFactory
A lookup is performed first to find the fully-qualified Java class name
of the object to create. The type
parameter corresponds to
a key in the appComponents.properties
file. This factory
uses its appComponents
property to perform the lookup.
If the Java class name is found, an object is created, and then this factory populates it with its own properties. These properties allow the newly create object to communicate with the rest of the application.
createObject
in interface BusinessObjectFactory
type
- A String
associated with the class name of the
business object to be created.
null
, if an error occurs.
java.lang.Exception
public java.lang.Object createObjectFromClassName(java.lang.String className) throws java.lang.Exception
BusinessObjectFactory
Using the className
parameter, this factory creates an
object, and then populates it with its own properties. These properties
allow the newly create object to communicate with the rest of the
application.
createObjectFromClassName
in interface BusinessObjectFactory
className
- A String
associated with the class name of the
business object to be created.
null
, if an error occurs.
java.lang.Exception
public java.lang.Object createUtilsObject(java.lang.String type)
BusinessObjectFactory
appComponents.properties
file, creates and returns a
utility object corresponding to the key.
If no class can be instantiated for the given class name, an instance of one of the following classes is automatically returned (depending on the value of the type parameter):
createUtilsObject
in interface BusinessObjectFactory
type
- A String
such as "formUtilsImplementer"
corresponding to a key in the
appComponents.properties
file.
public java.util.Map invokeMultipleProcessors(java.lang.String type, java.lang.String method, java.util.Map argument) throws java.lang.Exception
BusinessObjectFactory
appComponents.properties
file, a method name, and a
Map
as the argument, loops through all
BusinessProcessor
s configured in
appComponents.properties
, calling each in turn. Returns a
Map
compling all the results of each
BusinessProcessor
called. If any of the
BusinessProcessor
s returns a Map
with a
key of resultCode
that is not equal to "0", processing of
all remaining processors is halted, and this method returns immediately.
invokeMultipleProcessors
in interface BusinessObjectFactory
type
- A String such as "activePaymentProcessors" corresponding to a
key in the appComponents.properties
file.method
- The method of each BusinessProcessor
to invoke
in turn.argument
- A Map
representing the single argument the
method accepts.
Map
representing all the results of each
processor combined. They are combined into a single
Map
using the Map.putAll()
method.
java.lang.Exception
public java.util.Collection invokeMultipleCollectionProcessors(java.lang.String type, java.lang.String method, java.util.Map argument) throws java.lang.Exception
BusinessObjectFactory
appComponents.properties
file, a method name, and a Map as
the argument, loops through all BusinessProcessor
s
configured in appComponents.properties
, calling each in
turn. Returns a Collection
compling all the results of
each BusinessProcessor
called.
invokeMultipleCollectionProcessors
in interface BusinessObjectFactory
type
- A String
such as "activeShippingProcessors"
corresponding to a key in the
appComponents.properties
file.method
- The method of each BusinessProcessor
to invoke
in turn. (E.g. "loadShippingOptions")argument
- A Map
representing the single argument the
method accepts.
Collection
representing all the results of each
processor combined.
java.lang.Exception
public java.util.Map getTransferMap()
Map
of this factory's properties. This factory
will pass the Map
to the
initialize(Map parameters)
method of each business object
it creates, which in turn populates the object's properties.
Map
of this factory's properties.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |