2 原型说明
2.1 运行环境
JDK 1.4
WebSphere Portal Server 6.1 (Portlet JSR 168)
Domino 7
2.2 开发环境
JDK 1.5
Eelipse 3.3.1
MyEclipse 6.0.1
WebSphere Portal Server 6.1 (Portlet JSR 168)
DB2
Domino 7
2.3 原型结构图
Struts2 | DWR | Dojo | Freemarker | JFreeChart | JSP | |
Action | ||||||
Spring | Service | |||||
Manager | ||||||
Drools | ||||||
Ibatis | DAO | |||||
DB | DB2 | |||||
2.4 表示层
表示层使用Struts2来实现,整合了DWR,Dojo,Freemarker,JFreeChart等常用框架。满足了业务的常规要求。
2.5 业务层
业务层主要分:Service和Manager层来实现。交由Spring来管理。
2.6 持久层
持久层使用Ibatis来管理,由Spring来管理DAO对象。
2.7 权限控制
由WebSphere Portal Server来管理用户的权限,特别的需求由应用自己来读取LDAP来处理。
2.8 事务处理
由Spring 来处理简单事务,使用Spring的声明式事务来管理。
2.9 异常处理
建议模块捕获异常,通过返回状态码来处理。
2.10 公用组件
2.10.1 分页
分页功能主要包括表示层,业务层,和持久层三方面。
表示层通过传递PageValue对象,来将页码信息和结果集返回到jsp页面。使用Struts2标签来将页码和结果集显示出来。
业务层通过PageManager来操作IPage接口和IPageResult接口,来实现页码计算和数据获得进行分离。Page类实现IPage接口,来进行页码的计算。PageResult实现IPageResult接口,通过dao来获得相应的数据集,然后放到PageValue对象的list内,返回给页面。
持久层使用dao来管理,需要实现int getTotal()和List getResult(int top, int max)两个方法。
2.10.2 增删改查
由Action调用Service的相应方法来实现。
2 代码规范
2.1 包命名规范
包命名规则:
例:com.test.action action目录
com.test.action.edit 对应于portlet的edit模式下的action
com.test.action.chart 对应于portlet的view模式下的处理chart的action
com.test.domain 存放域对象
com.test.page 存放分页模块的业务处理类
com.test.logic.business 存放业务处理接口
com.test.logic.business.impl 存放业务处理实现类
com.test.logic.service 存放业务服务接口
com.test.logic.service.impl 存放业务服务实现类
com.test.persistence 存放Ibatis配置
com.test.persistence.dao 存放dao接口
com.test.persistence.dao.impl 存放dao实现类
globalMessages_en_US.properties 国际化配置文件
log4j.xml 日志配置文件
struts.properties struts配置文件
struts.xml struts配置文件
struts-chart.xml 功能模块的struts配置文件
struts-edit.xml 对应edit模式下的struts配置文件
validators.xml 校验配置文件
IndexEditProcessAction-validation.xml 对应action的校验配置文件
/WEB-INF/edit 相应模块的jsp目录
applicationContext.xml spring配置文件
dwr.xml dwr配置文件
portlet.xml portlet配置文件
struts-portlet-object.xml struts-portlet配置文件
web.xml web配置文件