|
We recommend that you learn about the code by following these steps:
rifServices
sub-project. Specifically, focus on classes
in the rifServices.businessConceptLayer
. The business classes describe
the kinds of concepts that are involved in the RIF's environmental health studies. The
service interfaces (source files ending in "API") describe the behaviour of the middleware
and indicate what a client application can get it to do.
rifServices.businessConceptLayer
in some way mirror
the concepts in the business concept layer. For example, the classes in the
rifServices.fileFormats
project use different file formats to serialise and deserialise
business objects.
rifServices.test.businessConceptLayer
. These test cases are easy to run because
they don't involve contacting the database.
rifSubmissionTool
and rifDataLoaderTool
. Each major tool in the tool
suite will divide its code into presentation, business concept and data storage layers. Each
of the tools will have a front end which uses the database via service interfaces.
Sup-project | Description |
rifGenericLibrary |
|
rifServices |
|
rifDatabase |
|
rifWebPlatform |
|
rifDataLoaderTool |
|
rifSubmissionTool |
|
rifGovernanceTool |
|
Understanding the code base is made easier if you keep in mind a few naming conventions which can appear in multiple projects. The following table of conventions should help you tell what a lot of the classes do without requiring you to look at the code in them.
Convention | Meaning |
Packages marked *.presentationLayer
|
Contains classes that are used to generate Swing-based front ends. The front end code is responsible for converting data between forms and business objects. It interacts with the database by using business objects with calls to service interfaces. |
Packages marked *.businessConceptLayer
|
Contains definitions of business classes and service interfaces. In any subproject, you should examine this package first. |
Packages marked *.dataStorageLayer
|
Contains classes that use business objects to assemble SQL queries, which are then executed in the database. Typically the results of the SQL queries are packaged into business objects. |
Packages marked *.system
|
Contains classes that are used throughout a subproject. For example,
rifServices.system.RIFServiceError is an enumeration of error causes, and is
used throughout the rifServices subproject.
|
Packages marked *.fileFormats
|
Contains classes that are used to serialise or deserialise business objects using one or more file formats (eg: XML, HTML, CSV). |
Source files marked Abstract*
|
Abstract classes. |
Source files marked *API .
|
interfaces that define the behaviour of services which are used by front end
applications. They should always appear within a businessConceptLayer package.
|
Source files marked *Service .
|
Classes that implement a service interface (*API ). They should always appear
within a businessConceptLayer package. Test*Service classes
are usually used for testing and contain methods that can help reset the service or the
database to a known state. Production*Service classes are what users will
use and will not have these kinds of methods.
|
Source files marked SQL* .
|
Indicates the file is involved with generating or executing SQL queries. |
Source files marked *Manager .
|
Service classes (*Service ) often delegate much of the work for
their methods to corresponding methods in *Manager delegation
classes. A manager class is responsible for managing queries related to
one or more business classes. For example, the
rifServices.dataStorageLayer.SQLCovariateManager is responsible
for managing ExposureCovariate and AdjustableCovariate
classes found in the rifServices.businessConceptLayer package.
|
rifSubmissionTool
rifDataLoaderTool
rifITGovernanceTool
The subproject also contains a collection of query formatter classes, which help centralise repetitive tasks that are part of concatenating parts of common SQL queries. Like the UI classes, the query formatter classes do not rely on any business concepts that are specific to the RIF.
During the lifetime of the software, we expect to migrate any class to this subproject which may later be reused on unrelated software projects. Developers who modify code in this subproject will not require specialised domain knowledge in order to make improvements.
Convention | Meaning |
*QueryFormatter
|
used to help construct different types of SQL queries. The formatters are designed to manage issues such as indentations, adding comments and managing case sensitivity. They may also be modified so they can render different outputs depending on whether the database being used is PostgreSQL or SQL Server. |
*ButtonPanel, *ComboBox, *ListPanel, *Panel
|
classes that contain various common UI components. |
This subproject contains all the business concepts, service interfaces and service classes that support front ends for the Study Submission Tool and the Study Result Retrieval Tool. Code for the two tools is grouped together because they share many of the same business concepts and the same features.
The general naming conventions can tell you what most of these classes do. There are a few notable classes:
rifServices.dataStorageLayer.SQLConnectionManager
is used to handle connection
pooling for all of the other tools.
rifServices.util.RIFLogger
is used to handle all calls to log messages. It hides
references to SL4J from the rest of the code base.
rifServices.system.RIFServiceStartupProperties
reads a property file that helps
the middleware understand database properties such as the host, the port, whether it is SQL Server
or PostgreSQL and the names of directories containing resource files.
rifServices.util.FieldValidationUtility
has the only code in the code base which
does the work of comparing a String against malicious patterns of code (eg: SQL injection attacks).
rifServices.dataStorageLayer.HealthOutcomeManager
will probably be the only manager
class in a *.dataStorageLayer
package that does not rely on database queries. It
manages taxonomy services that are managed by independent services.
Convention | Meaning |
*Proxy
|
These are classes whose sole purpose is to make is easier for the Jackson library to serialise
RIF business objects. They are data container classes marked up with Java annotatations so
that Jackson's ObjectMapper class can serialise business objects using JSON.
|
*ServiceApplication
|
Advertise a particular web service. The Java annotations in these classes are used to help build the URL fragment that identifies the service. For example "/studySubmission" and "/studyResultRetrieval". |
*ServiceResource
|
Advertise a set of web service methods. These classes convert URL parameters into Java
objects, which are then passed to the Java service classes (*API ). The
*ServiceResource classes convert results into JSON.
|
Convention | Meaning |
*ContentHandler
|
A class that uses different file formats to serialises and deserialises objects from a particular business class, Each content handler class can write an HTML fragment, and can read and write an XML fragment appropriate for the business class. |
*Writer, *Reader
|
A class that will write or read a file. They delegate parts of their tasks to
*ContentHandler classes.
|