﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-李李的技术博客-随笔分类-技术</title><link>http://www.blogjava.net/scorpio_leon/category/3561.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 08:43:18 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 08:43:18 GMT</pubDate><ttl>60</ttl><item><title>bba96 tiger 1.0 beta2 -- 源于bba96重构 降低侵入性，去除接口依赖</title><link>http://www.blogjava.net/scorpio_leon/archive/2006/06/10/51877.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Sat, 10 Jun 2006 11:16:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2006/06/10/51877.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/51877.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2006/06/10/51877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/51877.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/51877.html</trackback:ping><description><![CDATA[
		<p>为了降低侵入性，更好的被引用，对bba96核心部分进行了大量重构，去除了冗赘的层次与不必要的接口，并借助jdk5.0范型进行了代码精简。发布了bba96 tiger beta2，这个版本已经是比较稳定的版本，具体的改动如下<br /></p>
		<ul>
				<li>去除所有的接口依赖，可直接在任何项目中直接调用 
</li>
				<li>service的两层合并为一层且去除service层的接口，但DAO曾仍保留接口以备扩展更多的orm实现 
</li>
				<li>增加sql execute的方法 
</li>
				<li>增强源自view的直接查询能力 
</li>
				<li>参数名由原来难看的oriNames, oriOperators, oriStringValues改为直观的searchName, searchOperator, searchValue 
</li>
				<li>增加了对QueryParam的toString功能，可打出对应的sql，便于调试，参见com.bba96.tiger.util.QueryWebUtils的main函数 </li>
		</ul>
		<p>下载页面地址：<a href="https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0">https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0</a></p>
		<p>如果你使用spring+hibernate，而又不喜欢hibernate criteria的麻烦，不妨尝试一下bba96，你可以把主要精力放到业务方面。DefaultEntityManager提供了很多单层逻辑的便利方法给你使用，其中也包括执行hsql或者sql查询/更新的方法，如果你要多层次逻辑的条件查询可以自己组装QueryObject，参见com.bba96.tiger.util.QueryWebUtils的main函数。bba96还提供给你在view层自由增加查询的能力。<br /><br />tiger版本仅提供了dao/service部分，所以如果你希望在view 查询的安全性方面得到加强，可参考bba96 2.0其中的webwork view部分，权限部分也没有包含在tiger中，希望尽快把包括例子的权限部分迁移过来，但还需要一点时间，最近在忙一个CMS的产品，时间不够用啊……</p>
		<p>在<a class="" title="春天的旁边" href="http://www.springside.org.cn/" target="_blank">SpringSide</a>项目中webwork MVC部分应用到bba96 tiger对view部分的查询，有兴趣可以看看，这里也要推荐一下<a class="" title="春天的旁边" href="http://www.springside.org.cn/" target="_blank">SpringSide</a>，确实有很多很好的经验在里面可以借鉴。</p>
<img src ="http://www.blogjava.net/scorpio_leon/aggbug/51877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2006-06-10 19:16 <a href="http://www.blogjava.net/scorpio_leon/archive/2006/06/10/51877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bba96 快速开发框架 发布2.0 RC1</title><link>http://www.blogjava.net/scorpio_leon/archive/2006/03/08/34169.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Tue, 07 Mar 2006 17:24:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2006/03/08/34169.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/34169.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2006/03/08/34169.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/34169.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/34169.html</trackback:ping><description><![CDATA[
		<p>bba96 CHANGELOG<br />==========================<br /><a href="http://bba96.dev.java.net">http://bba96.dev.java.net</a><br /><br />Changes in version 2.0 alpha3 (2006.4.3)<br />*fix action query parameters bug -- [XXX:...]<br />*fix distinct bug (discard Criteria.DISTINCT_ROOT_ENTITY)<br />*some minor improvement</p>
		<p>Changes in version 2.0 alpha2.2 (2006.3.16)<br />*update webwork's jar for fixing example bug in weblogic<br />*remove all contentType setting in example</p>
		<p>Changes in version 2.0 alpha2.1 (2006.3.8)<br />*fix example bug<br />*update readme.txt</p>
		<p>Changes in version 2.0 alpha1 (2006.3.7)<br />*webwork 2.2 support<br />*hibernate 3.x support, then support native sql<br />*fix some bug<br />*add aop security module<br />*add action query parameters validation<br />*enhance action query parameters management<br />*support more logic in action query<br />*support multi orderby property</p>
		<p>
				<br />Changes in version 1.0 (2005.09.23)<br />*release first</p>
		<p>
				<br />源码下载（包含两个快速开发的例子。） <br /><a href="https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0" target="_blank">https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0</a><br /><br />简介参见<a href="/scorpio_leon/archive/2005/11/09/18878.aspx">http://www.blogjava.net/scorpio_leon/archive/2005/11/09/18878.aspx</a></p>
<img src ="http://www.blogjava.net/scorpio_leon/aggbug/34169.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2006-03-08 01:24 <a href="http://www.blogjava.net/scorpio_leon/archive/2006/03/08/34169.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>慎用Webwork的getText，使用不当效率可能会很低</title><link>http://www.blogjava.net/scorpio_leon/archive/2006/01/21/28871.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Sat, 21 Jan 2006 05:26:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2006/01/21/28871.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/28871.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2006/01/21/28871.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/28871.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/28871.html</trackback:ping><description><![CDATA[很容易找到getText实际的操作类是LocalizedTextUtil，方法public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args, OgnlValueStack valueStack)；<BR><BR>java doc 如下<BR>
<P>Finds a localized text message for the given key, aTextName. Both the key and the message itself is evaluated as required. The following algorithm is used to find the requested message: 
<P>
<OL>
<LI>Look for message in aClass' class hierarchy. 
<OL>
<LI>Look for the message in a resource bundle for aClass 
<LI>If not found, look for the message in a resource bundle for any implemented interface 
<LI>If not found, traverse up the Class' hierarchy and repeat from the first sub-step </LI></OL>
<LI>If not found and aClass is a ModelDriven Action, then look for message in the model's class hierarchy (repeat sub-steps listed above). 
<LI>If not found, look for message in child property. This is determined by evaluating the message key as an OGNL expression. For example, if the key is <I>user.address.state</I>, then it will attempt to see if "user" can be resolved into an object. If so, repeat the entire process fromthe beginning with the object's class as aClass and "address.state" as the message key. 
<LI>If not found, look for the message in aClass' package hierarchy. 
<LI>If still not found, look for the message in the default resource bundles. 
<LI>Return defaultMessage </LI></OL>
<P>主要就是查找resource bundle，下面说明一下<BR>1. 先查找该class（一般我们是在action调用，就是该action对应的class了）对应的properties文件，找不到再去找对应的接口，找不到再去从该class的继承树上去重复前面的步骤。<BR>2. 如果是ModelDriver，以上找不到再以model的class去重复1的步骤<BR>3.继续找，如果key是符合ognl表达式还以ognl表达式去解析类，如果能找到类，还以以上的步骤去查找<BR>4. 还找不到，就从根据package以及package的继承树去找，这还包括了该class的继承树所有的class的package树（这一步存在了太多的重复查找工作，因为很多package都是相同的）<BR>5 使用默认的resource bundle<BR><BR>java.util.ResourceBundle虽然有cache，但是ww为了减少调用getResourceBundle方法，也维护了一个miss的hashset，找不到的bundle name就丢进去，那么每一次查找都同步了这个miss，如果很多次查找，开销也是很大的。<BR><BR>我就举一个例子，就说第四步查找package树好了<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;nothing&nbsp;still?&nbsp;alright,&nbsp;search&nbsp;the&nbsp;package&nbsp;hierarchy&nbsp;now</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000">&nbsp;(Class&nbsp;clazz&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;aClass;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(clazz&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">&amp;&amp;</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">clazz.equals(Object.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clazz&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;clazz.getSuperclass())&nbsp;{<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;basePackageName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;clazz.getName();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">while</SPAN><SPAN style="COLOR: #000000">&nbsp;(basePackageName.lastIndexOf(</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">)&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;basePackageName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;basePackageName.substring(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,&nbsp;basePackageName.lastIndexOf(</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;packageName&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;basePackageName&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">.package</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;getMessage(packageName,&nbsp;locale,&nbsp;aTextName,&nbsp;valueStack,&nbsp;args);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(msg&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;msg;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(indexedTextName&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;getMessage(packageName,&nbsp;locale,&nbsp;indexedTextName,&nbsp;valueStack,&nbsp;args);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(msg&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;msg;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></DIV>
<P>假设你的action继承树是这样<BR>com.bba96.core.webwork.actions.DefaultActionSupport<BR>com.xxxx.web.actions.XXXActionSupport<BR>com.xxxx.web.user.actions.UserAction<BR>com.xxxx.web.user.ViewUserAction<BR>且不说ww没有判断是否是com.opensymphony.xwork.ActionSupport或者ww的接口就停止，光是自己的继承树，就是4+3+3+3=13次，再加上往上的继承树以及对应的接口，com.opensymphony.xwork.ActionSupport以及Action, Validateable, ValidationAware, TextProvider, LocaleProvider, Serializable, ContinuableObject的接口，查找次数超过30次甚至更多，这里的每一次都有一个同步miss的过程，开销相当大。<BR><BR>如果你的key所在的resource bundle没有对应到合适的class或package时，例如说放在了default bundle中，ww会浪费很多时间。这种情况下，我在没有并发的时候测了一下，一次getText大概耗时40ms左右<BR><BR>所以在实际应用我们应该避免这种情况出现，要不让resource bundle一一对应class，要不就自己实现一个简单的getText，其实要是ww的ActionSupport的textProvider允许改变就最好了。</P><img src ="http://www.blogjava.net/scorpio_leon/aggbug/28871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2006-01-21 13:26 <a href="http://www.blogjava.net/scorpio_leon/archive/2006/01/21/28871.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Webwork2.2的一个改进，Validation/Workflow Interceptor增加excludeMethods方法</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/12/03/22374.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Sat, 03 Dec 2005 14:29:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/12/03/22374.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/22374.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/12/03/22374.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/22374.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/22374.html</trackback:ping><description><![CDATA[<P>一个例子，原来的</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">validation</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">workflow</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN></DIV><BR>可改写为<BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">validation</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #000000">param&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">excludeMethods</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">input,back,cancel</SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">param</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">workflow</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="COLOR: #000000">param&nbsp;name</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">excludeMethods</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">input,back,cancel</SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">param</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">interceptor</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">ref</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN></DIV><BR>那么，对于简单的需验证页面，不需要再因为避免不必要的校验而分两个action。<BR><BR>只有com.opensymphony.xwork.validator.ValidationInterceptor, com.opensymphony.xwork.interceptor.DefaultWorkflowInterceptor 定义并实现了这个excludeMethods，实现的也还是比较粗糙的，我们在做类似实现的时候可以参考一下，有必要也可以改进，扩展一下，例如增加includeMethods 
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;setExcludeMethods(String&nbsp;excludeMethods)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.excludeMethods&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;TextParseUtil.commaDelimitedStringToSet(excludeMethods);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;intercept(ActionInvocation&nbsp;invocation)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000">&nbsp;Exception&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(excludeMethods.contains(invocation.getProxy().getMethod()))&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log.debug(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Skipping&nbsp;workflow.&nbsp;Method&nbsp;found&nbsp;in&nbsp;exclude&nbsp;list.</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;invocation.invoke();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<IMG src="http://www.blogjava.net/images/dot.gif"><IMG src="http://www.blogjava.net/images/dot.gif"><BR>&nbsp;&nbsp;&nbsp; }</SPAN></DIV><img src ="http://www.blogjava.net/scorpio_leon/aggbug/22374.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-12-03 22:29 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/12/03/22374.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BBA96 更新至 RC1</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/11/18/20361.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Fri, 18 Nov 2005 01:37:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/11/18/20361.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/20361.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/11/18/20361.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/20361.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/20361.html</trackback:ping><description><![CDATA[<A href="https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0">https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0</A><BR>修正一处batchRemove的bug，<BR>将action的与持久化相关的方法，以及getResults方法保护起来<BR>添加了一个Book example. 包括简单用户管理，书籍的查询与租借。<BR>Book Example 参见 <A href="http://book.bba96.com">http://book.bba96.com</A><BR>Advanced Example 参见 <A href="http://www.gopherbook.com">http://www.gopherbook.com</A><BR><BR><BR><img src ="http://www.blogjava.net/scorpio_leon/aggbug/20361.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-11-18 09:37 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/11/18/20361.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>基于hibernate/spring的含RBAC权限模块的快速开发框架(目前与webwork整合) </title><link>http://www.blogjava.net/scorpio_leon/archive/2005/11/09/18878.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Tue, 08 Nov 2005 16:51:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/11/09/18878.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/18878.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/11/09/18878.html#Feedback</comments><slash:comments>40</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/18878.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/18878.html</trackback:ping><description><![CDATA[https://bba96.dev.java.net/<br />源文件下载<br />https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0<br /><br /><br />1. 核心持久层部分基于spring/hibernate，实现强大灵活的动态query功能，可独立使用。<br />2. 权限部分，基于RBAC，支持数据权限，依赖1部分的接口。<br />3. Action层，基于1以及webwork，良好架构，减少大量代码，支持view灵活进行query且有参数教验支持保证安全性。<br /><br />简单说bba96就是基于hibernate/spring的快速开发框架，其中包含了对Hibernate Critiera，Projection的封装，通过一个强大而灵活的QueryObject对象，方便动态添加与删除条件。<br />通过统一的query与数据库交互，方便AOP，其中的RBAC权限模块（支持数据权限）即是通过AOP操作QueryObject对象来实现的。bba96核心可以跟流行的view整合，目前只有webwork整合的版本。<br /><br />bba96 不再需要自己写DAO/SERVICE，借助简单的spring ioc即可配置使用缺省DAO/SERVICE，而且通过灵活方便，易扩展的后台持久层与webwork的整合，完全实现了快速开发的目的。<br /><br /><br /><p>Get Up And Running Quick</p><pre>Example:
   (1) enter the example/simple or emample/book folder.<br />       NOTE:all following operation is under the folder you entered<br />   (2) copy your JDBC driver (default mysql) to the lib directory<br />       -- webapps\ROOT\WEB-INF\lib<br />   (3) edit hibernate.properties for database info (default mysql)<br />       -- src\main\java\hibernate.properties<br />   (4) run "ant"<br />   (5) create database via the sql script generated at database\schema-export.sql<br />   (6) edit applicationContext.xml for database info (default mysql) <br />       -- webapps\ROOT\WEB-INF\applicationContext.xml (line 5 - 21)<br />   (7) start server and see this example<br /><br /><br />有使用上的讨论，请联系我 MSN: hotmail的帐号scorpio_leon</pre><img src ="http://www.blogjava.net/scorpio_leon/aggbug/18878.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-11-09 00:51 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/11/09/18878.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>开始尝试 Webwork 2.2, 一些容易出错的地方 -- 持续更新</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/10/19/15933.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Wed, 19 Oct 2005 07:36:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/10/19/15933.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/15933.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/10/19/15933.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/15933.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/15933.html</trackback:ping><description><![CDATA[<OL>
<LI>如果你用hibernate+spring，注意spring的OpenSessionInView的Filter要在webwork的Filter之前</LI>
<LI>ww:property这个tag缺省是escape html的，在tag可以指定escape="false"避免html字符转义</LI>
<LI>一些原来用单引号表示字符串的都要去掉单引号，例如 " 'test' "&nbsp; 要改为 "test"</LI>
<LI>No object in the CompoundRoot has a property named，这是由于在webwork.properties设置了webwork.devMode=true，会检查页面上传递过来的参数是否在action定义过。</LI></OL><img src ="http://www.blogjava.net/scorpio_leon/aggbug/15933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-10-19 15:36 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/10/19/15933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Webwork 2.1.7 的一个小缺陷</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/10/18/15831.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Tue, 18 Oct 2005 10:22:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/10/18/15831.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/15831.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/10/18/15831.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/15831.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/15831.html</trackback:ping><description><![CDATA[<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">interface</SPAN><SPAN style="COLOR: #000000">&nbsp;ModelDriven&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;getModel();<BR>}</SPAN></DIV><BR>而我需要的是 
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">interface</SPAN><SPAN style="COLOR: #000000">&nbsp;ModelDriven&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Object&nbsp;getModel()&nbsp;</SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000">&nbsp;Exception;<BR>}<BR></SPAN></DIV>
<P>因为要拦截可能抛出的异常，流程是这样service - my service&nbsp;interceptor - action - xwork interceptor <BR>现在断在action这里了，很奇怪，webwork其他方法都有throw exception，独独这个没有，难道又要hack webwork？<BR>恩，有了AOP后，接口设计应该要多考虑一下，是否允许抛出异常……</P><img src ="http://www.blogjava.net/scorpio_leon/aggbug/15831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-10-18 18:22 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/10/18/15831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>简单实现异步Email -- Jakarta Common Email 结合 Opensymphony Quartz</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/10/15/15603.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Sat, 15 Oct 2005 14:01:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/10/15/15603.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/15603.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/10/15/15603.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/15603.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/15603.html</trackback:ping><description><![CDATA[<P>看看下面的应用例子，程序执行三秒后会在后台开始发Email，只有几行程序，很简单吧。<BR>本来就应该这么简单，还能再省么，呵呵，谢谢开源的力量……<BR></P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;SimpleEmail&nbsp;email&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;SimpleEmail();<BR>&nbsp;&nbsp;&nbsp;&nbsp;email.addTo(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">receiver@somemail.com</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Receier's&nbsp;Name</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;email.setSubject(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Email&nbsp;from&nbsp;www.bba96.com</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;email.setMsg(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Hello,&nbsp;guy!</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;EmailScheduler&nbsp;emailScheduler&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;EmailScheduler();<BR>&nbsp;&nbsp;&nbsp;&nbsp;emailScheduler.process(email);</SPAN></DIV>
<P>这里用到了<A href="http://jakarta.apache.org/commons/email/">jakarta common email</A>中的SimpleEmail<BR>EmailScheduler是一个利用<A href="http://www.opensymphony.com/quartz/">Opensymphony Quartz</A>做简单的调度，其中EmailJob实现了Quartz的Job接口<BR>以下是EmailScheduler以及EmailJob源代码。</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">package</SPAN><SPAN style="COLOR: #000000">&nbsp;com.bba96.scheduler;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;java.util.Date;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;javax.mail.Authenticator;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.mail.Email;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.JobDetail;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.Scheduler;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.SchedulerException;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.SchedulerFactory;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.SimpleTrigger;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;EmailScheduler&nbsp;{<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;process(Email&nbsp;email,&nbsp;Authenticator&nbsp;authenticator)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000">&nbsp;SchedulerException&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;TODO&nbsp;if&nbsp;can&nbsp;be&nbsp;optimized&nbsp;with&nbsp;static&nbsp;instance.</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SchedulerFactory&nbsp;schedFact&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.impl.StdSchedulerFactory();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Scheduler&nbsp;sched&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;schedFact.getScheduler();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sched.start();<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JobDetail&nbsp;jobDetail&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;JobDetail(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">EmailJob</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;EmailJob.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jobDetail.getJobDataMap().put(EmailJob.EMAIL,&nbsp;email);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jobDetail.getJobDataMap().put(EmailJob.AUTHENTICATIOR,&nbsp;authenticator);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">Create&nbsp;a&nbsp;trigger&nbsp;that&nbsp;fires&nbsp;exactly&nbsp;once,&nbsp;three&nbsp;seconds&nbsp;from&nbsp;now</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">long</SPAN><SPAN style="COLOR: #000000">&nbsp;startTime&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;System.currentTimeMillis()&nbsp;</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">3000L</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SimpleTrigger&nbsp;trigger&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;SimpleTrigger(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">emailTrigger</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Date(startTime),&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,&nbsp;</SPAN><SPAN style="COLOR: #000000">0L</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sched.scheduleJob(jobDetail,&nbsp;trigger);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;process(Email&nbsp;email)&nbsp;</SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000">&nbsp;SchedulerException&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;process(email,&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>}</SPAN></DIV>
<P>&nbsp;</P>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">package</SPAN><SPAN style="COLOR: #000000">&nbsp;com.bba96.scheduler;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;javax.mail.Authenticator;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.logging.Log;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.logging.LogFactory;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.mail.DefaultAuthenticator;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.mail.Email;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.apache.commons.mail.EmailException;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.Job;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.JobExecutionContext;<BR></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000">&nbsp;org.quartz.JobExecutionException;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;EmailJob&nbsp;</SPAN><SPAN style="COLOR: #0000ff">implements</SPAN><SPAN style="COLOR: #000000">&nbsp;Job&nbsp;{<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">protected</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">final</SPAN><SPAN style="COLOR: #000000">&nbsp;Log&nbsp;logger&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;LogFactory.getLog(EmailJob.</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;EMAIL&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">EMAIL</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;AUTHENTICATIOR&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">AUTHENTICATIOR</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;DEFAULT_HOST&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">your&nbsp;smtp&nbsp;mail&nbsp;server</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;DEFAULT_SMTP_PORT&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">25</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;DEFAULT_USER&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">yourmail@yourserver.com</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;DEFAULT_PASSWORD&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">your&nbsp;password</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;DEFAULT_FROM_ADDRESS&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">yourmail@yourserver.com</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;String&nbsp;DEFAULT_FROM_NAME&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Your&nbsp;Name</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;execute(JobExecutionContext&nbsp;context)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000">&nbsp;JobExecutionException&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email&nbsp;email&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Email)&nbsp;context.getJobDetail().getJobDataMap().get(EMAIL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(email&nbsp;</SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Authenticator&nbsp;authenticator&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(Authenticator)&nbsp;context<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getJobDetail().getJobDataMap().get(AUTHENTICATIOR);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(email.getHostName()&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.setHostName(DEFAULT_HOST);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(email.getSmtpPort()&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.setSmtpPort(DEFAULT_SMTP_PORT);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(authenticator&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;authenticator&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;DefaultAuthenticator(DEFAULT_USER,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEFAULT_PASSWORD);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.setAuthenticator(authenticator);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(email.getFromAddress()&nbsp;</SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">null</SPAN><SPAN style="COLOR: #000000">)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">try</SPAN><SPAN style="COLOR: #000000">&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.setFrom(DEFAULT_FROM_ADDRESS,&nbsp;DEFAULT_FROM_NAME);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</SPAN><SPAN style="COLOR: #0000ff">catch</SPAN><SPAN style="COLOR: #000000">&nbsp;(EmailException&nbsp;e)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.error(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Email&nbsp;address&nbsp;invalid</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">try</SPAN><SPAN style="COLOR: #000000">&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.send();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;</SPAN><SPAN style="COLOR: #0000ff">catch</SPAN><SPAN style="COLOR: #000000">&nbsp;(EmailException&nbsp;e)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.error(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Email&nbsp;send&nbsp;error</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,&nbsp;e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>}<BR></SPAN></DIV><BR><img src ="http://www.blogjava.net/scorpio_leon/aggbug/15603.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-10-15 22:01 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/10/15/15603.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bba96项目加入到dev.java.net的java-enterprise孵化器</title><link>http://www.blogjava.net/scorpio_leon/archive/2005/09/25/13966.html</link><dc:creator>李李</dc:creator><author>李李</author><pubDate>Sat, 24 Sep 2005 17:45:00 GMT</pubDate><guid>http://www.blogjava.net/scorpio_leon/archive/2005/09/25/13966.html</guid><wfw:comment>http://www.blogjava.net/scorpio_leon/comments/13966.html</wfw:comment><comments>http://www.blogjava.net/scorpio_leon/archive/2005/09/25/13966.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/scorpio_leon/comments/commentRss/13966.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/scorpio_leon/services/trackbacks/13966.html</trackback:ping><description><![CDATA[<P>纪念一下，dev.java.net效率还可以嘛，刚把描述/例子写好，提交毕业申请，希望下周就能毕业，正式加入java-enterprise中，呵呵。困…… <A href="http://bba96.dev.java.net/"><BR><BR>http://bba96.dev.java.net</A>&nbsp;<BR>源码下载（包含一个快速开发的例子。）<BR><A href="https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0">https://bba96.dev.java.net/servlets/ProjectDocumentList?folderID=4149&amp;expandFolder=4149&amp;folderID=0</A><A href="https://bba96.dev.java.net/files/documents/4049/21237/bba96-1.0-beta2.rar"></A><BR>简单说就是基于hibernate/spring的快速开发框架，可以跟流行的mvc整合，目前只有webwork整合的版本<BR></P>
<P>Bba96 include a flexible and convenient query object by encapsulating the hibernate Criteria and Projections, that make it easy to persist and query data.</P>
<P>Bba96's query object can construct a dynamic query parameter easily without any hql or sql, and meet database's 95% access requirement, so it is not necessary to write your DAO/SERVICE, the default DAO/SERVICE is enough in most cases. You can also write your DAO/SERVICE easily by extending default DAO/SERVICE.</P>
<P>Bba96 current version integrated with webwork 2.x, that is a rapid and efficient web develope framework, only several lines code in a webwork action can implement a persistent object's CRUD operation(with dynamic parameter query).</P>
<P>Bba96 plan to integrate with other mvc framework in future</P>
<H3>Get Up And Running Quick</H3><PRE>Example:
   (1) enter the example folder.
       NOTE:all following operation is under the example folder
   (2) copy your JDBC driver (default mysql) to the lib directory
       -- webapps\ROOT\WEB-INF\lib
   (3) edit hibernate.properties for database info (default mysql)
       -- src\main\java\hibernate.properties
   (4) run "ant"
   (5) edit applicationContext.xml for database info (default mysql) 
       -- webapps\ROOT\WEB-INF\applicationContext.xml (line 5 - 21)
   (6) start server and see this example
</PRE>
<P><BR>&nbsp;</P><img src ="http://www.blogjava.net/scorpio_leon/aggbug/13966.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/scorpio_leon/" target="_blank">李李</a> 2005-09-25 01:45 <a href="http://www.blogjava.net/scorpio_leon/archive/2005/09/25/13966.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>