| jwma's Architecture - Model Element |  | 
| Main | Deployment | Configuration | Architecture | Development | Screenshots | SF Project Site | |
| Index | Overview | Model (M) | View (V) | Controller (C) | Other Elements | |
  Model Design
  
  The design of the Model element has been primarily driven by the requirement 
  to enable a true seperation of application logic and presentation based on the 
  MVC Model 2 architecture. However, there are some additional objectives:
The deployed basic model construct resulting from these requirements consists of:
Figure 1 shows the abstract simplified model construct (left side) and jwma's folder implementation (right side) as example.
|  |  | 
| Figure 1: Basic Model Construct | |
  However, not everything is implemented in such a basic "one class implements 
  one interface" construct. When more convenience can be achieved for the 
  view designer, a class might implement two or three simplified interfaces, each 
  of which abstracts the actual implementation (for an example, see Figure 2).
|  | 
| Figure 2: Real Example from jwma | 
 
  The 
  View Designer's Perspective
  
  A set of interfaces, exposing only accessor methods (following the JavaBeans 
  nomenclature; i.e. get and is instance operations 
  whenever suitable), defines the contract between the view designer and the model.
  Figure 3 demonstrates an example using the JwmaTrashInfo. The left 
  side shows the UML interface documentation, the right side a possible use in 
  a JSP/HTML based view implementation. Code elements are highlighted with blue 
  color. Note the htmlhelper instance, which is an utility class serving 
  the purpose of keeping a view designer's life simple.
|  | <%-- Trash status information 
      --%> <table width="90%"> <tr> <td width="100%"align="right"> <% if (trash.isEmpty()) { %> <img border="0" src="images/trash_empty.png" alt="<i18n:message key="trashbin.empty"/>"> <% } else { %> <a href="<%= htmlhelper.getFolderDisplayAction(trash) %>"> <img border="0" src="images/trash_full.png" alt="<i18n:message key="trashbin.full"/>"> </a> <% } %> </td> </tr> </table> <%-- END: Trash status information --%> | 
| Figure 3: Example use of JwmaTrashInfo in a JSP/HTML based View | |
  The complete set of interfaces is documented in an annotated 
  UML class diagram. Additional documentation can be found in the development 
  section (add link).
  
  The 
  Controller Programmer's Perspective
  
  The actual implementations of the interfaces providing the view designer's perspective 
  represent the controller programmer's perspective. Exceptions to this pattern 
  are only the newly introduced plugin constructs (see documentation). Figure 
  4 presents an example class and a related piece of controller code (based on 
  a plain servlet).
|  | /** * Removes a mail identity. * * @param session a <code>JwmaSession</code> instance. * * @throws JwmaException if it fails to execute properly. */ private void doRemoveMailIdentity(JwmaSession session, String uid) throws JwmaException { JwmaPreferencesImpl prefs = session.getPreferences(); //remove the instance prefs.removeMailIdentity(uid); //save session.savePreferences(); //redirect session.redirect(JwmaKernel.PREFERENCES_VIEW); }//doRemoveMailIdentity | 
| Figure 4: Example use of JwmaPreferencesImpl in a plain Servlet based Controller | |
  The complete set of interfaces and classes of the model is documented in an 
  annotated UML class 
  diagram. 
  (Note: It takes quite some space, because I have tried my best to 
  unclutter it...)
  
  Additional documentation can be found in the development 
  section.
| © 2000-2003 jwma team |  |