Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.roller.model
Class RollerFactory  view RollerFactory download RollerFactory.java

java.lang.Object
  extended byorg.roller.model.RollerFactory

public abstract class RollerFactory
extends java.lang.Object

This is primarily a static holder for whatever Roller implementation is being used. RollerContext should call setRoller(ServletContext) during its initialization so that the Roller implementation can be instantiated. Likewise, RollerContext.getRoller() should be replaced with calls to RollerFactory.getRoller(). This should prevent us any direct ties to Castor and permit for experimentation* with other persistence frameworks.


Field Summary
private static java.lang.String DEFAULT_IMPL
           
private static org.apache.commons.logging.Log mLogger
           
private static java.lang.String ROLLER_IMPL_KEY
           
private static Roller rollerInstance
           
 
Constructor Summary
private RollerFactory()
          Let's just be doubling certain this class cannot be instantiated.
 
Method Summary
static Roller getRoller()
          Static accessor for the instance of Roller held by this class.
static void setRoller(Roller roller)
           
static void setRoller(javax.servlet.ServletContext ctx)
          Looks up which implementation to use by the key ROLLER_IMPL_KEY and use reflection to call the implementation's instantiate(ServletContext ctx) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLLER_IMPL_KEY

private static final java.lang.String ROLLER_IMPL_KEY
See Also:
Constant Field Values

DEFAULT_IMPL

private static final java.lang.String DEFAULT_IMPL
See Also:
Constant Field Values

rollerInstance

private static Roller rollerInstance

mLogger

private static org.apache.commons.logging.Log mLogger
Constructor Detail

RollerFactory

private RollerFactory()
Let's just be doubling certain this class cannot be instantiated.

Method Detail

getRoller

public static Roller getRoller()
Static accessor for the instance of Roller held by this class.


setRoller

public static void setRoller(javax.servlet.ServletContext ctx)
Looks up which implementation to use by the key ROLLER_IMPL_KEY and use reflection to call the implementation's instantiate(ServletContext ctx) method. Should this fail (either no implementation is specified or instantiate() throws an Exception) than the DEFAULT_IMPL will be tried. If this should fail as well that is bad news!


setRoller

public static void setRoller(Roller roller)