LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.app
Class LyApplication

java.lang.Object
  extended by leon.app.LyApplication
All Implemented Interfaces:
LyTimerClientInterface
Direct Known Subclasses:
LyWebApplication, LyWsApplication

public class LyApplication
extends java.lang.Object
implements LyTimerClientInterface

This class contains all the data that are described in a meta-model. Several applications may be launched in the same process using different meta-models (see leon.app.LyMain to see how to create several applications). For each of them, several sessions may be created using different environments. An application is described by :

See Also:
LyMain, LyDataSession

Field Summary
static java.lang.String __VERSION
          File version.
static char ARRAY_SEP
          Internal separator used for array values.
static char CLASS_SEP
          Separator used by LyObjectId class.
static char FIELD_SEP
          Separator used by LyObjectId class.
static java.lang.String LABEL_SEP
          Separator used for composed title.
 char NAME_SEP
          Separator for objects with several names.
 char VALUE_SEP
          Separator used when multiple values are returned from the graphical input object.
static char VISIBLE_ARRAY_SEP
          Visible separator used for array values.
static char VISIBLE_FIELD_SEP
          Separator used by LyObjectId class.
static char VISIBLE_VALUE_SEP
          Separator used by LyObjectId class.
static java.lang.String VISIBLE_VECTOR_SEP
          Visible separator used for vector values.
 
Constructor Summary
LyApplication(LyApplication parent, LyProject rootProject, java.lang.String id, java.lang.String configFile, java.lang.String path, java.lang.ClassLoader classLoader)
          Constructor with a given id, configuration file and class loader.
LyApplication(LyApplication parent, LyProject rootProject, java.lang.String id, java.lang.String configFile, java.lang.String path, java.lang.ClassLoader classLoader, boolean isMobile)
          Constructor with a given id, configuration file and class loader.
LyApplication(LyApplication parent, java.lang.String id)
          Constructor with a given id.
LyApplication(LyApplication parent, java.lang.String id, java.lang.String configFile, java.lang.String path, java.lang.ClassLoader classLoader)
          Constructor with a given id, configuration file and class loader.
LyApplication(java.lang.String id)
          Constructor with a given id.
LyApplication(java.lang.String id, boolean edited)
          Constructor with a given id.
LyApplication(java.lang.String id, java.lang.String configFile)
          Constructor with a given id and configuration file.
LyApplication(java.lang.String id, java.lang.String configFile, java.lang.ClassLoader classLoader)
          Constructor with a given id and configuration file and a specific classloader.
LyApplication(java.lang.String id, java.lang.String configFile, java.lang.String path, java.lang.ClassLoader classLoader)
          Constructor with a given id, configuration file and class loader.
 
Method Summary
 void abortClosing()
          Abort the closing of an application.
 void addDaemon(LyDaemon daemon)
          Adds a new relation daemon to the application.
 void addDataProvider(LyDataProvider provider)
          Add a data provider to the current application.
static void addListener(LyApplicationListener listener)
          Registers a listener.
 void addSessionListener(LySessionListenerInterface sessionListener)
          Adds a session listener to this application.
 void addValue(java.lang.Object key, java.lang.Object value)
          Adds a pair key-value to the session.
static java.lang.String buildDefaultLocationId(java.lang.String applicationId)
          Computes the default location id for the specified application id.
 boolean checkProviders()
          Method to test if all data providers of this application have some connection with the physical layer.
 void close()
          Closing current application.
static void closeAll()
          Close all remaining applications.
 void createCache(LyClassInfo classInfo)
          Creates the cache for the application of the given class info.
 boolean deleteExtraInfo(LyExtraInfoInterface info)
          Delete given extra info like preferences, charts or treemap configurations.
 void endTimer(LyTimer timer)
          When a LyTimer ends this method is invoked.
 void freeDialogSessions()
          To free all dialog controllers of all sessions.
 LyAction getAction(java.lang.String id)
          Shortcut to get an action of the application.
 LyInfoList<LyAction> getActions()
          To get all the actions registered in the application.
 LyAction getActionWithId(java.lang.String id, LyClassInfo classInfo)
          Get an action of the project with given template id.
 LyAction getActionWithTemplate(java.lang.String id, LyClassInfo classInfo)
          Get an action of the application with given template id.
static LyApplication getApplication(java.lang.String id)
          Retrieves an application.
 LyApplicationBehaviorInterface getApplicationBehavior()
          Returns the behavior of this application.
static java.util.Vector<LyApplication> getApplications()
          Gets list of all applications.
 LyClassInfo getClassInfo(java.lang.String id)
          Shortcut to get a classInfo of the application.
 LyInfoList<LyClassInfo> getClassInfos()
          To get all the class infos registered in the application.
 LyInfoList<LyClassInfo> getClassInfosFromBinding(java.lang.String binding)
          Find classinfos from the peer value (connector value defined in class binding).
 java.lang.ClassLoader getClassLoader()
          Accessor for the specific class loader defined for this application.
 LyContextManager getContextManager()
          Gets the context manager of the current session of this application.
 LyContext getCurrentContext()
          Gets the current context for the current thread.
 LyEvaluator getCurrentEvaluator()
          Gets the current evaluator for the current thread.
 java.lang.Object getCurrentInstance(java.lang.String name)
          Gets the current instance corresponding to specified name for the current thread.
 LyDataSession getCurrentSession()
          Gets the current session for the current thread.
 LyFieldInfoDaemon getDaemon(LyFieldInfo fieldInfo)
          Retrieves the daemon in charge of the specified field info.
 LyLabelDaemon getDaemon(LyInfoLabel label)
          Retrieves the daemon that controls label of the given info label.
 LyDataProvider getDataProvider(int index)
          Get data provider at the given index.
 int getDataProviderCount()
          Retreives current providers count.
 LyDataSource getDataSource(LyClass lyClass)
          Shortcut to get a data source registered in the application.
 LyDataSource getDataSource(java.lang.String classId)
          Shortcut to get a data source registered in the application.
 java.lang.String getDefaultLocationId()
          Computes the default location id for this application.
 LyEnvironment getEnvironment()
          Returns the environment of the application.
 java.lang.String getError()
          Accessor for the error message of the application.
 LyEventManager getEventManager()
          Gets the event manager of this application.
 java.lang.String getId()
          Accessor for the identifier of the application.
 LyInfo getInfo(java.lang.String id)
          Retrieves an info from its id.
static LyApplication getInfoApplication(java.lang.String infoId)
          Retrieves an application from an info id.
<T extends LyInfo>
LyInfoList<T>
getInfoList(java.lang.Class<T> infoClass)
          Returns an ordered list of all the infos of a given java class registered in the application.
 LyInfoProvider getInfoProvider()
          Returns the info provider of the application.
<T extends LyInfo>
LyInfoList<T>
getInfos(java.lang.Class<T> infoClass)
          Deprecated. Use getInfoList
 LyDataProvider getLocalDataProvider()
          To get the local data provider of this application.
 LyObjectSource getObjectSource(LyClassInfo classInfo)
          Shortcut to get an object source registered in the application.
 LyApplication getParent()
          Accessor to the the parent application.
 LySqlDataProvider getPrefDataProvider()
          Find the SQL provider used to store the preferences into DB.
 int getPriorityLevel(LyObject object)
          Get the priority level of this application.
 LyProject getProject()
          Accessor for the project of the application.
 LyApplication getRootApplication()
          To get the root application of this application.
 LyDataSession getSession(int index)
          Get session at the given index.
 LyDataSession getSession(java.lang.String sessionId)
          Get session at the given index.
 int getSessionCount()
          Retreives current sessions count.
 java.util.Vector<LyDataSession> getSessions()
          Retreives current sessions list.
 LySqlDataProvider getSQLDataProvider(java.lang.String providerId)
          find the SQL provider which could be used to store the preferences into DB.
 LyApplication getSubApplication(int index)
          Get sub-application at the given index.
 int getSubApplicationCount()
          Retreives current sub-applications count.
 java.util.Vector<LyApplication> getSubApplications()
          Get sub-applications of this application.
 java.lang.String[][] getSupportedLanguages()
          To get all supported languages by the application.
 java.lang.String[] getSupportedTimeZones()
          To get all supported timeZone by the application.
 LyTag getTag(java.lang.String id)
          Retrieves a tag from its id.
<T extends LyTag>
java.util.ArrayList<T>
getTags(java.lang.Class<T> tagClass)
          Returns an ordered list of all the tags of a given java class registered in the application.
 LyTransactionManager getTransactionManager()
          Gets the transaction manager of this application.
 java.lang.Object getValue(java.lang.Object key)
          Retrieves a value from a registered key.
 boolean hasParent(LyApplication application)
          Check if the given application is parent of this application.
 boolean hasTransaction(LyDataSession session)
          Tests if the speified session has somme pending transaction.
 boolean isClosing()
          Indicates whether the application is closing or not.
 boolean isEdited()
          Checks is application is being edited.
 boolean isIdle()
          Indicates whether the application is idle or not.
 boolean isSleeping()
          Indicates whether the application is asleep or not.
 boolean isValid()
          Indicates whether the application is valid or not.
 boolean isWaitingForClosing()
          Indicates whether the application is waiting for closing or not.
 java.lang.Class<?> loadClass(java.lang.String className)
          Calls the loadClass(String className, String errorMessage) method with an error message not defined.
 java.lang.Class<?> loadClass(java.lang.String className, java.lang.String errorMessage)
          This method enables to find a class whose name matches the given name.
 void loadClasses(LyInfoList<LyClassInfo> classes)
          Loads a list of classes whithin an application.
 void loadData()
          Load data and fill caches.
 void loadData(LyInfoList<LyClassInfo> classInfos, java.util.BitSet marks)
          Load data and fill caches.
 LyInfoList<LyInfo> loadExtraInfos()
          Load extra infos.
 java.util.Vector<LyExtraInfoInterface> loadExtraInfosFromDB(java.lang.String extraInfoId, java.lang.String userId)
          Load extra info like preferences, charts, treemap configurations or form saves.
 void loadProject(LyProject project)
          Loads a project whithin an application.
 boolean parse()
          Loads the precompiled meta-model if available, else parses the meta-model xml file.
 LyInfoList<LyInfo> parseExtraFiles(java.lang.String prefix, java.lang.String dirName, java.lang.String userId)
          Method for parsing extra information such as charts or preferences.
static void putApplication(LyApplication application)
          Registers an application.
 void putDataSource(LyDataSource dataSource)
          Registers a data source in the application.
 void putInfo(LyInfo info)
          Registers an info in the application.
 void putTag(LyTag tag)
          Registers a tag in the application.
 void reloadData(boolean unload)
          Reload application data.
static void removeAll()
          Remove all applications.
static void removeApplication(LyApplication application)
          Removes an application.
 void removeDataSource(LyDataSource dataSource)
          Unregisters a data source from the application.
 void removeInfo(LyInfo info)
          Unregisters an info from this application.
static void removeListener(LyApplicationListener listener)
          Unregisters a listener.
 void removeSessionListener(LySessionListenerInterface sessionListener)
          Removes a session listener from this application.
 void removeTag(LyTag tag)
          Unregisters a tag from this application.
 void saveData()
          Save all application data.
 boolean saveExtraInfo(LyExtraInfoInterface info)
          Save given extra info like preferences, charts or treemap configurations.
 boolean saveExtraInfo(LyExtraInfoInterface info, LyXmlWriterInterface writer)
          Save given extra info like preferences, charts or treemap configurations.
 void setClassLoader(java.lang.ClassLoader loader)
          Sets the specific class loader defined for this application with the given one.
 LyContext setCurrentContext(LyContext context)
          Sets the current context to the given one for the current thread.
 LyEvaluator setCurrentEvaluator(LyEvaluator evaluator)
          Sets the current evaluator to the given one for the current thread.
 java.lang.Object setCurrentInstance(java.lang.String name, java.lang.Object instance)
          Sets the current instance corresponding to specified name for the current thread.
 LyDataSession setCurrentSession(LyDataSession session)
          Sets the current session to the given one for the current thread.
 boolean setDataProviderLocation(java.lang.String providerId, LyLocation newLocation)
          Change data provider location.
 void setDefaultLocationId(java.lang.String defaultLocationId)
          To set the default lcation id for this application.
 void setError(java.lang.String message)
          Sets the error message of the application.
 void setIdle(boolean idle)
          Sets idle mode on the application : no event on operation when set.
 void sleep()
          Sets the application in sleeping mode.
 void start(LyProject rootProject)
          Starts the application.
 void unloadData()
          Clears all application data.
 boolean validateClasses(LyInfoList<LyClassInfo> classes)
          Validate the given list of classes for existing providers.
 boolean wakeUp()
          Wakes up an application which is in sleeping mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version.

See Also:
Constant Field Values

FIELD_SEP

public static char FIELD_SEP
Separator used by LyObjectId class.


VISIBLE_FIELD_SEP

public static char VISIBLE_FIELD_SEP
Separator used by LyObjectId class.


CLASS_SEP

public static char CLASS_SEP
Separator used by LyObjectId class.


LABEL_SEP

public static java.lang.String LABEL_SEP
Separator used for composed title.


VALUE_SEP

public char VALUE_SEP
Separator used when multiple values are returned from the graphical input object.


VISIBLE_VALUE_SEP

public static char VISIBLE_VALUE_SEP
Separator used by LyObjectId class.


NAME_SEP

public char NAME_SEP
Separator for objects with several names.


ARRAY_SEP

public static char ARRAY_SEP
Internal separator used for array values.


VISIBLE_ARRAY_SEP

public static char VISIBLE_ARRAY_SEP
Visible separator used for array values.


VISIBLE_VECTOR_SEP

public static java.lang.String VISIBLE_VECTOR_SEP
Visible separator used for vector values.

Constructor Detail

LyApplication

public LyApplication(java.lang.String id)
Constructor with a given id.

Parameters:
id - The identifier of the application.

LyApplication

public LyApplication(java.lang.String id,
                     boolean edited)
Constructor with a given id.

Parameters:
id - The identifier of the application.

LyApplication

public LyApplication(java.lang.String id,
                     java.lang.String configFile)
Constructor with a given id and configuration file.

Parameters:
id - The identifier of the application.
configFile - The configuration file of the application.

LyApplication

public LyApplication(java.lang.String id,
                     java.lang.String configFile,
                     java.lang.ClassLoader classLoader)
Constructor with a given id and configuration file and a specific classloader.

Parameters:
id - The identifier of the application
configFile - The configuration file for the application
classLoader - A specific class loader used for loading specific classes and performing introspection.

LyApplication

public LyApplication(java.lang.String id,
                     java.lang.String configFile,
                     java.lang.String path,
                     java.lang.ClassLoader classLoader)
Constructor with a given id, configuration file and class loader.

Parameters:
id - The identifier of the application.
configFile - The name of the config file. If null, the name of the file is built using the identifier of the application followed by '.ini' (eg : for an application whose identifier is 'sample' the default name of the configuration file is 'sample.ini').
path - The initial path for the application (LY_APP_DIR in LyEnvironment)
classLoader - A specific class loader used for loading specific classes and performing introspection.

LyApplication

public LyApplication(LyApplication parent,
                     java.lang.String id,
                     java.lang.String configFile,
                     java.lang.String path,
                     java.lang.ClassLoader classLoader)
Constructor with a given id, configuration file and class loader.

Parameters:
parent - The parent application (null for the primary module).
id - The identifier of the application.
configFile - The name of the config file. If null, the name of the file is built using the identifier of the application followed by '.ini' (eg : for an application whose identifier is 'sample' the default name of the configuration file is 'sample.ini').
path - The initial path for the application (LY_APP_DIR in LyEnvironment)
classLoader - A specific class loader used for loading specific classes and performing introspection.

LyApplication

public LyApplication(LyApplication parent,
                     LyProject rootProject,
                     java.lang.String id,
                     java.lang.String configFile,
                     java.lang.String path,
                     java.lang.ClassLoader classLoader)
Constructor with a given id, configuration file and class loader.

Parameters:
parent - The parent application (null for the primary module).
rootProject - The root project of this application.
id - The identifier of the application.
configFile - The name of the config file. If null, the name of the file is built using the identifier of the application followed by '.ini' (eg : for an application whose identifier is 'sample' the default name of the configuration file is 'sample.ini').
path - The initial path for the application (LY_APP_DIR in LyEnvironment)
classLoader - A specific class loader used for loading specific classes and performing introspection.

LyApplication

public LyApplication(LyApplication parent,
                     LyProject rootProject,
                     java.lang.String id,
                     java.lang.String configFile,
                     java.lang.String path,
                     java.lang.ClassLoader classLoader,
                     boolean isMobile)
Constructor with a given id, configuration file and class loader.

Parameters:
parent - The parent application (null for the primary module).
rootProject - The root project of this application.
id - The identifier of the application.
configFile - The name of the config file. If null, the name of the file is built using the identifier of the application followed by '.ini' (eg : for an application whose identifier is 'sample' the default name of the configuration file is 'sample.ini').
path - The initial path for the application (LY_APP_DIR in LyEnvironment)
classLoader - A specific class loader used for loading specific classes and performing introspection.
isMobile - Indicates if the platform used is a mobile of not.

LyApplication

public LyApplication(LyApplication parent,
                     java.lang.String id)
Constructor with a given id.

Parameters:
parent - the parent application (can be null)
id - The identifier of the application.
Method Detail

putApplication

public static void putApplication(LyApplication application)
Registers an application.

Parameters:
application - The application that must be registered.

getApplication

public static LyApplication getApplication(java.lang.String id)
Retrieves an application.

Parameters:
id - The id of the application that must be retrieved.
Returns:
The corresponding application or null if there is no application that matches the given id.

getInfoApplication

public static LyApplication getInfoApplication(java.lang.String infoId)
Retrieves an application from an info id.

Parameters:
id - The id of the info for which the application is searched.
Returns:
The corresponding application or null if there is no application that matches the given info id.

removeApplication

public static void removeApplication(LyApplication application)
Removes an application.

Parameters:
application - The application that must be removed.

removeAll

public static void removeAll()
Remove all applications.


getApplications

public static java.util.Vector<LyApplication> getApplications()
Gets list of all applications.

Returns:
List of applications.

addListener

public static void addListener(LyApplicationListener listener)
Registers a listener.

Parameters:
listener - The listener that must be registered.

removeListener

public static void removeListener(LyApplicationListener listener)
Unregisters a listener.

Parameters:
listener - The listener that must be unregistered.

buildDefaultLocationId

public static java.lang.String buildDefaultLocationId(java.lang.String applicationId)
Computes the default location id for the specified application id. This id is the concatenation of the application id and LyLocation.DEFAULT_LOCATION prefixed by '_'.

Parameters:
applicationId - the application id
Returns:
the default location id for this application.

closeAll

public static void closeAll()
Close all remaining applications.


isValid

public boolean isValid()
Indicates whether the application is valid or not.

Returns:
true if the application is valid, false otherwise.

getProject

public LyProject getProject()
Accessor for the project of the application.

Returns:
The project of the application.
See Also:
LyProject

getId

public java.lang.String getId()
Accessor for the identifier of the application.

Returns:
The identifier of the application.

isSleeping

public boolean isSleeping()
Indicates whether the application is asleep or not.

Returns:
true if the application is asleep, false otherwise.
See Also:
sleep(), wakeUp()

getError

public java.lang.String getError()
Accessor for the error message of the application.

Returns:
The error message of the application.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Accessor for the specific class loader defined for this application.

Returns:
The specific class loader defined for this application or null if not defined.
See Also:
LyClassLoader

getApplicationBehavior

public LyApplicationBehaviorInterface getApplicationBehavior()
Returns the behavior of this application.

Returns:
The behavior of this application, may be null.

setError

public void setError(java.lang.String message)
Sets the error message of the application.

Parameters:
message - The new message that must be used.

setClassLoader

public void setClassLoader(java.lang.ClassLoader loader)
Sets the specific class loader defined for this application with the given one. The specific class loader could be, for example, a LyClassLoader.

Parameters:
loader - The new specific class loader defined for this application.
See Also:
LyClassLoader

start

public void start(LyProject rootProject)
Starts the application. There are four steps in this method : we parse the meta-model, create the application behavior, create the providers and create the notifiers. If one of these steps failed, we close the application. Otherwise, we create the daemons and the caches and declare the application valid.

Parameters:
rootProject - The root project of this application. If this param is null the XML model specified for this application is parsed.

loadProject

public void loadProject(LyProject project)
Loads a project whithin an application. Create the providers and notifiers of the project. Create the daemons and the caches.

Parameters:
project - the project to load

loadClasses

public void loadClasses(LyInfoList<LyClassInfo> classes)
Loads a list of classes whithin an application. Create the providers and notifiers of the project. Create the daemons and the caches.

Parameters:
classes - a list of classes to load

parse

public boolean parse()
Loads the precompiled meta-model if available, else parses the meta-model xml file. The root tag of the meta-model must be a <PROJECT> tag.

Returns:
false if no root project was found in the meta-model xml file, true otherwise.

parseExtraFiles

public LyInfoList<LyInfo> parseExtraFiles(java.lang.String prefix,
                                          java.lang.String dirName,
                                          java.lang.String userId)
Method for parsing extra information such as charts or preferences.

Parameters:
prefix - File prefix of loaded infos.
dirName - Name (or path) of the directory containing infos to be loaded.
userId - User id (may be null when info is shared).
Returns:
List of loaded infos.

addDataProvider

public void addDataProvider(LyDataProvider provider)
Add a data provider to the current application.

Parameters:
provider - a data provider to add

validateClasses

public boolean validateClasses(LyInfoList<LyClassInfo> classes)
Validate the given list of classes for existing providers.

Parameters:
classes - List of classes to validate.
Returns:
false if validation failed on one of the clases, true otherwise.

createCache

public void createCache(LyClassInfo classInfo)
Creates the cache for the application of the given class info.

Parameters:
classInfo - a class
See Also:
LyCache

getSessionCount

public int getSessionCount()
Retreives current sessions count.

Returns:
the number of session

getSession

public LyDataSession getSession(int index)
Get session at the given index.

Parameters:
index - an index
Returns:
the corresponding session or no sessions are registered

getSession

public LyDataSession getSession(java.lang.String sessionId)
Get session at the given index.


getSessions

public java.util.Vector<LyDataSession> getSessions()
Retreives current sessions list.

Returns:
a list of sessions

getDefaultLocationId

public java.lang.String getDefaultLocationId()
Computes the default location id for this application. This id is the concatenation of the application id and LyLocation.DEFAULT_LOCATION prefixed by '_'.

Returns:
the default location id for this application.

setDefaultLocationId

public void setDefaultLocationId(java.lang.String defaultLocationId)
To set the default lcation id for this application.

Parameters:
defaultLocationId - the new default location id for this application.

getSupportedLanguages

public java.lang.String[][] getSupportedLanguages()
To get all supported languages by the application.

Returns:
Array of couple of strings that represents supported languages. Each couple of string is the code of the country for the language as defined in java.util.Locale for the first string, and the display name of the language or a key to the dictionnary of this string for the second.

getSupportedTimeZones

public java.lang.String[] getSupportedTimeZones()
To get all supported timeZone by the application.

Returns:
Array of couple of strings that represents supported languages. Each couple of string is the code of the country for the language as defined in java.util.Locale for the first string, and the display name of the language or a key to the dictionnary of this string for the second.

loadData

public final void loadData()
Load data and fill caches.

See Also:
LyApplication#loadData(boolean,BitSet), unloadData()

loadData

public void loadData(LyInfoList<LyClassInfo> classInfos,
                     java.util.BitSet marks)
Load data and fill caches.

Parameters:
classInfos - List of classes to load (null means all).
marks - Indicates the marks that the classes to load must match. If null, all the classes are loaded.
See Also:
loadData(), LyClassInfo

unloadData

public void unloadData()
Clears all application data. WARNING : this method must never be invoked while views, or workspaces are opened. Be sure to close all the windows and clear all the listeners before cleaning data.

See Also:
loadData()

freeDialogSessions

public void freeDialogSessions()
To free all dialog controllers of all sessions.


reloadData

public void reloadData(boolean unload)
Reload application data.

Parameters:
unload - Boolean indicating if datas have to be unlodaed first.
See Also:
loadData()

saveData

public void saveData()
Save all application data. Some of the providers do nothing when this method is called, but some others do some stuff (like LyFileDataProvider that saves all the data on files).


addDaemon

public void addDaemon(LyDaemon daemon)
Adds a new relation daemon to the application.

Parameters:
daemon - The relation daemon that must be added to the application.
See Also:
getDaemon(LyFieldInfo), LyRelationDaemon

getDaemon

public LyFieldInfoDaemon getDaemon(LyFieldInfo fieldInfo)
Retrieves the daemon in charge of the specified field info.

Parameters:
fieldInfo - The field info whose daemon we want to get.
Returns:
the corresponding daemon

getDaemon

public LyLabelDaemon getDaemon(LyInfoLabel label)
Retrieves the daemon that controls label of the given info label.

Parameters:
label - The infoLabel for which the daemon is searched.
Returns:
the corresponding daemon.

close

public void close()
Closing current application. This method closes current application behavior and data providers Then frees all resources. This application should not be used anymore.

See Also:
sleep()

sleep

public void sleep()
Sets the application in sleeping mode. This method clears all application data, clears all the application views and sets all its providers and notifiers in sleeping mode.

See Also:
wakeUp(), close()

wakeUp

public boolean wakeUp()
Wakes up an application which is in sleeping mode. This method loads data, fills cache and wakes up all the application providers and notifiers.

Returns:
true if wake up was successfull.
See Also:
sleep()

getTag

public LyTag getTag(java.lang.String id)
Retrieves a tag from its id.

Parameters:
id - The id of the searched tag.
Returns:
The object corresponding to the id or null if no object is found.
See Also:
LyInfo, putInfo(LyInfo)

getInfo

public LyInfo getInfo(java.lang.String id)
Retrieves an info from its id.

Parameters:
id - The id of the searched Info.
Returns:
The object corresponding to the id or null if no object is found.
See Also:
LyInfo, putInfo(LyInfo)

putTag

public void putTag(LyTag tag)
Registers a tag in the application.

Parameters:
tag - a tag to register

putInfo

public void putInfo(LyInfo info)
Registers an info in the application. This may be an action, a class info, a field info...

Parameters:
info - an info to register
See Also:
LyInfo, getInfo(String)

removeTag

public void removeTag(LyTag tag)
Unregisters a tag from this application.

Parameters:
tag - a tag to unregister

removeInfo

public void removeInfo(LyInfo info)
Unregisters an info from this application.

Parameters:
info - an info to unregister
See Also:
LyInfo, putInfo(leon.info.LyInfo)

getClassInfo

public LyClassInfo getClassInfo(java.lang.String id)
Shortcut to get a classInfo of the application.

Parameters:
id - The identifier of current class.
Returns:
The requested classInfo, or null if it could not be found.

getClassInfosFromBinding

public LyInfoList<LyClassInfo> getClassInfosFromBinding(java.lang.String binding)
Find classinfos from the peer value (connector value defined in class binding). Since multiple classes may be bound to the same data source binding, this method may return a list.

Parameters:
binding - the binding to search
Returns:
the requested classinfos, an empty list if none is found or null if parameter is null

getAction

public LyAction getAction(java.lang.String id)
Shortcut to get an action of the application.

Parameters:
id - The identifier of current action.
Returns:
The requested action, or null if it could not be found.

getActionWithId

public LyAction getActionWithId(java.lang.String id,
                                LyClassInfo classInfo)
Get an action of the project with given template id.

Parameters:
id - The identifier of the template of searched action.
classInfo - If not null, look first on class info before project.
Returns:
The requested action, or null if it could not be found.

getActionWithTemplate

public LyAction getActionWithTemplate(java.lang.String id,
                                      LyClassInfo classInfo)
Get an action of the application with given template id.

Parameters:
id - The identifier of the template of searched action.
classInfo - If not null, look first on class info before project.
Returns:
The requested action, or null if it could not be found.

getTags

public <T extends LyTag> java.util.ArrayList<T> getTags(java.lang.Class<T> tagClass)
Returns an ordered list of all the tags of a given java class registered in the application.

Type Parameters:
T - the type of Tag to get
Parameters:
tagClass - The java class.
Returns:
List of all tags of the given java class registered on the application.

getInfos

public <T extends LyInfo> LyInfoList<T> getInfos(java.lang.Class<T> infoClass)
Deprecated. Use getInfoList

Returns all the infos of a given java class registered in the application.

Type Parameters:
T - the type of LyInfo to return
Parameters:
infoClass - a java class.
Returns:
The requested info, or null if it could not be found.
See Also:
LyInfo

getInfoList

public <T extends LyInfo> LyInfoList<T> getInfoList(java.lang.Class<T> infoClass)
Returns an ordered list of all the infos of a given java class registered in the application.

Type Parameters:
T - the type of LyInfo to return
Parameters:
infoClass - The java class.
Returns:
List of all infos of the given java class registered on the application.
See Also:
LyInfo

getClassInfos

public LyInfoList<LyClassInfo> getClassInfos()
To get all the class infos registered in the application.

Returns:
a list of classInfo
See Also:
LyClassInfo

getActions

public LyInfoList<LyAction> getActions()
To get all the actions registered in the application.

Returns:
a list of Actions
See Also:
LyAction

getEnvironment

public LyEnvironment getEnvironment()
Returns the environment of the application.

Returns:
The environment of the application.
See Also:
LyEnvironment

getDataSource

public LyDataSource getDataSource(java.lang.String classId)
Shortcut to get a data source registered in the application.

Parameters:
classId - The identifier of the class whose data source we want to retrieve.
Returns:
The data source corresponding to the given class identifier or null if it could not be found.

getDataSource

public LyDataSource getDataSource(LyClass lyClass)
Shortcut to get a data source registered in the application.

Parameters:
lyClass - The class whose data source we want to retrieve.
Returns:
The data source corresponding to the given class or null if it could not be found.

putDataSource

public void putDataSource(LyDataSource dataSource)
Registers a data source in the application.

Parameters:
dataSource - The data source that must be registered.
See Also:
getDataSource(String), getDataSource(LyClass)

removeDataSource

public void removeDataSource(LyDataSource dataSource)
Unregisters a data source from the application.

Parameters:
dataSource - The data source that must be unregistered.
See Also:
getDataSource(String), getDataSource(LyClass)

getObjectSource

public LyObjectSource getObjectSource(LyClassInfo classInfo)
Shortcut to get an object source registered in the application.

Parameters:
classInfo - The class info whose object source we want to retrieve.
Returns:
The object source corresponding to the given class or null if it could not be found.

getInfoProvider

public LyInfoProvider getInfoProvider()
Returns the info provider of the application.

Returns:
The info provider of the application.

loadClass

public java.lang.Class<?> loadClass(java.lang.String className)
Calls the loadClass(String className, String errorMessage) method with an error message not defined. It implies that a generic message is displayed instead.

Parameters:
className - The fully qualified name of the desired class.
Returns:
The loaded class or null if it could not be found.

loadClass

public java.lang.Class<?> loadClass(java.lang.String className,
                                    java.lang.String errorMessage)
This method enables to find a class whose name matches the given name. If a specific class loader is defined over this application then, its "loadClass" method is used, otherwise the static "Class.forName" method is used.

Parameters:
className - The fully qualified name of the desired class.
errorMessage - The error message displayed on the standard output stream when a ClassNotFoundException is caught.
Returns:
The loaded class or null if it could not be found.

getCurrentSession

public LyDataSession getCurrentSession()
Gets the current session for the current thread.

Returns:
Instance of the current session (may be null) if it was not set in the current thread.

setCurrentSession

public LyDataSession setCurrentSession(LyDataSession session)
Sets the current session to the given one for the current thread.

Parameters:
session - Session to set as the current one for the current thread. If null, unset the current session.
Returns:
Previous registered session if it exists.

getTransactionManager

public LyTransactionManager getTransactionManager()
Gets the transaction manager of this application.

Returns:
The associated transaction manager.

hasTransaction

public boolean hasTransaction(LyDataSession session)
Tests if the speified session has somme pending transaction.

Parameters:
session - a session
Returns:
true if the specified session has some pending transaction, else false.

getEventManager

public LyEventManager getEventManager()
Gets the event manager of this application.

Returns:
The associated event manager.

getLocalDataProvider

public LyDataProvider getLocalDataProvider()
To get the local data provider of this application.

Returns:
the local data provider

getDataProviderCount

public int getDataProviderCount()
Retreives current providers count.

Returns:
the count of data provider

getDataProvider

public LyDataProvider getDataProvider(int index)
Get data provider at the given index.

Parameters:
index - an index
Returns:
the corrresponding LyDataProvider or null if no data provider are registered

getPriorityLevel

public int getPriorityLevel(LyObject object)
Get the priority level of this application. This level is used by controls and rules to check if a control or a rule is triggered. If the level of this application is lesser than 0 and this application has a parent, the parent level is returned.

Parameters:
object - the object on which the control is applied (may be null).
Returns:
the priority level of the application.

getParent

public LyApplication getParent()
Accessor to the the parent application.

Returns:
null if the application is the primary module, the parent application otherwise.

hasParent

public boolean hasParent(LyApplication application)
Check if the given application is parent of this application.

Parameters:
application - the application
Returns:
True if the given application is an ancestor of this application, false otherwise.

getContextManager

public LyContextManager getContextManager()
Gets the context manager of the current session of this application.

Returns:
The associated context manager of the current session of this application.

getCurrentContext

public LyContext getCurrentContext()
Gets the current context for the current thread.

Returns:
Instance of the current context (may be null) if it was not set in the current thread.

setCurrentContext

public LyContext setCurrentContext(LyContext context)
Sets the current context to the given one for the current thread.

Parameters:
context - Context to set as the current one for the current thread. If null, unset the current context.
Returns:
Previous registered context if it exists.

getRootApplication

public LyApplication getRootApplication()
To get the root application of this application.

Returns:
the root application of this application.

getSubApplicationCount

public int getSubApplicationCount()
Retreives current sub-applications count.

Returns:
the count of sub application

getSubApplication

public LyApplication getSubApplication(int index)
Get sub-application at the given index.

Parameters:
index - an index
Returns:
a corresponding sub application. Null if none

getSubApplications

public java.util.Vector<LyApplication> getSubApplications()
Get sub-applications of this application.

Returns:
A vector containing all sub-applications, null if no sub-applications found.

setDataProviderLocation

public boolean setDataProviderLocation(java.lang.String providerId,
                                       LyLocation newLocation)
Change data provider location.

Parameters:
providerId - Id of the provider to be changed.
newLocation - New location for the data provider corresponding to the given id.
Returns:
Boolean indicating if the change was successfully completed or not.
Throws:
java.lang.IllegalArgumentException - if the given id doesn't correspond to an existing provider. IllegalArgumentException if the given location hasn't the same type as the previous one associated to the provider.

checkProviders

public boolean checkProviders()
Method to test if all data providers of this application have some connection with the physical layer.

Returns:
true if all provider are OK, false if one of the providers has lost its connection with the physical layer.

endTimer

public void endTimer(LyTimer timer)
When a LyTimer ends this method is invoked.

Specified by:
endTimer in interface LyTimerClientInterface
Parameters:
timer - the timer which expired.

isIdle

public boolean isIdle()
Indicates whether the application is idle or not.

Returns:
true if the application is idle, false otherwise.

setIdle

public void setIdle(boolean idle)
Sets idle mode on the application : no event on operation when set.

Parameters:
idle - true if the application is idle, false otherwise.

addValue

public void addValue(java.lang.Object key,
                     java.lang.Object value)
Adds a pair key-value to the session. May be used for example to store the login used to create the session.

Parameters:
key - The key that must be stored.
value - The value that must be stored with the key.
See Also:
getValue(java.lang.Object)

getValue

public java.lang.Object getValue(java.lang.Object key)
Retrieves a value from a registered key.

Parameters:
key - The key that must be used.
Returns:
The value stored with the key or null if the key is not registered.
See Also:
addValue(java.lang.Object, java.lang.Object)

isClosing

public boolean isClosing()
Indicates whether the application is closing or not.

Returns:
true if the application is closing, false otherwise.

isWaitingForClosing

public boolean isWaitingForClosing()
Indicates whether the application is waiting for closing or not. A timer was started to close application.

Returns:
true if the application is waiting for closing, false otherwise.

abortClosing

public void abortClosing()
Abort the closing of an application.


saveExtraInfo

public final boolean saveExtraInfo(LyExtraInfoInterface info)
Save given extra info like preferences, charts or treemap configurations.

Parameters:
info - Info to be saved.
Returns:
True if extra info was sucessfully saved.

saveExtraInfo

public boolean saveExtraInfo(LyExtraInfoInterface info,
                             LyXmlWriterInterface writer)
Save given extra info like preferences, charts or treemap configurations.

Parameters:
info - Info to be saved.
Returns:
True if extra info was sucessfully saved.

loadExtraInfos

public LyInfoList<LyInfo> loadExtraInfos()
Load extra infos.

Parameters:
application - Application on which extra infos (like charts or treemap configurations) are loaded.
Returns:
List of extra infos for the application.

loadExtraInfosFromDB

public java.util.Vector<LyExtraInfoInterface> loadExtraInfosFromDB(java.lang.String extraInfoId,
                                                                   java.lang.String userId)
Load extra info like preferences, charts, treemap configurations or form saves.

Parameters:
extraInfoClass - Class of the extra info.
userId - Id of the user.
extraInfoId - Id of extra info.
Returns:
Info that was saved if found, null otherwise.

deleteExtraInfo

public boolean deleteExtraInfo(LyExtraInfoInterface info)
Delete given extra info like preferences, charts or treemap configurations.

Parameters:
info - Info to be deleted.
Returns:
True if extra info was sucessfully deleted.

getCurrentInstance

public java.lang.Object getCurrentInstance(java.lang.String name)
Gets the current instance corresponding to specified name for the current thread.

Parameters:
name - Name of searched instance.
Returns:
Instance associated to given in current thread (may be null).

setCurrentInstance

public java.lang.Object setCurrentInstance(java.lang.String name,
                                           java.lang.Object instance)
Sets the current instance corresponding to specified name for the current thread.

Parameters:
name - Name of searched instance.
instance - Instance associated to given in current thread (may be null).
Returns:
Previous registered instance if it exists.

getCurrentEvaluator

public LyEvaluator getCurrentEvaluator()
Gets the current evaluator for the current thread.

Returns:
Instance of the current evaluator. May be null if it was not set in the current thread.

setCurrentEvaluator

public LyEvaluator setCurrentEvaluator(LyEvaluator evaluator)
Sets the current evaluator to the given one for the current thread.

Parameters:
evaluator - Evaluator to set as the current one for the current thread. If null, unset the current evaluator.
Returns:
Previous registered evaluator if it exists.

isEdited

public boolean isEdited()
Checks is application is being edited.

Returns:
True if application is under edition, false otherwise.

addSessionListener

public void addSessionListener(LySessionListenerInterface sessionListener)
Adds a session listener to this application.

Parameters:
sessionListener -

removeSessionListener

public void removeSessionListener(LySessionListenerInterface sessionListener)
Removes a session listener from this application.

Parameters:
sessionListener -

getPrefDataProvider

public LySqlDataProvider getPrefDataProvider()
Find the SQL provider used to store the preferences into DB.

Returns:
the SQL data provider to get the connection or null if it doesn't exist.

getSQLDataProvider

public LySqlDataProvider getSQLDataProvider(java.lang.String providerId)
find the SQL provider which could be used to store the preferences into DB.

Parameters:
application - Application on which extra info is saved.
providerId - the provider Id, by default stored in the LY_PREFERENCES_LOCATION_ID resource. Null or empty means : no provider and store info files. "any" is accepted to use the first provider
Returns:
the SQL data provider to get the connection or

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com