|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.melati.app.AbstractConfigApp
public abstract class AbstractConfigApp
ConfigApp is the simplest way to use Melati.
All a ConfigApp does is to configure a Melati. Importantly it does not
establish a Poem session leaving you to do this for yourself.
If you want a POEM session established, please extend AbstractPoemApp
.
ConfigApp does set up a basic PoemContext
with the Method set, but
not the POEM logicaldatabase, table or troid.
The arguments are expected to end with a freeform string telling your
application what it is meant to do. This is automatically made available in
templates as $melati.Method.
You can change the way these things are determined by overriding
poemContext(org.melati.Melati)
.
Field Summary | |
---|---|
protected static MelatiConfig |
melatiConfig
|
protected PrintStream |
output
|
Constructor Summary | |
---|---|
AbstractConfigApp()
|
Method Summary | |
---|---|
protected String[] |
applyNamedArguments(String[] arguments)
|
protected abstract void |
doConfiguredRequest(Melati melati)
Instantiate this method to build up your own output. |
String |
getSysAdminEmail()
This method SHOULD be overidden. |
String |
getSysAdminName()
This method SHOULD be overidden. |
Melati |
init(String[] args)
Initialise. |
protected MelatiConfig |
melatiConfig()
Set application properties from the default properties file. |
protected PoemContext |
poemContext(Melati melati)
Set up the (@link PoemContext}, but only the Method. |
void |
run(String[] args)
Do our thing. |
void |
setOutput(PrintStream out)
Set output. |
void |
term(Melati melati)
Clean up at end of run. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static MelatiConfig melatiConfig
protected PrintStream output
Constructor Detail |
---|
public AbstractConfigApp()
Method Detail |
---|
public Melati init(String[] args) throws MelatiException
args
- the command line arguments
MelatiException
- if something goes wrong during initialisationpublic void term(Melati melati) throws IOException
melati
- the melati
IOException
- if there is an io problemprotected MelatiConfig melatiConfig() throws MelatiException
OpenAccessHandler
.
Similarly ServletTemplateEngine is changed to TemplateEngine.
To override any setting from MelatiConfig.properties, simply override this
method and return a vaild MelatiConfig.
eg to use a different AccessHandler from the default:
protected MelatiConfig melatiConfig() throws MelatiException { MelatiConfig config = super.melatiConfig(); config.setAccessHandler(new YourAccessHandler()); return config; }
MelatiException
- if anything goes wrong with Melatipublic void run(String[] args) throws Exception
run
in interface App
Exception
public String getSysAdminName()
public String getSysAdminEmail()
protected PoemContext poemContext(Melati melati)
melati
- the current Melati
PoemContext
protected String[] applyNamedArguments(String[] arguments)
public void setOutput(PrintStream out)
setOutput
in interface App
out
- where to write toApp.setOutput(java.io.PrintStream)
protected abstract void doConfiguredRequest(Melati melati) throws Exception
melati
- a configured Melati
Exception
- if anything goes wrong
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |