Technology Layers
Shared Layer
The Shared LayerLayerLogical separation of functionality within a single system/application, focused on code organization. is used by all other layersLayerLogical separation of functionality within a single system/application, focused on code organization. (except the View LayerLayerLogical separation of functionality within a single system/application, focused on code organization.) and contains classes which are mainly used by the other layersLayerLogical separation of functionality within a single system/application, focused on code organization. to communicate.
These classes, like the StarshipDetails class, can be found in the method interfaces in each layerLayerLogical separation of functionality within a single system/application, focused on code organization.:
private StarshipDetails starshipDetails = new StarshipDetails();
public CrudsResult<DataRef> create(StarshipDetails details) {}
public CrudsResult<DataRef> create(ParameterContext<StarshipDetails> detailsParameter) {}
public CrudsResult<DataRef> create(ParameterContext<StarshipDetails> detailsParameter) {}
View-Control-Proxy Layers
When zooming in on the view and control layerLayerLogical separation of functionality within a single system/application, focused on code organization., we can see how this layerLayerLogical separation of functionality within a single system/application, focused on code organization. interacts with the other layersLayerLogical separation of functionality within a single system/application, focused on code organization. to provide the user functionality.
In the View LayerLayerLogical separation of functionality within a single system/application, focused on code organization., we have the starship-page.js javascript file, which implements the logic of the page.
When data is entered into the page, an HTTP request is sent to the server.
This request is handled in the Control LayerLayerLogical separation of functionality within a single system/application, focused on code organization., by the StarshipEnterer class.
This class converts the json of the HTTP request to a Java Object.
This Object is an instance of the StarshipDetails class. The details classes are used throughout the backend to pass data and is provided by the Shared LayerLayerLogical separation of functionality within a single system/application, focused on code organization..
Finally, the StarshipEnterer then uses the StarshipAgent to create the instance. The agents provide an easy to access
interface that encapsulates the underlying technologies needed to make this happen.
Proxy-Logic Layers
The Proxy LayerLayerLogical separation of functionality within a single system/application, focused on code organization. provides encapsulation for the remoting technology. ArtifactsArtifactA build or deployment result, such as a Docker container image or Java archive, produced by a software project. in the Logic LayerLayerLogical separation of functionality within a single system/application, focused on code organization. use EJB to implement transactions and scaling, but they can only be accessed by retrieving the objects through JNDI lookups.
To hide this from the users of the agent classes, the StarshipProxy class performs the JDNI lookup and then exposes
an interface to interact with the underlying class.
The actual implementation can be found in the StarshipBean class, which implements the StarshipRemote interface.
The proxy class then requests the EJB Container for an implementation of this remote interface, which then returns
the bean.
Once the StarshipProxy has successfully connected to the StarshipBean, it can start sending requests.
Logic-Data Layers
StarshipBean sends the request to StarshipCruds. The cruds classes implement the logic close to the database.
The cruds class uses the StarshipData class, which describes the form of the data in the database.
It does this by using JPA annotations:
@Entity(name=StarshipData.ENTITY_NAME)
@Table(name="STARSHIP", schema="SPACE")
public class StarshipData {}
During a create operation, the StarshipDetails representation is mapped to a StarshipData object by a StarshipDetailsProjector and then given to
the JPA entityManager to persist. The entityManager then converts this to an INSERT query to perform on the database.
find operations on the other hand, first pass through the StarshipFinderBean.
This class receives the SearchDetails and then converts it into a JPA query with the help of a query builder.
The query returns a number of StarshipData objects, which are then mapped by the projector in the StarshipCruds class.
Between Components
When an artifactArtifactA build or deployment result, such as a Docker container image or Java archive, produced by a software project. in one Component needs to connect to a DataElement from another Component, the agent is used.
StarshipAgent starshipAgent = StarshipAgent.getStarshipAgent(context);
DataSourcesFix
ApplicationChange data-layerLayerLogical separation of functionality within a single system/application, focused on code organization. packaging to use the maven-assembly-plugin. This avoids copying data sources into the logic layerLayerLogical separation of functionality within a single system/application, focused on code organization. and may resolve other issues such as missing libraries or duplicate test execution.
<options>
<ejb.logic.dataSourcesFix/>
</options>