??xml version="1.0" encoding="utf-8" standalone="yes"?>成a人v在线播放,久香视频在线观看,午夜精品99久久免费http://www.aygfsteel.com/luoqx/articles/20406.htmlpublisher luopublisher luoFri, 18 Nov 2005 03:49:00 GMThttp://www.aygfsteel.com/luoqx/articles/20406.htmlhttp://www.aygfsteel.com/luoqx/comments/20406.htmlhttp://www.aygfsteel.com/luoqx/articles/20406.html#Feedback0http://www.aygfsteel.com/luoqx/comments/commentRss/20406.htmlhttp://www.aygfsteel.com/luoqx/services/trackbacks/20406.html服务初始化过E?/span>
服务qo器初始化q程.bmp
    pȝ启动时初始化两部分,一是系l服务,二是pȝqo器,框架定义了系l服务和qo器的接口允许后期Ҏ实际业务实现新的服务和过滤器q|部|到pȝ中?/span>

         初始化服务的配置

配置信息如下Q?/span>

<system-config name="services">

              <item name="condition"

                     value="com.daosheng.service.impl.ConditionManagerImpl" />

</system-config>

只配|了一个服务:决策树服务?/span>

        初始化过滤器的配|?/span>

配置信息如下Q?/span>

<system-config name="filters">

                     <item name="codefilter"

                            value="com.daosheng.blackfin.controller.filter.CodeFilter" />

                     <item name="loginfilter" value="com.cqc.filter.LoginFilter" />

                     <item name="logfilter" value="com.cqc.filter.LogFilter" />

</system-config>

配置xml里面描述了三个过滤器分别是请求代码过滤器、登入过滤器、日志过滤器Q在pȝ初始化这?/span>FilterQ每ơ执行请求时都经q这些过滤器的过滤?/span>



publisher luo 2005-11-18 11:49 发表评论
]]>
ZJ2EE轻量U容器构件框架六、数据beanQDataBeanQ?/title><link>http://www.aygfsteel.com/luoqx/articles/20390.html</link><dc:creator>publisher luo</dc:creator><author>publisher luo</author><pubDate>Fri, 18 Nov 2005 02:54:00 GMT</pubDate><guid>http://www.aygfsteel.com/luoqx/articles/20390.html</guid><wfw:comment>http://www.aygfsteel.com/luoqx/comments/20390.html</wfw:comment><comments>http://www.aygfsteel.com/luoqx/articles/20390.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/luoqx/comments/commentRss/20390.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/luoqx/services/trackbacks/20390.html</trackback:ping><description><![CDATA[<p class="4TimesNewRoman"><a name="_Toc119800801"></a><a name="_Toc119769801"></a><a name="_Toc119769754"><span style=""><span style=""><!--[if !supportLists]--><span style="line-height: 156%;" lang="EN-US"><span style=""></span></span></span></span></a><span style=""><span style=""><span style=""><span style="font-family: 黑体;"></span></span></span></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US">Data Bean </span><span style="font-size: 12pt; font-family: 宋体;">在本框架中有</span><span style="font-size: 12pt;" lang="EN-US">Value Object</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">View Object</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">BO</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">Java Bean</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">POJO</span><span style="font-size: 12pt; font-family: 宋体;">{多Un份和用途?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">是个普通的</span><span style="font-size: 12pt;" lang="EN-US">JavaBean</span><span style="font-size: 12pt; font-family: 宋体;">Q作?/span><span style="font-size: 12pt;" lang="EN-US">POJO</span><span style="font-size: 12pt; font-family: 宋体;">通过</span><span style="font-size: 12pt;" lang="EN-US">O/R Mapping</span><span style="font-size: 12pt; font-family: 宋体;">来将数据固化到关pL据库或其它存储介质中Q作?/span><span style="font-size: 12pt;" lang="EN-US">Value Bean</span><span style="font-size: 12pt; font-family: 宋体;">可以数据在各层之间互相传输Q作?/span><span style="font-size: 12pt;" lang="EN-US">View Object</span><span style="font-size: 12pt; font-family: 宋体;">帮助</span><span style="font-size: 12pt;" lang="EN-US">JSP</span><span style="font-size: 12pt; font-family: 宋体;">面数据传输ƈ昄出来Q作?/span><span style="font-size: 12pt;" lang="EN-US">BO</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">service</span><span style="font-size: 12pt; font-family: 宋体;">层的</span><span style="font-size: 12pt;" lang="EN-US">Manager</span><span style="font-size: 12pt; font-family: 宋体;">们分别具有客观实物类的属性部分和行ؓ部分Q这样分d以服务层更好的分离出来q提供基于接口定义的服务Qƈ更好的</span><span style="font-size: 12pt;" lang="EN-US">Manager</span><span style="font-size: 12pt; font-family: 宋体;">及相关类形成独立的组ӞcM</span><span style="font-size: 12pt;" lang="EN-US">Session Bean,</span><span style="font-size: 12pt; font-family: 宋体;">W合</span><span style="font-size: 12pt;" lang="EN-US">façade</span><span style="font-size: 12pt; font-family: 宋体;">模式Q?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">贯穿于各个层Q所以当整个目l分配Q务是以层ơ来划分而不是以模块划分工作的时候,</span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">成了各开发h员定义Q务,理解dQ相互沟通的关键部分Q因?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">必须能够快速完成ƈ更新。因此本框架采用工具自动扚w生成的办法生?/span><span style="font-size: 12pt;" lang="EN-US">DataBean,</span><span style="font-size: 12pt; font-family: 宋体;">Z保证其准性,目l内严o止手工?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">来自于数据库模型直接生成?/span><span style="font-size: 12pt;" lang="EN-US">XML Schema</span><span style="font-size: 12pt; font-family: 宋体;">Qƈ通过</span><span style="font-size: 12pt;" lang="EN-US">Castor</span><span style="font-size: 12pt; font-family: 宋体;">生成</span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">。有专门l护数据库模型的人员l一生成Q即便在整个目q程中由于客L原因需求不断变更导致数据库设计不断变更Q?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">也能正确的快速的生成出来?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">q有三个个关键的Ҏ是</span><span style="font-size: 12pt;" lang="EN-US">marshal()</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">unmarshal()</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">validate()</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">Validate()</span><span style="font-size: 12pt; font-family: 宋体;">Ҏ提供了对数据q行校验的功能,q样不仅提供了在客户端用</span><span style="font-size: 12pt;" lang="EN-US">javascript</span><span style="font-size: 12pt; font-family: 宋体;">q行校验的功能,q能在服务器q行数据的校验?/span><span style="font-size: 12pt;" lang="EN-US">Marshal</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">unmarshal</span><span style="font-size: 12pt; font-family: 宋体;">两个Ҏ分别可以?/span><span style="font-size: 12pt;" lang="EN-US">DataBean</span><span style="font-size: 12pt; font-family: 宋体;">序列化和反序列化?/span><span style="font-size: 12pt;" lang="EN-US">xml</span><span style="font-size: 12pt; font-family: 宋体;">文gQ实C?/span><span style="font-size: 12pt;" lang="EN-US">xml</span><span style="font-size: 12pt; font-family: 宋体;">文g的快速{换功能。生成的</span><span style="font-size: 12pt;" lang="EN-US">xml</span><span style="font-size: 12pt; font-family: 宋体;">可以单独存储Q除了数据库存储的另一中固化方案)Q也可以作ؓ客户端浏览器</span><span style="font-size: 12pt;" lang="EN-US">xmlhttp</span><span style="font-size: 12pt; font-family: 宋体;">传输的数据格式,q可以作为提供的</span><span style="font-size: 12pt;" lang="EN-US">web service</span><span style="font-size: 12pt; font-family: 宋体;">的传递参敎ͼ</span><span style="font-size: 12pt;" lang="EN-US">SOA</span><span style="font-size: 12pt; font-family: 宋体;">Q?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <img src ="http://www.aygfsteel.com/luoqx/aggbug/20390.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/luoqx/" target="_blank">publisher luo</a> 2005-11-18 10:54 <a href="http://www.aygfsteel.com/luoqx/articles/20390.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ZJ2EE轻量U容器构件框架五、事务的AOP处理http://www.aygfsteel.com/luoqx/articles/20383.htmlpublisher luopublisher luoFri, 18 Nov 2005 02:33:00 GMThttp://www.aygfsteel.com/luoqx/articles/20383.htmlhttp://www.aygfsteel.com/luoqx/comments/20383.htmlhttp://www.aygfsteel.com/luoqx/articles/20383.html#Feedback0http://www.aygfsteel.com/luoqx/comments/commentRss/20383.htmlhttp://www.aygfsteel.com/luoqx/services/trackbacks/20383.html

权限、事务、日志处理如果؜杂在业务代码之中会整个代码变得非常复杂而且可读性很差,难以修改重构?/span>

面向对象的分析和设计引入了ѝ抽象和多态等概念Q由此ؓ我们提供了降低Y件复杂性的工具。但是,开发h员在软g设计q程中仍然经怼面对无法用面向对象Y件开发技术轻易解决的问题。这些问题之一是如何处理应用E序中的横切x点(Cross-cutting concernsQ?/span>

1、横切关注点

x点就是设计h员感兴趣的某一概念或区域。例如,在一个订货系l中Q核心关注点可能是订单处理和生Q而系l关注点可能是事务处理和安全理?/span>

横切xҎ影响多个cL模块的关注点Q即未能很好地局部化和模块化的关注点?/span>

横切x点的表现有:

·代码U结?/span>当一个模块或代码D同时管理多个关注点时发生这U情c?/span>

·代码分散?/span>当一个关注点分布在许多模块中q且未能很好地局部化和模块化时发生这U情c?/span>

q些现象会从几个斚w影响软gQ例如,它们会导致Y仉以维护和重用Qƈ且难以编写和理解?/span>

2、关注点的隔?/span>

面向斚w~程试图通过引入?/span>x点的隔离?/span>q一概念来解册些问题。采用这一概念Q可以以一U模块化而且适当局部化的方式实现关注点?/span>AOP解决q个问题的办法是在设计空间中增加额外一l_q且引入了一些构造,q些构造我们能够定义横切x点,它们{U进新的l_q且以模块化方式它们打 包?/span>

声明式的AOP事务配置如下Q?/span>

<bean id="nodeTarget"

              class="com.daosheng.service.impl.NodeManagerImpl" singleton="true"

              lazy-init="default" autowire="default" dependency-check="default">

              <property name="dao">

                     <ref local="nodeDAO" />

              </property>         

       </bean>

       <bean id="nodeManager"

              class="com.daosheng.cms.right.RightTransactionProxyFactoryBean"

              singleton="true" lazy-init="default" autowire="default"

              dependency-check="default">

              <property name="transactionManager">

                     <ref local="transactionManager" />

              </property>

              <property name="target">

                     <ref local="nodeTarget" />

              </property>

              <property name="transactionAttributes">

                     <props>                     

                            <prop key="insert*">

                                   PROPAGATION_REQUIRED,-ApplicationException

                            </prop>

                            <prop key="update*">

                                   PROPAGATION_REQUIRED,-ApplicationException

                            </prop>

                     </props>

              </property>

       </bean>

 

其实在注?/span>nodeManager时注册的实际cM是自己开发的NodeManagerImplc而是注册?/span>RightTransactionProxyFactoryBean代理工厂cR在其它c里调用?/span>nodeManagerҎ实际上是先调用的此代理工厂类的加入横切点代码Q事务处理代码)然后在调用的NodeManagerImpl的相应方法,q样实CNodeManagerImplc里不用操心事务问题Q而实际的事务由加入在切点?/span>Advice来完成。其在真正方法执行前启动事务Q执行后提交事务Q?/span>commitQ,如果出现异常则回滚(rollbackQ?/span>

       代理工厂cL采用jdk4以上自带的动态代理机制实现的?/span>

框架?/span>AOP中提供了4U处理切入类?/span>:around,before,after,introduction.֐思义,  
1) around
是针对具体的某个切入点的Ҏ(比如,现在有个OrderBookҎ,around的切入类型是p个方法的内部调用,是通过java的元 数据,在运行时通过Method.invoke来调?/span>,hq回?/span>,当发生意外的时候会l止.C的一Ҏ,q回?/span>.);  
2)before
是在Ҏ调用前调?/span>(?/span>OrderBookҎ前调?/span>,但是没有q回?/span>,同时在通常意外情况?/span>,会l运行下一步方?/span>.C的一Ҏ没有q回?/span>);  
3)after
?/span>before刚好相反,没有什么特别的地方.  
4)introduction
是一个更加特D的,但功能更加强大的切入cd.比如(你现在有Book对象,Computer对象,q有几十个这U业务对?/span>,现在你希望在每个q样的对象中都加入一个记录最后修改的旉.但是你又不希望对每个c都q行修改,因ؓ太麻烦了,同时更重要的一?/span>,破坏了对象的完整?/span>,说不定你以后又不需要这个时间数据了?/span>.框架AOPZ专门实现q种思想提供了一个切入处?/span>,那就?/span>introduction.introduction可以为动态加入某些方?/span>,q样可以在运行时,强制转换q些对象,q行插入旉数据的动?/span>,更深的内q就?/span>C++虚函C?/span>vtable思想).

下面时序图ؓ事务在整个各层代码协作过E中启动和提交的q程。每?/span>Manager或?/span>DAO实体可能是开发的实际cM可以是代理类?/span>

TransactionAOP.bmp


publisher luo 2005-11-18 10:33 发表评论
]]>
ZJ2EE轻量U容器构件框架四、异常处?/title><link>http://www.aygfsteel.com/luoqx/articles/20381.html</link><dc:creator>publisher luo</dc:creator><author>publisher luo</author><pubDate>Fri, 18 Nov 2005 02:27:00 GMT</pubDate><guid>http://www.aygfsteel.com/luoqx/articles/20381.html</guid><wfw:comment>http://www.aygfsteel.com/luoqx/comments/20381.html</wfw:comment><comments>http://www.aygfsteel.com/luoqx/articles/20381.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/luoqx/comments/commentRss/20381.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/luoqx/services/trackbacks/20381.html</trackback:ping><description><![CDATA[ <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US">Java</span><span style="font-size: 12pt; font-family: 宋体;">提供了两cM要的异常</span><span style="font-size: 12pt;" lang="EN-US">:runtime exception</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">checked exception</span><span style="font-size: 12pt; font-family: 宋体;">。所有的</span><span style="font-size: 12pt;" lang="EN-US">checked exception</span><span style="font-size: 12pt; font-family: 宋体;">是从</span><span style="font-size: 12pt;" lang="EN-US">java.lang.Exception</span><span style="font-size: 12pt; font-family: 宋体;">c衍生出来的Q?/span><span style="font-size: 12pt;" lang="EN-US">runtime exception</span><span style="font-size: 12pt; font-family: 宋体;">则是?/span><span style="font-size: 12pt;" lang="EN-US">Java.lang.RuntimeException</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">java.lang.Error</span><span style="font-size: 12pt; font-family: 宋体;">c衍生出来的?/span><span style="font-size: 12pt;" lang="EN-US"> <o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">从逻辑的角度来_</span><span style="font-size: 12pt;" lang="EN-US">checked exceptions</span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;" lang="EN-US">runtime exception</span><span style="font-size: 12pt; font-family: 宋体;">是有不同的用目的的?/span><span style="font-size: 12pt;" lang="EN-US">checked exception</span><span style="font-size: 12pt; font-family: 宋体;">用来指示一U调用方能够直接处理的异常情c?/span><span style="font-size: 12pt;" lang="EN-US">runtime exception</span><span style="font-size: 12pt; font-family: 宋体;">则用来指CZU调用方本n无法处理或恢复的E序错误?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">框架定义了一个异常基c?/span><span style="font-size: 12pt;" lang="EN-US">ApplicationException</span><span style="font-size: 12pt; font-family: 宋体;">是属?/span><span style="font-size: 12pt;" lang="EN-US">checked exceptions</span><span style="font-size: 12pt; font-family: 宋体;">cd主要有以下几个功能:</span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 27pt; text-indent: 0cm; line-height: 150%;"><!--[if !supportLists]--><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><span style="">1?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">            </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">异常自底向上抛出l一处理Q减处理代码:</span><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">传统Q过E式Q方式编E,采用q回参数告诉调用的函数被调用的函数出现错误,所以在调用函数里面要加入很多的</span><span style="font-size: 12pt;" lang="EN-US">if</span><span style="font-size: 12pt; font-family: 宋体;">从句来判断各个被调用函数是否正确q回|代码充斥了大量的大括受采用异常机Ӟ发生异常的位|包装成自定义的应用异常然后向上抛出Q上面的各层均不用处理直接抛出到l一异常处理?/span><span style="font-size: 12pt;" lang="EN-US">MainController</span><span style="font-size: 12pt; font-family: 宋体;">里面卛_Q由l一的类来处?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 27pt; text-indent: 0cm; line-height: 150%;"><!--[if !supportLists]--><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><span style="">2?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">          </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">异常l一~号Q用L到统一的处理信息:</span><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">每个异常都可以确定编Pq将~号与提CZ息维护在数据库中Q页面只昄l一l护的错误信息,q样׃会让错误信息~程开发h员随手写的不规范而且难以理解的信息,造成用户感觉pȝ难以使用?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 27pt; text-indent: 0cm; line-height: 150%;"><!--[if !supportLists]--><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><span style="">3?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">            </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">异常信息记录到错误日志中方便q踪异常位置Q?/span><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">l一处理E序抓取异常Qƈ异怿息记录日志。调试阶D还可以在控制台信息中打出异常堆Q方便开发h员快速定位异常发生位|?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="margin-left: 27pt; text-indent: 0cm; line-height: 150%;"><!--[if !supportLists]--><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><span style="">4?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">            </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">Ҏ获取异常</span><span style="font-size: 12pt; line-height: 150%;" lang="EN-US">AOP</span><span style="font-size: 12pt; line-height: 150%; font-family: 宋体;">声明式事务控制进行回滚操作:</span><span style="font-size: 12pt; line-height: 150%;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">整个开发用声明式的事务,何时回滚取决与应用异常的抛出?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">配置如下Q?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <table class="MsoTableGrid" style="border: medium none ; margin-left: 42pt; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"> <tbody><tr style="height: 147pt;"> <td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 384.4pt; height: 147pt;" valign="top" width="513"> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><property name="transactionAttributes"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><span style="">                     </span><props><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><span style="">                            </span><prop key="insert*"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><span style="">                            </span><span style="">       </span>PROPAGATION_REQUIRED,-ApplicationException<o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><span style="">                            </span></prop><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"><span style="">                     </span></props><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt;" lang="EN-US"></property><o:p></o:p></span></p> </td> </tr> </tbody> </table> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">应用异常基类如下图:<br> </span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><img src="http://www.aygfsteel.com/images/blogjava_net/luoqx/%E6%A1%86%E6%9E%B6%E5%9B%BE%E7%89%87/%E5%BA%94%E7%94%A8%E5%BC%82%E5%B8%B8.bmp" alt="应用异常.bmp" border="0" height="341" width="554"><br> </p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><span style="font-size: 12pt; font-family: 宋体;">其它异常都承于基类</span><span style="font-size: 12pt;" lang="EN-US">ApplicationException</span><span style="font-size: 12pt; font-family: 宋体;">Q主要包含错误编号属性(</span><span style="font-size: 12pt;" lang="EN-US">errorNumber</span><span style="font-size: 12pt; font-family: 宋体;">Q、异怿息(</span><span style="font-size: 12pt;" lang="EN-US">errorMessage</span><span style="font-size: 12pt; font-family: 宋体;">Q、异常跟t?/span><span style="font-size: 12pt;" lang="EN-US">(stackTrace)</span><span style="font-size: 12pt; font-family: 宋体;">。以便实Cq功能?/span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" style="text-indent: 21pt; line-height: 20pt;"><br> <span style="font-size: 12pt; font-family: 宋体;"></span><span style="font-size: 12pt;" lang="EN-US"><o:p></o:p></span></p> <img src ="http://www.aygfsteel.com/luoqx/aggbug/20381.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/luoqx/" target="_blank">publisher luo</a> 2005-11-18 10:27 <a href="http://www.aygfsteel.com/luoqx/articles/20381.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ZJ2EE轻量U容器构件框架三、控制器部分http://www.aygfsteel.com/luoqx/articles/20377.htmlpublisher luopublisher luoFri, 18 Nov 2005 02:23:00 GMThttp://www.aygfsteel.com/luoqx/articles/20377.htmlhttp://www.aygfsteel.com/luoqx/comments/20377.htmlhttp://www.aygfsteel.com/luoqx/articles/20377.html#Feedback0http://www.aygfsteel.com/luoqx/comments/commentRss/20377.htmlhttp://www.aygfsteel.com/luoqx/services/trackbacks/20377.htmlcontroller包提供了三个主要功能Q?/span>

如下图:

controller.bmp

1?span style="font-family: "Times New Roman"; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">  mvc的主控制servlet

Main ControllercL供了M控制作用Q所有的h都先映射到此cMQ然后在l一分发到各个部分控制类。由?/span>servlet是支持多U程的,所以性能是可以保证的?/span>

MainControllercȝ承于HttpServletc,主要Ҏ有:

1)        init()ҎQ初始化ҎQ在此方法里面主要初始化一些公q资源、服务,qo器和一些系l基配置参数{。初始化服务q程委托services包中?/span>Service ManagercL完成Q初始化各种filter?/span>filter包下?/span>Filter Manager来完成?/span>

2)        doPost()?/span>doGet()ҎQ接收各U请求ƈ交给processRequest()Ҏl一处理Q统一?/span>post, get两种h方式?/span>

通过?/span>web.xml中注册和映射Q得各U符合要求的h都直接{发到此控制类上,配置如下Q?/span>

       <servlet>

              <servlet-name>mainCommand</servlet-name>

              <servlet-class>

                     com.daosheng.blackfin.controller.MainController

              </servlet-class>

              <init-param>

                     <param-name>sysconfig</param-name>

                     <param-value>/WEB-INF/blackfin-config.xml</param-value>

              </init-param>

              <load-on-startup>1</load-on-startup>

       </servlet>

<servlet-mapping>

              <servlet-name>mainCommand</servlet-name>

              <url-pattern>/command/*</url-pattern>

       </servlet-mapping>

       <servlet-mapping>

              <servlet-name>mainCommand</servlet-name>

              <url-pattern>/main/*</url-pattern>

       </servlet-mapping>

              <servlet-mapping>

              <servlet-name>mainCommand</servlet-name>

              <url-pattern>*.cmd</url-pattern>

       </servlet-mapping>

q样到hurl?/span>.cmdl尾的或者以/command/?/span>/main/开头的都映到此类上来做统一处理。实Cl一控制功能?/span>

2?/span>filter的接口和理c?/span>

filter包主要包?/span>filter接口?/span>filter的管理类?/span>FilterManagerc负责初始化各注册的filter(开发h员可以自己开发ƈ注册在注册文件中),pȝ控制cL收到各种h先按需要交l过滤类Q?/span>filterQ来q行qoQ然后在由各自业务处理类完成业务处理?/span>

l一qocd以用来完成一些需要每ơ请求都需要判断的逻辑Q比如说d校验Q判断用h否登入过Q如果没有直接蟩转到d面Q还有一个比较关键的qo是CodeFiltercR一般的httph分ؓ两种cdQ一U是普通类型,一U是?/span>multipart cdQ?/span>form?/span>enctype="multipart/form-data"Q可以上传文Ӟ两种cdD在后面服务器端接?/span>form中的参数使用的方法各不相同,multipartcd的用getParameter()Ҏ是没法取出提交上来的参数的,而是要得C?/span>Binary数组自己q行分拆才能得到。导致程序取参数的不一致性,可移植性减弱。所以?/span>CodeFilterҎ?/span>requestq行qoQ将两种情况上传的各U参数都重新setAttribute?/span>request中,q样p够后面?/span>commandcd使用getAttribute()Ҏp取到实际的参数而不需要管是哪U方式提交的了,q且CodeFilter中还可以把一些字W过滤掉Q比如说单引L?/span>

3?/span>h辅助c?/span>

h辅助c(RequestHelperQ主要有两个作用Q一是将requestQ?/span>response和配|参数封装v来然后作?/span>command的参敎ͼ使每?/span>command都能够获取到前台h的各U信息,W二个作用是查找command的各U配|参C息?/span>




publisher luo 2005-11-18 10:23 发表评论
]]>
ZJ2EE轻量U容器构件框架二、M介绍http://www.aygfsteel.com/luoqx/articles/20372.htmlpublisher luopublisher luoFri, 18 Nov 2005 02:17:00 GMThttp://www.aygfsteel.com/luoqx/articles/20372.htmlhttp://www.aygfsteel.com/luoqx/comments/20372.htmlhttp://www.aygfsteel.com/luoqx/articles/20372.html#Feedback0http://www.aygfsteel.com/luoqx/comments/commentRss/20372.htmlhttp://www.aygfsteel.com/luoqx/services/trackbacks/20372.html利用此框架开发主要将代码分ؓ三层Q即控制层(CommandQ,业务逻辑层(ServiceQ和数据讉K层(DAOQ,command代码只关注于面跌{逻辑关系Q收集请求数据,转发h及最后蟩转到指定的显C页面(JSPQ;Service主要x于页面逻辑Q客L需求{化ؓ实际的业务逻辑qService层来实现Q其中权限事务日志等不是U业务的逻辑交由AOP的专门程序处理,使开发h员关注点聚焦而不会被J琐的其它事情所影响效率Q?/span>DAO层主要完成业务逻辑中需要与数据库间交互的部分代码,主要是跟sql语句Q存储过E等相应的数据库Q存储)打交道的部分代码的封装,把这一层抽d来可以实现更好的UL性(如果转换数据库,只要修改DAOq一层就可以了)。调用关pd如下Q?/span>

框架调用关系?bmp
    执行q程如上图,首先h发送给L制器Q主控制器委托辅助类Q?/span>Request HelperQ根据分?/span>url然后在配|文件中扑ֈ实际?/span>commandq执行,command获取h的参数ƈ委托Services层的各相?/span>ManagercL处理相应的业务逻辑Q其中如果有数据库操作的话则委托DAO来完成,结果返回到commandQ?/span>command结果(Data BeanQ重新放入请求中q根据配|信息{发到昄Q?/span>viewQ部分即JSP面Q最l?/span>JSP面负责取来的数据l合面信息生成html代码q回到客L览器上Q实C一个完整的交易q程?/span>


publisher luo 2005-11-18 10:17 发表评论
]]>
ZJ2EE轻量U容器构件框架一、Ml构?/title><link>http://www.aygfsteel.com/luoqx/articles/20366.html</link><dc:creator>publisher luo</dc:creator><author>publisher luo</author><pubDate>Fri, 18 Nov 2005 02:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/luoqx/articles/20366.html</guid><wfw:comment>http://www.aygfsteel.com/luoqx/comments/20366.html</wfw:comment><comments>http://www.aygfsteel.com/luoqx/articles/20366.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/luoqx/comments/commentRss/20366.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/luoqx/services/trackbacks/20366.html</trackback:ping><description><![CDATA[<img style="width: 517px; height: 331px;" src="http://www.aygfsteel.com/images/blogjava_net/luoqx/%E6%A1%86%E6%9E%B6%E5%9B%BE%E7%89%87/%E6%9E%84%E4%BB%B6%E6%A1%86%E6%9E%B6%E7%BB%93%E6%9E%84%E5%9B%BE.bmp" alt="构g框架l构?bmp" border="0"><br> <img src ="http://www.aygfsteel.com/luoqx/aggbug/20366.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/luoqx/" target="_blank">publisher luo</a> 2005-11-18 10:00 <a href="http://www.aygfsteel.com/luoqx/articles/20366.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个项目里单实用的O/R mapping的功能代?/title><link>http://www.aygfsteel.com/luoqx/articles/12758.html</link><dc:creator>publisher luo</dc:creator><author>publisher luo</author><pubDate>Mon, 12 Sep 2005 07:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/luoqx/articles/12758.html</guid><wfw:comment>http://www.aygfsteel.com/luoqx/comments/12758.html</wfw:comment><comments>http://www.aygfsteel.com/luoqx/articles/12758.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/luoqx/comments/commentRss/12758.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/luoqx/services/trackbacks/12758.html</trackback:ping><description><![CDATA[     摘要: 目里对框架的要求除了功能,扩展性,性能{方面的要求外还有对目开发周期与新手学习周期和难易度的考虑。由于项目开发时间压力很大,而且目l员?sql语句非常熟悉Q而且处于化普通开发h员开发量的考虑在此目中没有用hibernate和ibatis{已l成熟的持久层框Ӟ而是采用自己开 发的O/R mappingcL实现通用的插入删除修改以及查询(单表Q功能。基本能够满项目里?Q?0%?..  <a href='http://www.aygfsteel.com/luoqx/articles/12758.html'>阅读全文</a><img src ="http://www.aygfsteel.com/luoqx/aggbug/12758.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/luoqx/" target="_blank">publisher luo</a> 2005-09-12 15:58 <a href="http://www.aygfsteel.com/luoqx/articles/12758.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>现有框架单介l?/title><link>http://www.aygfsteel.com/luoqx/articles/11301.html</link><dc:creator>publisher luo</dc:creator><author>publisher luo</author><pubDate>Sat, 27 Aug 2005 05:43:00 GMT</pubDate><guid>http://www.aygfsteel.com/luoqx/articles/11301.html</guid><wfw:comment>http://www.aygfsteel.com/luoqx/comments/11301.html</wfw:comment><comments>http://www.aygfsteel.com/luoqx/articles/11301.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/luoqx/comments/commentRss/11301.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/luoqx/services/trackbacks/11301.html</trackback:ping><description><![CDATA[  此j2ee框架历经了几q几个项目的发展Q大部分东西q行了升U换代,部分被淘汰掉了。主要是在实际项目中应用U篏和发展v来的Q最新版l合? spring,service层和dao层的装配QIOCQ和通一容器理都交由spring来管理,q且借用AOP技术将日志、权限很好的抽离了出 来。由于时间、项目进度,目延箋性等一pd原因所以这ơ项目的最l框架定位ؓQ前面还是gl原有的自己开发的MVC框架Q类gstrutsQ?中间? 用spring来反向注入和理业务逻辑和数据访问层Q后面的o/r mapping是自己开发的单的处理E序Q采用反原理)。由于工E上的要求考虑的要求多一些,所以各U工L对简单实用一些没有那些成名的开源工具那 么功能强大和l构优美Q还有待完善和改q?br> 附时序图Q?br> <img src="http://www.aygfsteel.com/images/blogjava_net/luoqx/%E6%A1%86%E6%9E%B6%E5%9B%BE%E7%89%87/architecture.jpg" alt="architecture.jpg" border="0" height="718" width="1069"><br> <br> Saturday, August 27, 2005<br> <img src ="http://www.aygfsteel.com/luoqx/aggbug/11301.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/luoqx/" target="_blank">publisher luo</a> 2005-08-27 13:43 <a href="http://www.aygfsteel.com/luoqx/articles/11301.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">е</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƺ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ԫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">û</a>| <a href="http://" target="_blank">̨</a>| <a href="http://" target="_blank">ư</a>| <a href="http://" target="_blank">߰</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Զ</a>| <a href="http://" target="_blank">ľ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̨ʡ</a>| <a href="http://" target="_blank">֦</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Į</a>| <a href="http://" target="_blank">Ӳ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">żҿ</a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>