|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.appworx.AbstractApplication
public abstract class AbstractApplication
Common code shared by all different kinds of Tentackle applications,
such as Application, ApplicationServer or WebApplication
| Constructor Summary | |
|---|---|
AbstractApplication()
Super constructor for all derived classes. |
|
| Method Summary | |
|---|---|
ContextDb |
createContextDb(Db db)
Creates the contextdb. |
Db |
createDb(AppUserInfo userInfo)
Creates a db (still closed). |
ModificationThread |
createModificationThread()
Creates the modification thread ready for being started. |
AppUserInfo |
createUserInfo(String username,
char[] password,
String dbPropertiesBaseName)
Creates a user info. |
protected void |
detectEE()
Detects whether this application is running within an EE-container. |
protected void |
detectJNLP()
Detects whether this application has been started by JNLP (Java Webstart). |
protected void |
doConfigureApplication()
Do anything what's necessary after the connection has been established. |
protected void |
doFinishStartup()
Finishes the startup. The default implementation starts the modification thread, unless the property "nomodthread" is given. |
protected void |
doInitialize()
Initializes the application. |
ContextDb |
getContextDb()
Gets the server's database context. |
Db |
getDb()
Gets the db connection. |
Properties |
getProperties()
Gets the current properties. |
String |
getProperty(String key)
Gets a property. |
static AbstractApplication |
getRunningApplication()
Gets the (singleton) application instance currently running. |
AppDbObject |
getUser()
Gets the AppDbObject corresponding to the userId in AppUserInfo. |
AppDbObject |
getUser(long userId)
Gets the AppDbObject corresponding to the object-ID of a user entity. |
AppUserInfo |
getUserInfo()
Gets the user info. |
protected void |
installPreferences()
Installs the preferences backend. The default implementation installs the DbPreferencesFactory unless
the property "nodbprefs" is defined. |
protected void |
installSecurityManager()
installs the tentackle security manager |
boolean |
isDeployedByEE()
Indicates whether this application is running within an EE-container. |
boolean |
isDeployedByJNLP()
Indicates whether this application has been started by JNLP (Java Webstart). |
protected void |
register()
Registers the application. |
protected void |
securityRulesChanged()
Invoked whenever the security rules change. |
void |
setContextDb(ContextDb contextDb)
Sets the context db. Some apps change the context during runtime. |
void |
setProperties(Properties props)
Sets the properties to configure the application. |
void |
setUserInfo(AppUserInfo userInfo)
Sets the user info. |
protected void |
unregister()
Unregisters the application. |
void |
updateUserId()
Updates the user id of the userinfo after logged into a remote server. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractApplication()
| Method Detail |
|---|
protected void register()
throws ApplicationException
ApplicationException - if an application is already running.
protected void unregister()
throws ApplicationException
ApplicationException - if an application is already running.public static AbstractApplication getRunningApplication()
Notice: the method is not synchronized because no serious application will invoke getApplication() before getting itself up and running. So, we leave off these singleton maniac codings here.
public boolean isDeployedByEE()
protected void detectEE()
isDeployedByEE().
public boolean isDeployedByJNLP()
protected void detectJNLP()
isDeployedByJNLP().
public void setProperties(Properties props)
Must be set before starting the application.
By default the following properties will be honoured:
props - the properties to configure the applicationpublic Properties getProperties()
public String getProperty(String key)
key - the property's name
public Db getDb()
public void setContextDb(ContextDb contextDb)
contextDb - the new contextpublic ContextDb getContextDb()
public AppUserInfo getUserInfo()
public void setUserInfo(AppUserInfo userInfo)
userInfo - the user info
public void updateUserId()
throws ApplicationException
ApplicationExceptionpublic AppDbObject getUser(long userId)
Should be overridden if application provides a user entity. The default implementation returns null.
userId - the user id
public AppDbObject getUser()
AppUserInfo.
The default implementation invokes getUser(long).
public AppUserInfo createUserInfo(String username,
char[] password,
String dbPropertiesBaseName)
username - is the name of the user, null if System.getProperty("user.name")password - is the password, null if nonedbPropertiesBaseName - is the resource bundle basename of the db-property file, null if "Db"
public Db createDb(AppUserInfo userInfo)
userInfo - the user info
public ContextDb createContextDb(Db db)
db - the database connection
public ModificationThread createModificationThread()
protected void installPreferences()
DbPreferencesFactory unless
the property "nodbprefs" is defined. The server uses the system preferences.
The property "userprefs" forces usage of user preferences (default is system prefs for servers).
The preferences are set to be readonly by default.
protected void installSecurityManager()
protected void securityRulesChanged()
protected void doInitialize()
throws ApplicationException
This is the first step when an application is launched.
The default implementation first parses the properties for system properties.
System properties start with "SYSTEM_" followed by the original property name.
Then the Java security manager is installed if the property "secman=...." is given.
Overrides should invoke super.doInitialize() and perform any other
necessary steps before construction of the GUI.
ApplicationException - if initialization failes
protected void doConfigureApplication()
throws ApplicationException
ApplicationException
protected void doFinishStartup()
throws ApplicationException
"nomodthread" is given.
ApplicationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||