Transforming the e-Concordiensis
Download
Report
Transcript Transforming the e-Concordiensis
Transforming the
e-Concordiensis
Edward Maas
Senior Capstone Design Project
Advisor: Professor Cass
About the Project
Client: Concordiensis ( School Newspaper )
Website: http://concordy.union.edu
Project: created a robust electronic publishing
infrastructure.
Transformed From: HTML & PDF Articles
Technology Used
Custom Content Management System
Open Source JAVA Tools:
Model-View-Controller for the Web
Object / Relational Persistence and Query Service
Struts (http://struts.apache.org/ )
Hibernate (http://www.hibernate.org/ )
Image Manipulation
Image Conversion (TIFF-to-PNG)
Tiff2png tool (http://www.libpng.org/pub/png/apps/tiff2png.html)
Image Scaling
JMagick (http://www.yeo.id.au/jmagick/)
How it works?
Browser (Mozilla, IE, Firefox, Safari)
Model
View (JSP)
2
4
5
Controller
2
Relational Database (MySQL 4.1)
3
STRUTS
Presentation ( jsp includes & tiles )
Object 2 Relational
(Hibernate)
Java Server (tomcat)
1
Request
Business
Logic
Data Access
(hibernate)
View
Response
How Struts is Used!
Created Forms (model)
AddArticleForm, LoginForm, etc
<form-bean name="LoginForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String" />
<form-property name="password" type="java.lang.String" />
</form-bean>
Wrote classes to process forms
edu.union.struts.LoginForm.java:
// Get Username & Password from form
String username = (String)(newLoginForm.get("username"));
String password = (String)(newLoginForm.get("password"));
// Check to make sure they’re in the database & passwords are correct
Staff authUser = (Staff)smanager.getBySignInCredentials(username, password);
//On Login Success
return (mapping.findForward("success"));
Hibernate
Call
Struts Usage Continued…
Create Action Mappings (controller)
Validation & Forwards
<action path="/admin/LoginForm"
type="edu.union.struts.LoginForm" name="LoginForm"
scope="request" validate="true" input="/Login.jsp">
<forward name="success" path="/AdminIndex.jsp" />
</action>
Failure
is defined globally
<global-forwards>
<forward name="failure" path="/admin/Login.do" />
<forward name="login" path="/admin/Login.do" />
</global-forwards>
Data Organization (relational)
ER Diagram
How Hibernate Works!
Define HBM
XML config, Struts uses one too!
Defines correspondence between tables and classes
Defines Keys / Relationships
Create Value Object Classes
public Integer getId() {
return this.Id;
}
public void setId(Integer Id) {
this.Id = Id;
}
Data Organization
Section.java
Edition.java
{Date, Volume, Publish}
Sports
News
Arts
Sets
Represent
Multi-valued
Relationships
Update can
be made with
a single
action
Features
{Title }
Images
Articles
{ AuthorName
Headline
Content }
Staff
Hibernate Data Pseudo Diagram
{ Filename
Height
Width }
Hibernate In Action!
Create Queries (HQL)
List users = session.find( "from Staff as staff where " +
"staff.username = ? and staff.password = ?",
new Object[] { uUsername, uPassword },
new Type[] { Hibernate.STRING, Hibernate.STRING });
Integrate within Controller (Struts)
Staff authUser = (Staff)
smanager.getBySignInCredentials(username, password);
Presentation Layer !
JSP Templates
(Green)
Struts &
Standard JSP
Tags for form
elements
(Black)
Custom Java
Tags (Yellow)
Custom Layout
Tag:
StoryTag.java
AssignPhoto
Form
Struts at work –
CheckImages.jsp
Putting it All Together!
Code written primarily on Linux
Revisions tracked with cvs
Build & Deployment Process: Apache Ant
Java Container: Jakarta Tomcat 5.x
Next Steps & Neat Additions!
Present Finished Product to Concordy Editors
for beta testing
Deploy Database and Application on VU
Performance Test under actual traffic!
Add Editing features to data in the Content
Manager
Fix Access Control Lists
Create RSS Syndication Feeds
More cross browser/ machine layout & GUI
Questions ?