|
Project Wonder 5.0.0.8654 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecter.extensions.ERXFrameworkPrincipal
public abstract class ERXFrameworkPrincipal
Designated starter class for frameworks, adds support for dependency management.
Allows you to disregard your framework order in the class path (at least where
startup is concerned, if you override actual classes you still need to take care.)
The initialize() method will be called directly after your principal
is instantiated.
The finishInitialization() method will be called when the app finishes
startup but before it will begin to process requests.
If you define
public static Class[] REQUIRES = Class[] {...}
all the classes (which must be assignable from this class) will get
loaded before your principal.
public class ExampleFrameworkPrincipal extends ERXFrameworkPrincipal {
public static final Logger log = Logger.getLogger(ExampleFrameworkPrincipal.class);
protected static ExampleFrameworkPrincipal sharedInstance;
public final static Class REQUIRES[] = new Class[] {ERXExtensions.class, ERDirectToWeb.class, ERJavaMail.class};
// Registers the class as the framework principal
static {
setUpFrameworkPrincipalClass(ExampleFrameworkPrincipal.class);
}
public static ExampleFrameworkPrincipal sharedInstance() {
if (sharedInstance == null) {
sharedInstance = (ExampleFrameworkPrincipal)sharedInstance(ExampleFrameworkPrincipal.class);
}
return sharedInstance;
}
public void initialize() {
// code during startup
}
public void finishInitialization() {
// Initialized shared data
}
}
| Nested Class Summary | |
|---|---|
static class |
ERXFrameworkPrincipal.Observer
|
| Field Summary | |
|---|---|
protected Logger |
log
logging support |
| Constructor Summary | |
|---|---|
ERXFrameworkPrincipal()
|
|
| Method Summary | ||
|---|---|---|
abstract void |
finishInitialization()
Overridden by subclasses to provide framework initialization. |
|
protected void |
initialize()
Called directly after the contructor. |
|
static void |
setUpFrameworkPrincipalClass(Class c)
Sets up a given framework principal class to recieve notification when it is safe for the framework to be initialized. |
|
static
|
sharedInstance(Class<T> c)
Gets the shared framework principal instance for a given class. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Logger log
| Constructor Detail |
|---|
public ERXFrameworkPrincipal()
| Method Detail |
|---|
public static <T extends ERXFrameworkPrincipal> T sharedInstance(Class<T> c)
c - principal class for a given framework
public static void setUpFrameworkPrincipalClass(Class c)
c - principal classprotected void initialize()
public abstract void finishInitialization()
public String toString()
toString in class Object
|
Last updated: Thu, Nov 20, 2008 04:36 AM EST | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||