|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.melati.app.AbstractConfigApp org.melati.app.AbstractPoemApp
public abstract class AbstractPoemApp
Base class to use Poem as an application.
Simply extend this class and override the doPoemRequest(org.melati.Melati)
method.
If you are going to use a template engine look at AbstractTemplateApp
.
these components are broken out of the command line arguments and passed to your application code in the
db
db method
db table method
db table troid method
Melati
parameter.
db | The first argument is taken to be the `logical name' of the POEM database to which the servlet should connect. It is mapped onto JDBC connection details via the config file org.melati.LogicalDatabase.properties, of which there is an example in the source tree. This is automatically made available in templates as $melati.Database. |
table | The name of a table to work on: perhaps it is meant to list its contents. This is automatically made available in templates as $melati.Table. |
troid | The POEM `troid' (table row identifier, or row-unique integer) of a row within a table. This is automatically made available in templates as $melati.Object. |
method | A freeform string telling your servlet what it is meant to do. This is automatically made available in templates as $melati.Method. |
poemContext(org.melati.Melati)
.
-username user -password password
Database.guestAccessToken()
,
PoemThread.commit()
,
PoemThread.rollback()
,
poemContext(org.melati.Melati)
,
AccessHandler
,
HttpSessionAccessHandler
,
Login
,
OpenAccessHandler
,
CommandLineAccessHandler
Field Summary |
---|
Fields inherited from class org.melati.app.AbstractConfigApp |
---|
melatiConfig, output |
Constructor Summary | |
---|---|
AbstractPoemApp()
|
Method Summary | |
---|---|
protected void |
_handleException(Melati melati,
Exception exception)
|
protected void |
doConfiguredRequest(Melati melati)
Instantiate this method to build up your own output. |
protected abstract void |
doPoemRequest(Melati melati)
Override this method to do your own thing. |
protected static void |
handleException(Melati melati,
Exception exception)
Default method to handle an exception. |
Melati |
init(String[] args)
Initialise. |
protected PoemContext |
poemContext(Melati melati)
Set up the (@link PoemContext}, but only the Method. |
protected PoemContext |
poemContextWithLDB(Melati melati,
String logicalDatabase)
This is provided for convenience, so you don't have to specify the logical database in the arguments. |
protected void |
prePoemSession(Melati melati)
A place holder for things you might want to do before setting up a PoemSession . |
protected void |
setTableTroidMethod(PoemContext pc,
String[] args)
|
void |
term(Melati melati)
Clean up at end of run. |
Methods inherited from class org.melati.app.AbstractConfigApp |
---|
applyNamedArguments, getSysAdminEmail, getSysAdminName, melatiConfig, run, setOutput |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.melati.app.App |
---|
run, setOutput |
Constructor Detail |
---|
public AbstractPoemApp()
Method Detail |
---|
public Melati init(String[] args) throws MelatiException
init
in class AbstractConfigApp
args
- the command line arguments
MelatiException
- if something goes wrong during initialisationAbstractConfigApp.init(java.lang.String[])
public void term(Melati melati) throws IOException
term
in class AbstractConfigApp
melati
- the melati
IOException
protected void prePoemSession(Melati melati) throws Exception
PoemSession
.
melati
- the current Melati
Exception
- if anything goes wrongprotected void doConfiguredRequest(Melati melati)
AbstractConfigApp
doConfiguredRequest
in class AbstractConfigApp
melati
- a configured Melati
protected static void handleException(Melati melati, Exception exception) throws Exception
melati
- the Melatiexception
- the exception to handle
Exception
protected final void _handleException(Melati melati, Exception exception) throws Exception
Exception
protected PoemContext poemContext(Melati melati) throws InvalidArgumentsException
AbstractConfigApp
poemContext
in class AbstractConfigApp
melati
- the current Melati
PoemContext
InvalidArgumentsException
protected void setTableTroidMethod(PoemContext pc, String[] args)
protected PoemContext poemContextWithLDB(Melati melati, String logicalDatabase) throws InvalidArgumentsException
poemContext(Melati melati)
thus:
protected PoemContext poemContext(Melati melati) throws InvalidArgumentsException { return poemContextWithLDB(melati,""); }
InvalidArgumentsException
protected abstract void doPoemRequest(Melati melati) throws Exception
melati
- a Melati
containing POEM and other configuration data
Exception
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |