1、Professional Portal Development with Open Source Tools Design Pattern Considerations in Your PortalClearly, there are many ways to implement a design that cannot be expressed adequately in this chapteralone. Hopefully, the introduction of high-level pattern constructs and brief discussion of the imp
2、lementationof Java standards in this chapter can facilitate your design decisions on your portal deployments. Java language and implementation standards can also help control complexity so that consistent levels ofquality can be attained in your development activities. This in turn can lead to incre
3、ased partner adoptionand portlet maintenance. Last, the adoption of design patterns should be applied so that best practices arepropagated in your portal deployment and development operations can be hastened. Much has been written during the last few years about design patterns and their use in Java
4、 development,so rather than go into great elaboration of their use, we felt that it would be more beneficial to providehigh-level concepts of patterns that might be used in your portal deployments and to encourage you toexplore them from the online Javaworld newsletter and from the Core J2EE Pattern
5、s book ALUR. Planning for Portal Deployment Using Java Standards For many mission-critical development portal efforts, decisions need to be made about expensive softwareprocurements to satisfy your development needs. In order to protect this investment, it is wise toconsider standards when you make
6、your purchasing decision because there is nothing worse thandumping a lot of money into a particular framework only to learn after you have obtained it that it is aclosed, proprietary system that does not work well with other systems. To guarantee that this does nothappen to you, you should become f
7、amiliar with software standards and other application frameworksuse of them. Regrettably, systems that do rely heavily on proprietary extensions often force your projectto hire expensive expertise to help you deploy your program with their framework. Figure 7.21 illustrates some of the Java standard
8、s that could be considered for portal development. It isimportant to remember that these need to be established prior to procuring a portal framework or integratingexisting applications into a homegrown portal application. Always be cognizant of the latest versionsof the standards listed in Figure 7
9、.21, and the effects that newer versions of those standards mighthave on your design decisions. - 1 - Figure 7.21 Figure 7.22 illustrates some of the portal standards that should be considered before building your portalapplication. On many portal implementations, a business case for adherence to la
10、nguage standards that relate toindividual portlets needs to be made so that proprietary extensions are not adopted by a program thatdisallows code reuse and promotes vendor lock-in. Being exposed to proprietary data formats, oneinevitably gets increasingly locked into the solutions of a particular v
11、endor, which in turn limits theoptions for application software. This ultimately enables vendors to dictate enhancement prices andintroduces unnecessary risks to your system Figure 7.22 - 2 - Model-View-Controller (MVC) Pattern In the portal architecture shown in Figure 7.23, theMVC Patternis where
12、the servlet controller rendersdifferent views to the portal faade from a disparate set of data sources. Themodelis the piece that has no specific knowledge of its controllers or its views. The portal systemmaintains relations between the different models and views and broadcasts content to the views
13、 whenthe model changes state. The viewis typically the piece that manages the visualizations of the modeldata. Thecontrolleris the piece that manages user interaction with the model data. The MVC Pattern is used with many frameworks because of its ability to handle content delivery complexitiesthat
14、are prominent in many enterprise systems. Jakartas Struts and BEAs WebFlow are twonotable implementations that use this in their frameworks. Template Method Pattern A good practice when developing JavaBeans in your portal applications is to use the Template MethodPattern GoF to enforce a common desi
15、gn across the portal back-end. The Template Method Pattern canbe used so that modifications to your get and/or set methods will not affect your presentation view. In the portal display in Figure 7.23, the JavaBean applications on the back-end implement the TemplateMethod Pattern to manage the logic
16、in the accessor (get/set) methods. Memento Pattern In the sample portal visualization shown in Figure 7.23, the view labeled #4 indicates that a form will berendered to the user display. In many cases, the form will use JavaScript to perform validation testing sothat activities will be performed on
17、the client side in order to alleviate unnecessary operations on theserver. This is a good practice for some Web applications, especially portals that perform heavy serveroperations, but sometimes incompatibilities in browsers allow inconsistent behaviors to occur. TheMemento Pattern GoF will persist
18、 the state of the form entries so that submits retain that data inthe form text fields, and can perform server-side validation operations on that data. Facade Pattern The Faade PatternGoF is used in the portal application shown in Figure 7-23 to facilitate tediousoperations that are associated with a database connection. Some of the operations that would warrantthe use of a faade include the following: database connection handling, driver setups, and SQL statementconstruction.