SlideShare a Scribd company logo
Gnizr Architecture Dr. Harry Chen CMSC 491S/691S February 25, 2008
Agenda Design patterns in gnizr WebWork and Spring configurations HelloWorldDemo revisit
Design Patterns Found in Gnizr Data Access Object (DAO) Inversion of Control (IoC) a.k.a Dependency Injection Singleton  Interceptor
Gnizr Architecture What’s DAO?
What’s DAO? A design pattern that allows developers to abstract and encapsulate the access to the data source.  User DB (MySQL) User Registration - add(user)  delete(user)  update(user) lookup(user) User record is OP okay? How do you design your program to do these?
Why use DAO? Hide SQL statements from the high-level program. Don’t want to write the same SQL multiple times in different class files Allow high-level programs to access DB records without knowing how the DB schema is designed
Tight-coupling is a bad idea Do you really want to write SQL every time you need to access the “customers” DB? Fetching data from “ResultSet” is complicated – it’s  column-driven . Not natural for OO programming
DAO Design Pattern http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
DAO Example
DAO Example User Registration User DB (MySQL) User (class) UserDAO UserDao implements… addUser(User): int deleteUser(User): boolean updateUser(User): boolean getUser(id): User
Gnizr DAO package Let’s scan through gnizr DAO API Bookmark User Tag Link Etc. http://dev.gnizr.com/javadocs/2.3.0/
Gnizr DAO Classes Let’s walkthough some DAO class implementation in gnizr UserDao.java (interface) UserDBDao.java (class impl) BookmarkDao.java (interface) BookmarkDBDao.java (class impl) [Switching to Eclipse…]
How Gnizr Business Logic is Created When are these objects created? What’s the life span of these objects? How are JDBC connections initialized?
Inversion of Control (IoC) IoC is a principle that encourage the decoupling of code.  A.K.A. Dependency Injection. Problem : The use of “MovieFinderImpl” is hardwired into “MovieLister”. Change this logic will require code rewrite and re-compile “MovieFinderImpl” Read: http://martinfowler.com/articles/injection.html
Spring IoC A framework that can be coupled with WebWork to provide Dependency Injection.  Spring IoC  implements a flexible “Assembler”. Developers can tell this “Assembler” how to perform “<create>” via XML configuration. http://static.springframework.org/spring/docs/2.0.x/reference/beans.html
IoC in Gnizr How to create “hocks” for  Connecting DAO objects to Gnizr Core class objects Connecting Gnizr Core class objects to WebWork action objects Injecting application configuration at runtime [Switching to Eclipse…]
Design Pattern: Singleton A design pattern that restricts the instantiation of a class to  one object. Singleton is used when you want exactly one object to be created in the system. Singletons in gnizr, for example, GnizrBasicDataSource (holds JDBC settings) All DAO objects (not Transport objects) Gnizr Core class objects
WebWork Actions are not Singletons 99% of times, you should not define WebWork actions as Singletons. Because….
Actions are not Singleton WebWork actions are not singletons because multiple action objects are needed to serve multiple user sessions. user session action DAO MySQL Singleton is okay under what condition?
WebWork Actions in gnizr Let’s review some Action class in gnizr [switching to Eclipse…]
WebWork Interceptors Interceptors are classes that can be defined to pre-process request or post-process response. Validate parameter value (e.g., password length must 8, no symbols are allowed) Map HTTP parameter values to Beans and call “set” methods. Create HTTP session automatically …
Interceptor http://java.sun.com/blueprints/corej2eepatterns/Patterns/InterceptingFilter.html
Interceptor  http://java.sun.com/blueprints/corej2eepatterns/Patterns/InterceptingFilter.html
Gnizr WebWork configuration Let’s review Gnizr’s webwork configuration. [switching to Eclipse]
WebWork Result Types Result Types are classes that determine what happens after an Action executes and a Result is returned.
Which Result Type to Choose The “name” of the result determines which Result Type to apply after an Action executes The “name” maybe “success”, “error” or any string that you choose return in your “execute()” method, or “go()” if you extends the “AbstractAction” class.
Gnizr Result Type Examples Let’s review some example of Action configuration in gnizr, and see how different Result Types play a role in the application File: gnizr-useradmin.xml File: gnizr-bookmark.xml File: gnizr-json.xml (searchproxy action) [swithcing to Eclipse…]

More Related Content

PPTX
Introduction to react js
PPTX
Intro to React
PPT
Hibernate
PDF
Angular JS tutorial
PPTX
Introduction to React JS for beginners
ODP
Spring survey
PPTX
Its time to React.js
PDF
Introduction to react js
Intro to React
Hibernate
Angular JS tutorial
Introduction to React JS for beginners
Spring survey
Its time to React.js

What's hot (20)

PPTX
Introduction to React JS for beginners | Namespace IT
PPTX
Angular js for beginners
PPTX
Require js
PPTX
AngularJS Beginners Workshop
PPTX
ANGULAR JS TRAINING IN PUNE
PDF
Spring online training
PPTX
Step by Step - AngularJS
PPTX
AngularJS - Architecture decisions in a large project 
PDF
Learning React - I
PPTX
React JS .NET
PDF
React JS - Introduction
PPTX
EJB 3.0 course Sildes and matrial
PPTX
Angular js architecture (v1.4.8)
PPTX
google gwt
KEY
Cocoa Design Patterns
PPTX
[Srijan Wednesday Webinars] The Fundamentals of ReactJS
ODP
Introduction to Knockout Js
PPTX
AngularJS intro
PDF
React js
PPTX
MVC + ORM (with project implementation)
Introduction to React JS for beginners | Namespace IT
Angular js for beginners
Require js
AngularJS Beginners Workshop
ANGULAR JS TRAINING IN PUNE
Spring online training
Step by Step - AngularJS
AngularJS - Architecture decisions in a large project 
Learning React - I
React JS .NET
React JS - Introduction
EJB 3.0 course Sildes and matrial
Angular js architecture (v1.4.8)
google gwt
Cocoa Design Patterns
[Srijan Wednesday Webinars] The Fundamentals of ReactJS
Introduction to Knockout Js
AngularJS intro
React js
MVC + ORM (with project implementation)
Ad

Viewers also liked (8)

PDF
Sistema Per La Partecipazione Alberone 12 1 08
PPT
Sistema Per La Partecipazione Presentazione Alberone Completa
PPTX
Copenaghen Nel Lazio Def
PPT
OpenSearch
PPT
Machine Tags
PPT
RSS and Atom in the Social Web
PPT
Inside Gnizr
PPT
Sistema Per La Partecipazione Sintesi
Sistema Per La Partecipazione Alberone 12 1 08
Sistema Per La Partecipazione Presentazione Alberone Completa
Copenaghen Nel Lazio Def
OpenSearch
Machine Tags
RSS and Atom in the Social Web
Inside Gnizr
Sistema Per La Partecipazione Sintesi
Ad

Similar to Gnizr Architecture (for developers) (20)

PPTX
Onion Architecture / Clean Architecture
ODP
Yii Framework - Do we really need another php framework?
PPT
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
PDF
Simplifying SAP Plant Maintenance
PPTX
Spring Actionscript at Devoxx
PPTX
No more Three Tier - A path to a better code for Cloud and Azure
PDF
IPC07 Talk - Beautiful Code with AOP and DI
PDF
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
PPTX
Application Architecture
PDF
Designing For Change
PPTX
Software Development: Beyond Training wheels
PPT
Sims4 gkce
PPTX
Architecture Principles CodeStock
PPTX
Common ASP.NET Design Patterns - Telerik India DevCon 2013
PPTX
OOP -interface and objects.pptx
PPTX
Marco Mancuso - Data Context Interaction
PPT
Spring Framework
PPT
Hybernat and structs, spring classes in mumbai
PDF
Repository and Unit Of Work Design Patterns
PPTX
How to organize the business layer in software
Onion Architecture / Clean Architecture
Yii Framework - Do we really need another php framework?
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Simplifying SAP Plant Maintenance
Spring Actionscript at Devoxx
No more Three Tier - A path to a better code for Cloud and Azure
IPC07 Talk - Beautiful Code with AOP and DI
Nina Grantcharova - Approach to Separation of Concerns via Design Patterns
Application Architecture
Designing For Change
Software Development: Beyond Training wheels
Sims4 gkce
Architecture Principles CodeStock
Common ASP.NET Design Patterns - Telerik India DevCon 2013
OOP -interface and objects.pptx
Marco Mancuso - Data Context Interaction
Spring Framework
Hybernat and structs, spring classes in mumbai
Repository and Unit Of Work Design Patterns
How to organize the business layer in software

More from hchen1 (10)

PPT
Semantic Web 2.0
PPT
Semantic HTML
PPT
Geonames
PPT
Google Maps API
PPT
Geospatial Web
PPT
An Introduction to Ajax Programming
PPT
Web 2.0 Mashups
PPT
Folksonomy and Tagging in the Social Web
PPT
Developing Java Web Applications
PPT
Social Web Technologies
Semantic Web 2.0
Semantic HTML
Geonames
Google Maps API
Geospatial Web
An Introduction to Ajax Programming
Web 2.0 Mashups
Folksonomy and Tagging in the Social Web
Developing Java Web Applications
Social Web Technologies

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Approach and Philosophy of On baking technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
Approach and Philosophy of On baking technology
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Gnizr Architecture (for developers)

  • 1. Gnizr Architecture Dr. Harry Chen CMSC 491S/691S February 25, 2008
  • 2. Agenda Design patterns in gnizr WebWork and Spring configurations HelloWorldDemo revisit
  • 3. Design Patterns Found in Gnizr Data Access Object (DAO) Inversion of Control (IoC) a.k.a Dependency Injection Singleton Interceptor
  • 5. What’s DAO? A design pattern that allows developers to abstract and encapsulate the access to the data source. User DB (MySQL) User Registration - add(user) delete(user) update(user) lookup(user) User record is OP okay? How do you design your program to do these?
  • 6. Why use DAO? Hide SQL statements from the high-level program. Don’t want to write the same SQL multiple times in different class files Allow high-level programs to access DB records without knowing how the DB schema is designed
  • 7. Tight-coupling is a bad idea Do you really want to write SQL every time you need to access the “customers” DB? Fetching data from “ResultSet” is complicated – it’s column-driven . Not natural for OO programming
  • 8. DAO Design Pattern http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
  • 10. DAO Example User Registration User DB (MySQL) User (class) UserDAO UserDao implements… addUser(User): int deleteUser(User): boolean updateUser(User): boolean getUser(id): User
  • 11. Gnizr DAO package Let’s scan through gnizr DAO API Bookmark User Tag Link Etc. http://dev.gnizr.com/javadocs/2.3.0/
  • 12. Gnizr DAO Classes Let’s walkthough some DAO class implementation in gnizr UserDao.java (interface) UserDBDao.java (class impl) BookmarkDao.java (interface) BookmarkDBDao.java (class impl) [Switching to Eclipse…]
  • 13. How Gnizr Business Logic is Created When are these objects created? What’s the life span of these objects? How are JDBC connections initialized?
  • 14. Inversion of Control (IoC) IoC is a principle that encourage the decoupling of code. A.K.A. Dependency Injection. Problem : The use of “MovieFinderImpl” is hardwired into “MovieLister”. Change this logic will require code rewrite and re-compile “MovieFinderImpl” Read: http://martinfowler.com/articles/injection.html
  • 15. Spring IoC A framework that can be coupled with WebWork to provide Dependency Injection. Spring IoC implements a flexible “Assembler”. Developers can tell this “Assembler” how to perform “<create>” via XML configuration. http://static.springframework.org/spring/docs/2.0.x/reference/beans.html
  • 16. IoC in Gnizr How to create “hocks” for Connecting DAO objects to Gnizr Core class objects Connecting Gnizr Core class objects to WebWork action objects Injecting application configuration at runtime [Switching to Eclipse…]
  • 17. Design Pattern: Singleton A design pattern that restricts the instantiation of a class to one object. Singleton is used when you want exactly one object to be created in the system. Singletons in gnizr, for example, GnizrBasicDataSource (holds JDBC settings) All DAO objects (not Transport objects) Gnizr Core class objects
  • 18. WebWork Actions are not Singletons 99% of times, you should not define WebWork actions as Singletons. Because….
  • 19. Actions are not Singleton WebWork actions are not singletons because multiple action objects are needed to serve multiple user sessions. user session action DAO MySQL Singleton is okay under what condition?
  • 20. WebWork Actions in gnizr Let’s review some Action class in gnizr [switching to Eclipse…]
  • 21. WebWork Interceptors Interceptors are classes that can be defined to pre-process request or post-process response. Validate parameter value (e.g., password length must 8, no symbols are allowed) Map HTTP parameter values to Beans and call “set” methods. Create HTTP session automatically …
  • 24. Gnizr WebWork configuration Let’s review Gnizr’s webwork configuration. [switching to Eclipse]
  • 25. WebWork Result Types Result Types are classes that determine what happens after an Action executes and a Result is returned.
  • 26. Which Result Type to Choose The “name” of the result determines which Result Type to apply after an Action executes The “name” maybe “success”, “error” or any string that you choose return in your “execute()” method, or “go()” if you extends the “AbstractAction” class.
  • 27. Gnizr Result Type Examples Let’s review some example of Action configuration in gnizr, and see how different Result Types play a role in the application File: gnizr-useradmin.xml File: gnizr-bookmark.xml File: gnizr-json.xml (searchproxy action) [swithcing to Eclipse…]