|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.nakedobjects.Application
org.nakedobjects.Exploration
Template for creating a standalone application. To create a runnable
application subclass this class and implement the classSet
method listing therein the classes to be made available.
It is also possible to override the configurationFile
,
installObjectStore
and installApplication
methods,
to change the configuration file, object store or viewing mechanism
respectively. While it may occasionally be necessary to change the
configuration file from its default, it is preferable to configure different
object stores or viewing mechanism by changing the appropriate property
within the configuration file.
classSet(NakedClassList)
,
configurationFile()
,
installObjectStore()
,
installApplication(NakedObjectStore)
Field Summary | |
static java.lang.String |
DEFAULT_CONFIG
|
static java.lang.String |
OBJECT_STORE
|
static java.lang.String |
VIEWING_MECHANISM
|
Constructor Summary | |
Exploration()
invokes init method to perform the initialization. |
Method Summary | |
protected void |
addInstance(NakedObject object)
|
abstract void |
classSet(NakedClassList classes)
hook method which the subclass must implement to add any classes into the supplied NakedClassList |
protected java.lang.String |
configurationFile()
hook method to return the name of the configuration file. |
protected NakedObject |
createInstance(java.lang.Class type)
helper method to create an instance of the given type. |
protected NakedObject |
createInstance(java.lang.String typeName)
helper method to create an instance of the given type. |
protected NakedObjectStore |
getObjectStore()
returns the object store set up during initialization |
protected boolean |
hasNoInstances(java.lang.Class cls)
convenience method provided for subclasses, indicating whether there are any instances of the specified class |
protected void |
init()
Loads up a specified configuration file if there is one, else loads up the default config file if it exists. |
protected void |
initObjects()
Hook method allowing subclass to initialize any objects. |
protected ObjectViewingMechanism |
installApplication(NakedObjectStore objectStore)
Called by the init method, this is a hook method to return
the viewing mechanism used to render the objects.
|
protected NakedObjectStore |
installObjectStore()
Called by the init method, this is a hook method to return
the object store to be used to persist objects.
|
Methods inherited from class org.nakedobjects.Application |
configureSystemLogging, hasProperty, loadConfiguration, set, setting |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_CONFIG
public static final java.lang.String OBJECT_STORE
public static final java.lang.String VIEWING_MECHANISM
Constructor Detail |
public Exploration()
init
method to perform the initialization.
init()
Method Detail |
public abstract void classSet(NakedClassList classes)
NakedClassList
classes
- - the list to which naked classes should be added.protected final NakedObjectStore getObjectStore()
init()
protected java.lang.String configurationFile()
init
method.
The default implementation simply returns null, meaning that the default configuration file will be used.
DEFAULT_CONFIG
protected final NakedObject createInstance(java.lang.String typeName)
initObjects()
protected final NakedObject createInstance(java.lang.Class type)
initObjects()
protected void addInstance(NakedObject object)
protected final boolean hasNoInstances(java.lang.Class cls) throws ObjectStoreException
ObjectStoreException
protected final void init() throws ConfigurationException, ObjectStoreException
The configuration file to be loaded is determined by calling
configurationFile
method. If one is specified in this
manner and it cannot be found an error will be given and the system
will exit. Otherwise the default configuration file will be used.
The method then calls installObjectStore
and
installApplication
to obtain the object store and viewing
mechanisms respectively.
After the object store and viewing mechanisms have been initialized,
the method calls the initObjects
method. This is mostly a
convenience during the Exploration phase, allowing commonly used
test objects to be set up. Any such objects created are automatically
made persistent.
Finally, the classSet
method is called, so that the
subclass can register the application's classes.
Any of these methods called can be overridden by subclasses as required.
ConfigurationException
ObjectStoreException
configurationFile()
,
DEFAULT_CONFIG
,
installObjectStore()
,
installApplication(NakedObjectStore)
,
initObjects()
,
classSet(NakedClassList)
,
NakedObjectStore.init()
protected void initObjects() throws ObjectStoreException
TransientObjectStore
is being
returned by the installObjectStore
method).
The default implementation of this method within this class does nothing.
ObjectStoreException
installObjectStore()
,
TransientObjectStore
protected ObjectViewingMechanism installApplication(NakedObjectStore objectStore) throws ConfigurationException
init
method, this is a hook method to return
the viewing mechanism used to render the objects.
The default implementation checks for a
nakedobjects.object-viewing-mechanism
property (value of
VIEWING_MECHANISM
in the configuration file and uses the
class specified there. If none is specified then it defaults to the
GraphicalViewingMechanism
class.
ConfigurationException
init()
,
VIEWING_MECHANISM
,
GraphicalViewingMechanism
protected NakedObjectStore installObjectStore() throws ConfigurationException, ObjectStoreException
init
method, this is a hook method to return
the object store to be used to persist objects.
The default implementation checks for a
nakedobjects.object-store
property (value of
OBJECT_STORE
)in the configuration file and uses the class
specified there. If none is specified then it defaults to the
TransientObjectStore
class, an object store implementation
that provides no persistence between runs.
ConfigurationException
ObjectStoreException
init()
,
OBJECT_STORE
,
TransientObjectStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |