ca.cbc.sportwire.servlet.data
Class BeanFactory
java.lang.Object
|
+--ca.cbc.sportwire.servlet.data.BeanFactory
- All Implemented Interfaces:
- SportPageProperties
- public class BeanFactory
- extends java.lang.Object
- implements SportPageProperties
BeanFactory.java: create an instance of the specified
class first by trying a getInstance(context) or
getInstance(ExtendedProperties) method, then getInstance() and
finally try for a null constructor. This can be used to
dynamically load any JavaBean from within a template or page
handler.
Created: Mon Jan 7 14:58:54 2002
$Log: BeanFactory.java,v $
Revision 1.4 2002/02/10 05:45:43 garym
implement $xml.doms(perlregex)
Revision 1.3 2002/01/29 21:08:00 garym
beans now loaded after topic context is built
Revision 1.2 2002/01/24 19:50:20 garym
Major restructuring of beans and pagehandlers
Revision 1.1 2002/01/09 04:28:59 garym
Added test unit stubs and new News support
- Version:
- $Id: BeanFactory.java,v 1.4 2002/02/10 05:45:43 garym Exp $
- Author:
- Gary Lawrence Murphy
Fields inherited from interface ca.cbc.sportwire.servlet.data.SportPageProperties |
BEAN_SUFFIX, BEANFACTORY_VAR, CONTEXT_VAR, DATE_VAR, DEFAULT_EXTS, DEFAULT_INDEXES, DEFAULT_PAGE_SUFFIX, DEFAULT_SAX_DRIVER_CLASS, DEFAULT_TIMEZONE, DEFAULT_TOPIC, DOM_VAR, ERROR_TEMPLATE_VAR, EXCEPTION_VAR, EXTENSIONS_VAR, FALSE, GLOBAL_VAR, HOME_PROPERTY, INCLUDE_EXTS_PROPERTY, INCLUDE_VAR, INDEX_INDICATOR_VAR, INDEX_TEMPLATE_VAR, LAYOUT_TEMPLATE_VAR, MACRO_LIB_PROPERTY, MISSING_TEMPLATE_VAR, OUTPUT_VAR, PAGE_EXPIRE, PAGE_TEMPLATE_VAR, PANIC_404_PAGE, PANIC_404_PROPERTY, PANIC_500_PAGE, PANIC_500_PROPERTY, PARAM_PARSER_VAR, PATH_VAR, REQUEST_VAR, RESPONSE_VAR, SAX_CLASS_PROPERTY, SERVLET_DEBUG, SERVLET_LOGCONF_PROPERTY, SQL_SUFFIX, TEMPLATE_PATHS_PROPERTY, TIMEZONE_PROPERTY, TRUE, URI_VAR, VELOCITY_LOGFILE_DEFAULT, VELOCITY_LOGFILE_PROPERTY, XML_EXTS, XML_EXTS_PROPERTY, XML_PATHS_PROPERTY, XML_SUFFIX, XSL_EXTS, XSL_EXTS_PROPERTY, XSL_PATHS_PROPERTY |
Method Summary |
static java.lang.Object |
getBean(org.apache.velocity.context.Context context,
java.lang.String classname)
getBean : For SportPage beans that depend on the
page context, attempts a getInstance(Context) before falling
back to the no-context case. |
static java.lang.Object |
getBean(org.apache.commons.collections.ExtendedProperties sc,
java.lang.String classname)
getBean : For SportPage beans that depend only on
the system config properties, attempts a
getInstance(ExtendedProperties) before falling back to the
no-context case. |
static java.lang.Object |
getBean(java.lang.String classname)
getBean : no context method for non-SportPage
beans, tries for a getInstance() and the a null constructor. |
static BeanFactory |
getInstance(org.apache.commons.collections.ExtendedProperties sc)
getInstance : BeanFactory can be used as class
methods, or used within a Velocity template as a singleton
variable value (ie $javabeans) |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
cat
static org.apache.log4j.Category cat
_instance
private static BeanFactory _instance
BeanFactory
private BeanFactory()
getInstance
public static BeanFactory getInstance(org.apache.commons.collections.ExtendedProperties sc)
getInstance
: BeanFactory can be used as class
methods, or used within a Velocity template as a singleton
variable value (ie $javabeans)
- Parameters:
sc
- an ExtendedProperties
value- Returns:
- a
BeanFactory
value
getBean
public static java.lang.Object getBean(org.apache.velocity.context.Context context,
java.lang.String classname)
throws java.lang.NoSuchMethodException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.InstantiationException
getBean
: For SportPage beans that depend on the
page context, attempts a getInstance(Context) before falling
back to the no-context case.
- Parameters:
context
- a Context
valueclassname
- a String
value- Returns:
- an
Object
value - Throws:
java.lang.NoSuchMethodException
- if an error occursjava.lang.ClassNotFoundException
- if an error occursjava.lang.IllegalAccessException
- if an error occursjava.lang.reflect.InvocationTargetException
- if an error occursjava.lang.InstantiationException
- if an error occurs
getBean
public static java.lang.Object getBean(org.apache.commons.collections.ExtendedProperties sc,
java.lang.String classname)
throws java.lang.NoSuchMethodException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.InstantiationException
getBean
: For SportPage beans that depend only on
the system config properties, attempts a
getInstance(ExtendedProperties) before falling back to the
no-context case.
- Parameters:
sc
- an ExtendedProperties
valueclassname
- a String
value- Returns:
- an
Object
value - Throws:
java.lang.NoSuchMethodException
- if an error occursjava.lang.ClassNotFoundException
- if an error occursjava.lang.IllegalAccessException
- if an error occursjava.lang.reflect.InvocationTargetException
- if an error occursjava.lang.InstantiationException
- if an error occurs
getBean
public static java.lang.Object getBean(java.lang.String classname)
throws java.lang.NoSuchMethodException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.InstantiationException
getBean
: no context method for non-SportPage
beans, tries for a getInstance() and the a null constructor.
- Parameters:
classname
- a String
value- Returns:
- an
Object
value - Throws:
java.lang.NoSuchMethodException
- if an error occursjava.lang.ClassNotFoundException
- if an error occursjava.lang.IllegalAccessException
- if an error occursjava.lang.reflect.InvocationTargetException
- if an error occursjava.lang.InstantiationException
- if an error occurs