|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.sapportals.wcm.util.factories.AbstractObjectFactory
A factory which produces configurable objects.
The classes to load are specified by the classname from the configuration
properties.
The objects classes are specified by a commata separated list in the
configuration, e.g.:
factory .list = id , id
, ...
For each id at least a classname has to be specified and an optional
singleton flag, e.g.:
factory . id .class = classname
factory . id .singleton = true
Additional parameters in the form
factory . id . xxx =
...
can be passed to the object's constructor.
| Inner Class Summary | |
protected class |
AbstractObjectFactory.ObjectClassEntry
An object class entry represents the information about the several objects to be created by the factory. |
| Field Summary | |
protected static java.lang.String |
CONFIG_OBJECTLIST_SEPARATOR
Configuration value for the object id list separator. |
protected static java.lang.String |
CONFIG_OBJECTLIST_TAG
Configuration tag for the object id list. |
protected static java.lang.String |
CONFIG_SINGLETON_DEFAULT
Default configuration value for the singleton flag. |
protected static java.lang.String |
CONFIG_SINGLETON_TAG
Configuration tag for the singleton flag. |
protected java.lang.String |
m_ID
The id of the factory. |
protected java.lang.String |
m_LogName
A short name for logging. |
protected java.util.HashMap |
m_ObjectMap
The map of ObjectClassEntry |
protected java.util.Properties |
m_Properties
The properties (with prefix factory -id) from the config file. |
protected static int |
MULTI
Code for a multi-instance AbstractObjectFactory . |
protected static int |
SINGLETON
Code for a singleton AbstractObjectFactory (singleton per id). |
| Constructor Summary | |
|
AbstractObjectFactory(java.lang.String id)
Create an AbstractObjectFactory for a given factory-id
. |
protected |
AbstractObjectFactory(java.lang.String logName,
java.lang.String id)
Create an AbstractObjectFactory for a given factory-id
. |
| Method Summary | |
java.util.Collection |
getAllObjectInstances()
Get a list with one instance for each available object class. |
protected static AbstractObjectFactory |
getFactoryInstance(java.lang.String id,
java.lang.Class classObject,
int instanceType)
Get an initialized instance of a factory for the given id . |
protected java.lang.Object[] |
getObjectConstructorParameters(java.lang.String id,
java.util.Properties properties)
Get the actual parameter for the object's constructor. |
protected java.lang.Class[] |
getObjectConstructorParameterTypes(java.lang.String id)
Get the parameter types for the object classes' constructor. |
protected java.lang.Object |
getObjectInstance(java.lang.String id)
Create a new instance from the ObjectClassEntry for the given
id. |
protected java.util.HashMap |
loadObjectMap(com.sapportals.config.fwk.IConfigurable[] configurables)
|
protected java.util.HashMap |
loadObjectMap(java.lang.String list,
java.lang.String listSeparator,
java.util.Properties properties)
Load the object classes into a map with pairs of id ,
ObjectEntry s. |
protected AbstractObjectFactory.ObjectClassEntry |
newObjectListEntry(java.lang.String id,
java.lang.reflect.Constructor constructor,
java.util.Properties properties,
boolean singletonFlag)
Create a new object class entry for the object class list. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String m_LogName
protected java.lang.String m_ID
protected java.util.Properties m_Properties
protected java.util.HashMap m_ObjectMap
ObjectClassEntrys, indexed by object class id.protected static final java.lang.String CONFIG_OBJECTLIST_TAG
protected static final java.lang.String CONFIG_OBJECTLIST_SEPARATOR
protected static final java.lang.String CONFIG_SINGLETON_TAG
protected static final java.lang.String CONFIG_SINGLETON_DEFAULT
protected static final int SINGLETON
AbstractObjectFactory (singleton per id).protected static final int MULTI
AbstractObjectFactory .| Constructor Detail |
public AbstractObjectFactory(java.lang.String id)
throws WcmException
AbstractObjectFactory for a given factory-id
. Should call super( logName , id
) . Note : This constructor has to be public (although
it should be protected), to allow the abstract factory the creation of a
new derived factories via reflection.id - a String with the unique id of the factory
used as a prefix for the configuration parameters.WcmException - Exception raised in failure situation
protected AbstractObjectFactory(java.lang.String logName,
java.lang.String id)
throws WcmException
AbstractObjectFactory for a given factory-id
. Note : This constructor has to be public (although it should be
protected), to allow the newFactory() -method the creation of
new factories.logName - a String with the factory's short name (for
logging).id - a String with the unique id of the factory
used as a prefix for the configuration parameters.WcmException - Exception raised in failure situation| Method Detail |
public java.util.Collection getAllObjectInstances()
throws WcmException
Collection of Object s, which may be
empty if no object class exists.WcmException - if an error occured while creating the
list.protected java.lang.Class[] getObjectConstructorParameterTypes(java.lang.String id)
id - a String with the id of the object class to get the
parameter types for.
protected java.lang.Object[] getObjectConstructorParameters(java.lang.String id,
java.util.Properties properties)
throws WcmException
id - a String with the id of the object to get the
parameter for.properties - WcmException - Exception raised in failure situation
protected java.lang.Object getObjectInstance(java.lang.String id)
throws WcmException
ObjectClassEntry for the given
id.id - a String with the id of the object class.Object with an instance of the requested object
class specified by the id or null if the id is not found.WcmException - if an object cannot be created.
protected java.util.HashMap loadObjectMap(java.lang.String list,
java.lang.String listSeparator,
java.util.Properties properties)
throws WcmException
ObjectEntry s.list - a String with a list of id strings for the object
classes to load.listSeparator - a String with the separators for the list
string.properties - the Properties to use for searching the
object classes class name and to pass to those object classes.WcmException - if an error occured.
protected java.util.HashMap loadObjectMap(com.sapportals.config.fwk.IConfigurable[] configurables)
throws WcmException
configurables - WcmException - Exception raised in failure situation
protected AbstractObjectFactory.ObjectClassEntry newObjectListEntry(java.lang.String id,
java.lang.reflect.Constructor constructor,
java.util.Properties properties,
boolean singletonFlag)
id - a String with the id of the object class.constructor - the Constructor for the object class.properties - the Properties for the object class.singletonFlag - a boolean true if this
object class should have only one instance, false if not.
protected static AbstractObjectFactory getFactoryInstance(java.lang.String id,
java.lang.Class classObject,
int instanceType)
throws WcmException
type code for the singleton/multi
instance behavior.id - a String with the id for the factory.classObject - the Class of the (derived) factory.instanceType - an int with the instance type (
SINGLETON or MULTI ).AbstractObjectFactory with an instance of the
(derived) factory as.WcmException - if the factory cannot be initialized.
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||