Application, First Steps
Table of Contents
1 Domain Layer
The domain considered is a simple container management tool.
A simple Model allows to create and delete a Container and to manage (the list of) all containers. A container has a code and a description, both of which are unique.
- The container data model Container.java.
- The container manager interface ManagerContainer.java and implementation ManagerContainerImpl.java
2 Application Layer
The application layer contains the information about the status of the application, e.g.
- which process is active
- for each process, the current (process) step, the ordering of the steps
The container management application consists of single process which contains only one step, i.e., there is no information to be held in the application layer (though you can write classes to do just this).
3 Infrastructure Layer
The infrastructure supports the other layers. To store data is has a repository layer whose classes provide methods for domain objects. Within the infrastructure Layer the domain objects are mapped to one or more (simpler) objects. Data access objects are used to store and retrive these objects from and to a data base. The object relational mapping (ORM) and the generation of SQL-statements is done using the HibernateDaoSupport. The management of the database sessions and transactions is done using Spring/Hibernate.
The infrastructure in the container management application has to support the operations save a container, delete a container and load all container.
- The container business object interface ContainerBo.java and implementation ContainerBoImpl.java
- The container DAO class interface ContainerDao.java and implementation ContainerDaoImpl.java
- A custom HibernateSupportDao class CustomHibernateDaoSupport.java (to inject the sessionFactory defined as Spring Bean, see Configure the database connection of the application).
4 User Interface
The User Interface describes the components of Web-pages, the contents of the fields and the actions to be performed on user request.
The container application UI consists of one web-page containing components to enter container data, to display a list of containers and components to allow the user to request the creation of a container using the given data and the deletion of any selected container.
- The container JSF page maintenanceContainer.xhtml
- The View Bean (the dynamic content of the page) ViewBeanMaintenanceContainer.java
- There are no actions requesting a page navigation in the Web-page (and therefor no view controller class is defined).
-
The message properties file to support locale (i.e. different
languages) message_de.properties and message_en.properties. Put these
files in the resource/properties folder. The property file is also
accessable from java classes. Here msgs is the resource bundle as
defined in the faces.config.
FacesContext context = FacesContext.getCurrentInstance(); ResourceBundle bundle = context.getApplication().getResourceBundle(context, "msgs"); String containerLegend = bundle.getString("containerlegend");
Other resource files are accessable using the static method ResourceBundle.getBundle(), see Java Tutorials. To access file
/properties/database.properties
(and the corresponding locale specific versions _de, _fr) useResourceBundle bundle = ResourceBundle.getBundle( "properties/database", context.getViewRoot().getLocale());
To access the properties files in web-pages (without explicit load) include properties files in faces-config.xhtml
- The Web-page to manage the container on stock. Put the file maintenanceContainer.xhtml in the directory WebContent/pages/stocks.
Date: 2011-02-11 Fr
HTML generated by org-mode 7.4 in emacs 22