Project - a singleton class, handling a lot of business logics. Members: local study
, remote study
, user management
, unit management
;
Study (persisted) - class representing a project. Members: system model
, user role management
, study settings
;
ModelNode - abstract class representing a node. Members: name
, list of parameters
, list of external models
;
CompositeModelNode - abstract subclass of ModelNode, Members: list of submodes
;
SystemModel - subclass of CompositeModelNode, subnodes of type Subsystem;
SubsystemModel - subclass of CompositeModelNode, subnodes of type Instrument;
InstrumentModel - subclass of CompositeModelNode, subnodes of type Element;
ElementModel - subclass of ModelNode;
ParameterModel - class to represent model parameters. Members: nature
, unit
, value
, value source
, exported
; optional: value link
(another parameter model), export reference
(a target within an external model).
Application middleware backbone is predominantly constructed by Spring beans which are configured in XML-based application contexts. All beans are distributed between 5 application context (i.e context-*.xml files).
Each XML context file (except context-base.xml) pretend to encapsulate specific application layer, so establish a dependency graph of layers where any top level-context can have a dependency on that of low-level and not vice versa.
context-services.xml
Context, which contains lowest-level infrastructure beans:
context-model.xml
Domain-oriented stateful singleton beans. It contains the beans of project, various handlers and builders, action and status loggers as well as ThreadPoolTaskScheduler.
context-controller.xml
JavaFX controller beans. Each UI view, which is created via ViewBuilder obtained by GuiService.createViewBuilder(…) method initialize its controller with dependency injection provided by Spring context. Controllers can be singletons (for permanent application views) or prototype (for temporal controls).
context-base.xml
A special context which extract some beans from that of low-level and it necessary to start a basic application without configuring persistence.
context-test.xml
Context for test purposes. The main reason for it is having a possibility to override existing application beans and mock their behavior.
That is the idea, if some of the beans do not follow the rules described above, they will be rewritten later on.
Below is description of additional model features, also defined via application context.
ApplicationSettings
For launching the Application context it is necessary to provide some properties for it. There are 2 kind of them:
cedesk.properties
file within the .jar file. These properties can be overwritten by system properties of the same name. They include:application.settings
file in a subdirectory of the user’s home directory called .cedesk
, but it’s path and filename can be configured via cedesk.app.dir
and cedesk.app.file
application-specific properties. User of application a free to change user-specific properties in this file. User-specific properties include:There is a special class inside the application context which is aimed to provide access to both of those 2 kinds of properties. But it is required to perform the special static ApplicationSettingsInitializer.initialize()
method to initialize (and locate in case of its absence) user-specific properties.
Below is description of additional model features, also defined via application context.
RepositoryWatcher
This service based on the Spring scheduling in the application context performs a periodical checks (10 sec) on the repository, to check whether there is a newer version of the system model currently in use on the client. This check is paused when a new system model is created.
Synchronization of two applications
ExternalModelFileWatcher, SimpleDirectoryWatchService, DirectoryWatchService
This classes encapsulate a service to oversee the external model files which are kept in a cache on the client’s local disc. In case such a file changes, the parameters referring to the file are updated.
This functionality is uses services offered by the standard Java API to receive notifications on changes on the file system from the OS.
Parts of the code were recycled from an internet resource.
StatusLogger - a class which outputs information in the statusbar of the user interface, limited to contain the last 10 entries.
ActionLogger - a class which logs to the database the principal user actions on the client (load/save project, add/modify/remove model node, add/modify/remove parameter).
Log4j - the library is used for logging of information for debugging and error tracing, it’s configured to write a logfile into a subdirectory of the user’s home directory called .cedesk
. The application creates a new logfile on each application start using the date and time as part of the filename cedesk-app.<date+time>.log
. To avoid consuming too much disk space, the number of logfiles will not exceed 10.
This class is used to check on the public webpage cedesk.github.io/releases/), whether there is a newer version of the application available (distinguishing packages .exe, .deb, .dmg for the various operating systems).
The naming of elements (files, classes and UI items) has a few inconsistencies. These are to be removed, by agreeing on a uniform terminology and refactoring the code!