??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕乱码亚洲精品一区 ,日韩一区中文,亚洲欧美不卡http://www.aygfsteel.com/wolfsquare/category/5637.htmlzh-cnWed, 28 Feb 2007 17:26:52 GMTWed, 28 Feb 2007 17:26:52 GMT60回复 乱弹权限pȝl一http://www.aygfsteel.com/wolfsquare/archive/2006/07/04/56606.htmlwolfsquarewolfsquareTue, 04 Jul 2006 14:45:00 GMThttp://www.aygfsteel.com/wolfsquare/archive/2006/07/04/56606.htmlhttp://www.aygfsteel.com/wolfsquare/comments/56606.htmlhttp://www.aygfsteel.com/wolfsquare/archive/2006/07/04/56606.html#Feedback1http://www.aygfsteel.com/wolfsquare/comments/commentRss/56606.htmlhttp://www.aygfsteel.com/wolfsquare/services/trackbacks/56606.html 乱弹权限pȝl一
原文在这:http://www.aygfsteel.com/RongHao/archive/2006/07/03/56258.html

仔细分析一,??四权限背后的实质可以发现:
一pȝ权限的概忉|一些冗?很难惌q样一U情?你已l有了子pȝ下的很多权限,l果因ؓ(f)没有模块权限而得无法用该模块q行M操作,分配权限的h要非常小心才?q个世界已经够复杂了,不要再给开?部v人员增加复杂度了.很明白的,q个权限是不需要资源的权限
二数据库操作权限的概?有一点疑?不知道ؓ(f)什么要建立q样的一个概?和行U权限有什么区别呢? 从你的上下文理解来看,g是这样子?有操作X表的业务,如果用户有增加权?则可以Q意增加数?如果用户有编辑权?则可以编辑Q意数?实际上对应标准权限模型ؓ(f):不需要限定资源的操作,即不需要资源标识的权限.
三行U数据权?q个概念很直?对应标准权限模型是: 资源(行数?+操作
四列U数据权?׃不是针对某特定行数据,所以它也是无资源型权限
p?所有的权限最l可划ؓ(f)需要资源标识和不需要资源标?换句话说,所有权限可划分为控制某些集合的权限和控制单体的权限两种,在某些时?也称之ؓ(f) 功能权限和数据权?/p>


谈到把权限分l别?很自然的是如何控制权限的权限的问题?很拗?是吧?仔细x,q样很直?也没有什么后遗症,权限自递归控制和自解释,真是一个完的循环.
有爱思考的同学x??x)觉得非帔R?隑֮?当然,概念上一回事,具体实现上可以是另一回事,可以做很多的变通来辑ֈ目的.只要保持概念上的单?p以得非常多的h得以解脱了?/p>

另外Q作为架构设计者,非常非常不赞成动辄就把很底层的概忉|q高层设计中Q例如行U,数据库什么的Q,很容易把自己和别人搞胡涂?br />可以最q状态不好,要不好好blog一,8q,有句话怎么说来着Q“都素那云而已。。。?/p>

wolfsquare 2006-07-04 22:45 发表评论
]]>
不完的世界Q看CIOC工具的又一个发展方?/title><link>http://www.aygfsteel.com/wolfsquare/archive/2006/06/08/51227.html</link><dc:creator>wolfsquare</dc:creator><author>wolfsquare</author><pubDate>Wed, 07 Jun 2006 16:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/wolfsquare/archive/2006/06/08/51227.html</guid><wfw:comment>http://www.aygfsteel.com/wolfsquare/comments/51227.html</wfw:comment><comments>http://www.aygfsteel.com/wolfsquare/archive/2006/06/08/51227.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wolfsquare/comments/commentRss/51227.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wolfsquare/services/trackbacks/51227.html</trackback:ping><description><![CDATA[     摘要: 在本文章中Q作者在一个系l的构徏中深度地被各U配|逻辑所困扰Q由此发CIOC工具Q如SpringQNuts{)(j)的又一个发展方向?nbsp; <a href='http://www.aygfsteel.com/wolfsquare/archive/2006/06/08/51227.html'>阅读全文</a><img src ="http://www.aygfsteel.com/wolfsquare/aggbug/51227.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wolfsquare/" target="_blank">wolfsquare</a> 2006-06-08 00:30 <a href="http://www.aygfsteel.com/wolfsquare/archive/2006/06/08/51227.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>l合WebWork实现高复用度pȝ的探?? http://www.aygfsteel.com/wolfsquare/archive/2006/05/17/46710.htmlwolfsquarewolfsquareWed, 17 May 2006 15:40:00 GMThttp://www.aygfsteel.com/wolfsquare/archive/2006/05/17/46710.htmlhttp://www.aygfsteel.com/wolfsquare/comments/46710.htmlhttp://www.aygfsteel.com/wolfsquare/archive/2006/05/17/46710.html#Feedback0http://www.aygfsteel.com/wolfsquare/comments/commentRss/46710.htmlhttp://www.aygfsteel.com/wolfsquare/services/trackbacks/46710.html需? 某机构体pM,机构cd分ؓ(f)子公?部门,人员{?以后可能在某机构或者其子孙机构下可能会(x)再分出其他子机构cd,希望在增加新cdq程?可能的避免修改已有代码?/p>

情况Q子公司Q部分,人员{已完成所有编码(界面Q商业逻辑Q数据逻辑Q?br />变化Q需要把q个机构体系l成Z颗树(wi)状结?br />{略Q鉴于除了树(wi)l构外的其他部分代码已经完成Q那么应该首先保持这些代码不予改动。复用修改的优先U从高到低的序如下Q?br />  界面×JSPQAction?br />  商业逻辑 Service?br />  数据逻辑?br />  数据物理?br />有经验的人知道,大部分情况下Q越是下层的改动Q越是媄(jing)响越q泛Q注意不是修攚w度)(j)Q所以我们只有在无计可施的情况下Q才q行低层的修攏V?/p>

分析: 回到我们的需?从功能上看,l护一个组l机构的需求,已经늛了每一个子l构的维护需求,以部门的建立ZQ在新徏一个部门时Q同时也必须建立机构?wi)上的节点?br /> q样Q如果需要直接用原有的创徏部门的所有代码,需要在其上加上创徏l织机构所需要的父节点,以及(qing)当前节点名称信息(在这里department的增加界 面JSP是需要修改的,不过实际上我没有修改该文?而是利用DHTML来动态加入需要新增加的信?,然后提交l原创徏部门的URI QdepartmentSave.actionQ和l织机构创徏URI(orgCreate.action)Q在q里我们利用ww提供的action chain功能来完成这两个操作?br /> q里需要修改department.action的配|?拦截saveҎ(gu)使其执行完后跌原来的relistl果面转向l织l构的创建orgCreate.actionQ?br /> <action name="unitSave" class="com.wolfsquare.ibase.org.action.UnitAction" method="save">
   <result name="input">/org/unit/input.jsp</result>
   <result name="relist" type="chain">
       <param name="actionName">orgCreate</param>
                <param name="namespace">/org</param>  
            </result>
   <result name="xxx" type="redirect">/org/unit.action?start=${start}</result>
   <interceptor-ref name="validationStack"/>
  </action>
可能有同学看到这里会(x)问:(x)创徏l织节点时应该还需要关联前面创建的部门对象啊,q个操作是如何实现的Q信息是如何传递的Q?br />在这里,׃整个架构体系q没有支持这U信息传递的功能Q所以只好以一U比较”脏“的方式实现Q?br />        在department.actionc里增加了一个方法getModel()q回刚刚创徏的部门对象,然后在org.actioncM增加一个接收的Ҏ(gu)setModel(object o)q样在整action chain执行的时候,ww?x)自动将getModel后的数据填入setModel中,q样做的后果是以后增加新的机构类型的功能Ӟaction必须也照q样的语意设|getModelҎ(gu)。(如果要解册个问题,q能需要用一个特定的ContextQ然后拦截指定Service的创建方法,把创建结果放入ContextQ不q这又带来如何清除Context的问题,于是又要求助与ww的interspectorQ专门写一个拦截器来擦屁股Q够ȝ(ch)。。。)(j)

        p?我们完成了新增,修改l织机构的功能合?虽然有点拖沓,但是q是辑ֈ了复?修改原有代?而且扩展性也很好的目标。这上篇说的是两个简单业务的功能揉合问题,下篇我们来看看稍微复杂点的情?看看q能不能l箋依葫芦画瓢来完成功能合的?br />  
(未完待箋)  



wolfsquare 2006-05-17 23:40 发表评论
]]>
log4j配置要说?/title><link>http://www.aygfsteel.com/wolfsquare/archive/2006/04/20/42242.html</link><dc:creator>wolfsquare</dc:creator><author>wolfsquare</author><pubDate>Thu, 20 Apr 2006 15:21:00 GMT</pubDate><guid>http://www.aygfsteel.com/wolfsquare/archive/2006/04/20/42242.html</guid><wfw:comment>http://www.aygfsteel.com/wolfsquare/comments/42242.html</wfw:comment><comments>http://www.aygfsteel.com/wolfsquare/archive/2006/04/20/42242.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wolfsquare/comments/commentRss/42242.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wolfsquare/services/trackbacks/42242.html</trackback:ping><description><![CDATA[虽然以前一直在用log4j,但是对其配置不甚了了Q突焉因ؓ(f)需解决某些问题Q要理解log4j的配|,<br />然而用google搜了一下,却发现网上没有一个简单直观的说明Q于是只好看log4j的官方介l?l于<br />理解了log4j的配|用法,以下是我对log4j配置的一点认识,如有谬误q请不吝赐教. <p>首先我们搞清楚log4j能干什么,单来说就是提供一个记录不同别信息内容的日志工具Q?br />可以把不同别,不同包\径的信息Q以指定格式输出到多U设备(控制収ͼ文g{)(j)<br />在程序中Q可以以以下方式来?br />   Log log = org.apache.commons.logging.LogFactory.LogFactory.getLog(yourClassName.class);<br />  log.debug("debug message -------------------");<br />  log.info("info message ******************");<br />  log.warn("warn message +++++++++++++++");<br />  log.error("error msg================="); <br />  <br />本文主要讲的是如何配|log4jQ先让我们先看看一个典型的log4j配置Q ?</p><p>==========log4j.properties==================</p><p>log4j.appender.stdout=org.apache.log4j.ConsoleAppender<br />log4j.appender.stdout.layout=org.apache.log4j.PatternLayout<br />log4j.appender.stdout.layout.ConversionPattern=%d{MM-dd HH\:mm\:ss.SSS} %-5p [%F\:%L]%x %m%n</p><p>log4j.appender.fileout=org.apache.log4j.RollingFileAppender<br />log4j.appender.fileout.File=D:/workspace/log4jtest/log/application.log<br />log4j.appender.fileout.MaxFileSize=10000KB<br />log4j.appender.fileout.MaxBackupIndex=10<br />log4j.appender.fileout.layout=org.apache.log4j.PatternLayout<br />log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss.SSS}[%24F:%-3L:%-5p]%x %m%n</p><p>log4j.rootCategory=INFO, stdout, fileout<br />log4j.logger.com.wolfsquare.log2=DEBUG,stdout<br />===================================</p><p>q个文g可以划ؓ(f)三小?/p><p>===========W一块定义了一个名?stdout 的appender和layout (appender,layout的概念后面再解释Q目前先记着有这样两个名?Q?/p><p>log4j.appender.stdout=org.apache.log4j.ConsoleAppender<br />定义stdout的实际输出实现类Q从q个appender实现cd可以猜到Q这个类是负责控制台输出的?br />log4j.appender.stdout.layout=org.apache.log4j.PatternLayout<br />定义stdout的输饰器<br />log4j.appender.stdout.layout.ConversionPattern=%d{MM-dd HH\:mm\:ss.SSS} %-5p [%F\:%L]%x %m%n<br />装饰器参数配|?/p><p><br />============W二块定义了一个名?fileout 的appender和layout:<br />log4j.appender.fileout=org.apache.log4j.RollingFileAppender<br />同理可猜q个实现cL输出到文件的<br />log4j.appender.fileout.File=D:/workspace/log4jtest/log/application.log<br />log4j.appender.fileout.MaxFileSize=10000KB<br />log4j.appender.fileout.MaxBackupIndex=10<br />log4j.appender.fileout.layout=org.apache.log4j.PatternLayout<br />log4j.appender.fileout.layout.ConversionPattern=%d{MM-dd HH:mm:ss.SSS}[%24F:%-3L:%-5p]%x %m%n</p><p>============W三块定义了名字分别为rootCategory,log4j.logger.com.wolfsquare.log2的两个logger<br />log4j.rootCategory=INFO, stdout, fileout<br />log4j.logger.com.wolfsquare.log2=DEBUG,stdout</p><p>rootCategory logger是缺省的loggerQ记录所有的包的信息输出?br />W二个logger是只输出指定包com.wolfsquare.log2下的日志信息?br />那么INFO,DEBUG又是什么意思呢Q他们是信息的分U标识,通过l承实现q个实现自定义别的分?br />W三块配|两句的意思是q样的:(x)<br />rootCategory 把所有类的INFOU别以上的信息输出到stdout和fileout两个appender中,<br />logger.com.wolfsquare.log2Q把com.wolfsquare.log2包中的所有类Q包括子包)(j)DEBUGU别Q含Q以上的信息输出到stdout ?br />一个logger可以输出到很多个讑֤中(appenderQ?如果需要增加输备则用分号分隔开appender名称卛_?/p><p>输出信息的分cȝ别是DEBUG > INFO > WARN > ERROR,信息l节q到粗Q指定输出某一U别的信息时Q?br />q细的信息输出将?x)被忽?/p><p>如果一个配|中有多个loggerQ他们之间会(x)有什么关pdQ答案是Q在输出上,他们没有M关系Q都是独立运作的Q?br />不相关的Q但是在配置上,父包的配|会(x)传给子包Q如果子包没有另外定义配|的话?br />例如上面配置文g中的两个loggerQ?br />log4j.logger.com.wolfsquare<br />log4j.logger.com.wolfsquare.log2</p><p>q里认ؓ(f) log4j.logger.com.wolfsquare.log2 l承?log4j.logger.com.wolfsquareQ他们的配置声明如下Q?br />log4j.rootCategory=INFO, stdout, fileout<br />log4j.logger.com.wolfsquare.log2=,stdout<br />注意W二句没有指定输出?那么Ҏ(gu)配置l承规则?x)承父logger的配|,在这里就是INFO?/p><p>同时需要强调的是,如果两个logger有承关p,且输出到同一个appenderQ根据输出独立原则,那么会(x)出现两行一L(fng)信息Q?br />例如上面的两个logger定义?x)导致这L(fng)情况?br />最后以一q图来概括:(x)<br /><img src="http://java.mblogger.cn/upimgs/java.mblogger.cn/wolfsquare/2006-4/2006_420273.gif" /></p><img src ="http://www.aygfsteel.com/wolfsquare/aggbug/42242.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wolfsquare/" target="_blank">wolfsquare</a> 2006-04-20 23:21 <a href="http://www.aygfsteel.com/wolfsquare/archive/2006/04/20/42242.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring+Hibernate+Websphere5.0l验一?/title><link>http://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29749.html</link><dc:creator>wolfsquare</dc:creator><author>wolfsquare</author><pubDate>Tue, 07 Feb 2006 00:50:00 GMT</pubDate><guid>http://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29749.html</guid><wfw:comment>http://www.aygfsteel.com/wolfsquare/comments/29749.html</wfw:comment><comments>http://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29749.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wolfsquare/comments/commentRss/29749.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wolfsquare/services/trackbacks/29749.html</trackback:ping><description><![CDATA[<P>环境Spring1.1.3,Hibernate 2.1.8Q?Websphere5.01</P> <P>hbm文g采用通配W获取:(x)</P> <P><BEAN class=com.wolfsquare.core.hibernate.DefaultSessionFactoryBean id=sessionFactory><BR>  <property name="dataSource"><REF bean="dataSource" /></property><BR>  <property name="mappingLocations"><BR>   <VALUE>classpath:/**/*.hbm.xml</VALUE><BR>  </property><BR>  <property name="hibernateProperties"><REF bean="hibernateProperties" /></property><BR> </BEAN></P> <P>问题症状Q?/P> <P>应用启动报错说不能重复定义某c,L该类后仍然报下一个类重复定义?/P> <P>仔细查看Log输出发现Q所有的hbm文g均找C两䆾 -_-!!!</P> <P>目l认为应该是websphere不太厚道Q在classpath中用了多处目录(web-inf & classes)Qƈ以这些目录ؓ(f)根进行递归搜烦(ch)匚w文gQ可是如果这些目录有包含关系QW(xu)ebSphere没有处理重复查扄文g了?/P> <P>于是在以上配|中改ؓ(f)Q?/P> <P><BEAN class=com.wolfsquare.core.hibernate.DefaultSessionFactoryBean id=sessionFactory><BR>  <property name="dataSource"><REF bean="dataSource" /></property><BR>  <property name="mappingLocations"><BR>   <VALUE>classpath:/classes/**/*.hbm.xml</VALUE><BR>  </property><BR>  <property name="hibernateProperties"><REF bean="hibernateProperties" /></property><BR> </BEAN></P> <P>问题虽然解决了,可是tomcat中却又无效了?Q(</P> <P>什么时候,企业应用才能一ơ拷贝,到处q行啊~?/P><img src ="http://www.aygfsteel.com/wolfsquare/aggbug/29749.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wolfsquare/" target="_blank">wolfsquare</a> 2006-02-07 08:50 <a href="http://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29749.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>修改Tds驱动Url声明解决两个Sql Server问题http://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29748.htmlwolfsquarewolfsquareTue, 07 Feb 2006 00:49:00 GMThttp://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29748.htmlhttp://www.aygfsteel.com/wolfsquare/comments/29748.htmlhttp://www.aygfsteel.com/wolfsquare/archive/2006/02/07/29748.html#Feedback0http://www.aygfsteel.com/wolfsquare/comments/commentRss/29748.htmlhttp://www.aygfsteel.com/wolfsquare/services/trackbacks/29748.html问题1QJDBC Sql Server varchar的取出最大长度限?/P>

环境Q?JDBC驱动inet tds驱动(版本不明),SQLServer2K

问题症状Q对于数据库声明为varchar的长度大?56的字D,可以正常保存Q但是无法取出多?56字符以后的内?/P>

问题2Q用Hibernate映射?长度字符串保存后Q取出多加了一个空?/P>

环境Qinet tds驱动Hibernate2.1.8,SQL Server2K

问题症状Q保?长度字符串后Q取出增加了多余的空根{?/P>

以上两个问题都是因ؓ(f)没有使用最新的通讯协议引v的,修改URL声明方式如下Q?/P>

jdbc:inetdae7:127.0.0.1:1433?database=xxx

问题解决Q收工?/P>

ps:发现协议inetdaeӞ数据库字Dؓ(f)NullӞHibernate取出声明为基本类型(例如booleanQ的对象属性ƈ不会(x)报错Q实际上在其他数据库如Oracle和新协议上是?x)报错的。ؓ(f)了避免此c问题出玎ͼ最好还是严格遵守:(x)Hibernate声明对象的基本类型属性,一定不能在数据库端|ؓ(f)I倹{?/P>

ps2:在解决以上问题中发现,Oracle居然对传?长度字符Ԍ?x){为空?不知道是Z节省I间q是别的什么理由?_-!!!

Q?STRONG>全文?/FONT>Q?/P>

wolfsquare 2006-02-07 08:49 发表评论
]]>
Java高精度打?/title><link>http://www.aygfsteel.com/wolfsquare/archive/2006/02/06/29732.html</link><dc:creator>wolfsquare</dc:creator><author>wolfsquare</author><pubDate>Mon, 06 Feb 2006 13:44:00 GMT</pubDate><guid>http://www.aygfsteel.com/wolfsquare/archive/2006/02/06/29732.html</guid><wfw:comment>http://www.aygfsteel.com/wolfsquare/comments/29732.html</wfw:comment><comments>http://www.aygfsteel.com/wolfsquare/archive/2006/02/06/29732.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wolfsquare/comments/commentRss/29732.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wolfsquare/services/trackbacks/29732.html</trackback:ping><description><![CDATA[<P>    在Java环境?可以使用 java.awt.Toolkit.getScreenResolution()可以得到屏幕每英寸的象素?但是好像没有什么方法能知道某一台打印机的分辨率,更别提去控制打印_度了。于是可ȝ使用着丑陋的缺省打印精度几q后Q终于找C解决Ҏ(gu)Q不知道该高兴还是?zhn)伤,其原理说出来也是非常的简单:(x) <BR>    提高打印_ֺQ其实就是把本来是A3U的内容往A4UR画,也就是说Q打印区域(q里对应着Java里的Graphics对象Q需要羃?yu),然后׃~省情况下打印是?2DPI来打的,不做改变的话Q打印内容也?x)跟着变小。这样就不是我们惌的效果了Q所以还得把打印内容成比例放大。一个羃?yu),一个放大,于是d后,在指定大的U张内,便容U了比以往更多象素的内容,q下世界ȝ完美了?/P> <P>    以上做法形象的说应该是这P(x)<STRONG>把需要生的囑Ş对象先放大,d一张“纸上”,然后整体~小</STRONG>Q这L(fng)度就提高了?/P> <P>    tips 1Q在一般企业报表表格打CQ?44DPI得到的表格线的宽度看h最舒服?BR>    tips 2Q现在号U?00DPI的打印机其实?76DPIQ如果想使用q个分L率的_ֺQ需要用好一点的U张Q因为已l到极限了,U张E差点,打印墨粉沾不上Q导致线体残~?/P> <P>附源码(修改分L率就改动变量iResMul好Q:(x)</P> <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"><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.awt.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">import</SPAN><SPAN style="COLOR: #000000"> java.awt.print.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_97_2979_Open_Image onclick="this.style.display='none'; Codehighlighter1_97_2979_Open_Text.style.display='none'; Codehighlighter1_97_2979_Closed_Image.style.display='inline'; Codehighlighter1_97_2979_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_97_2979_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_97_2979_Closed_Text.style.display='none'; Codehighlighter1_97_2979_Open_Image.style.display='inline'; Codehighlighter1_97_2979_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> MyPrintableObject </SPAN><SPAN style="COLOR: #0000ff">implements</SPAN><SPAN style="COLOR: #000000"> Printable </SPAN><SPAN id=Codehighlighter1_97_2979_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_97_2979_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iResMul </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 1 = 72 dpi; 4 = 288 dpi<IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> print(Graphics g, PageFormat pf, </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iPage)<BR><IMG id=Codehighlighter1_238_2608_Open_Image onclick="this.style.display='none'; Codehighlighter1_238_2608_Open_Text.style.display='none'; Codehighlighter1_238_2608_Closed_Image.style.display='inline'; Codehighlighter1_238_2608_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_238_2608_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_238_2608_Closed_Text.style.display='none'; Codehighlighter1_238_2608_Open_Image.style.display='inline'; Codehighlighter1_238_2608_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">throws</SPAN><SPAN style="COLOR: #000000"> PrinterException </SPAN><SPAN id=Codehighlighter1_238_2608_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_238_2608_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">final</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> FONTSIZE </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">12</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">final</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000"> PNT_MM </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">25.4</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">72</SPAN><SPAN style="COLOR: #000000">.;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000"> iPage)<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> NO_SUCH_PAGE;<BR><IMG id=Codehighlighter1_351_2508_Open_Image onclick="this.style.display='none'; Codehighlighter1_351_2508_Open_Text.style.display='none'; Codehighlighter1_351_2508_Closed_Image.style.display='inline'; Codehighlighter1_351_2508_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_351_2508_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_351_2508_Closed_Text.style.display='none'; Codehighlighter1_351_2508_Open_Image.style.display='inline'; Codehighlighter1_351_2508_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">try</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_351_2508_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_351_2508_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iPosX </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iPosY </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iAddY </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> FONTSIZE </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iWdth </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">) Math.round(pf.getImageableWidth() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul) </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iHght </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">) Math.round(pf.getImageableHeight() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul) </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> iCrcl </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> Math.min(iWdth, iHght) </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   Graphics2D g2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (Graphics2D) g;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   PrinterJob prjob </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> ((PrinterGraphics) g2).getPrinterJob();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.translate(pf.getImageableX(), pf.getImageableY());<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.scale(</SPAN><SPAN style="COLOR: #000000">1.0</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> iResMul, </SPAN><SPAN style="COLOR: #000000">1.0</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> iResMul);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.setFont(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Font(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">SansSerif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, Font.PLAIN, FONTSIZE </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul));<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.setColor(Color.black);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawRect(iPosX, iPosY, iWdth, iHght);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawLine(iPosX, iHght </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> iWdth </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">50</SPAN><SPAN style="COLOR: #000000">, iPosX </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> iWdth, iHght </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> iWdth </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">50</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawLine(iPosX, iHght </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> iWdth </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">50</SPAN><SPAN style="COLOR: #000000">, iPosX </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> iWdth, iHght </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> iWdth </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">50</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawOval(iPosX </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul, iHght </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> iCrcl </SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iCrcl, iCrcl);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   iPosX </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">PrinterJob-UserName: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> prjob.getUserName(), iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Betriebssystem: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> System.getProperty(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">os.name</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> System.getProperty(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">os.version</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">), iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     .drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Java-Version: JDK </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>       </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> System.getProperty(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">java.version</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">), iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>       iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Width/Height: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getWidth()) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getHeight()) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> points = </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getWidth() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getHeight() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> mm</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Imageable Width/Height: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableWidth()) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableHeight()) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> points = </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableWidth() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableHeight() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> mm</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Imageable X/Y: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableX())<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableY()) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> points = </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableX() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> / </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> dbldgt(pf.getImageableY() </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> PNT_MM) </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> mm</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, iPosX,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   g2.drawString(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">versuchte Druckaufl sung: </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">72</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> iResMul </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> dpi</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>     iPosX, iPosY </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> iAddY);<BR><IMG id=Codehighlighter1_2531_2583_Open_Image onclick="this.style.display='none'; Codehighlighter1_2531_2583_Open_Text.style.display='none'; Codehighlighter1_2531_2583_Closed_Image.style.display='inline'; Codehighlighter1_2531_2583_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2531_2583_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2531_2583_Closed_Text.style.display='none'; Codehighlighter1_2531_2583_Open_Image.style.display='inline'; Codehighlighter1_2531_2583_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">catch</SPAN><SPAN style="COLOR: #000000"> (Exception ex) </SPAN><SPAN id=Codehighlighter1_2531_2583_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2531_2583_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">throw</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> PrinterException(ex.getMessage());<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> PAGE_EXISTS;<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_2651_2720_Open_Image onclick="this.style.display='none'; Codehighlighter1_2651_2720_Open_Text.style.display='none'; Codehighlighter1_2651_2720_Closed_Image.style.display='inline'; Codehighlighter1_2651_2720_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2651_2720_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2651_2720_Closed_Text.style.display='none'; Codehighlighter1_2651_2720_Open_Image.style.display='inline'; Codehighlighter1_2651_2720_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000"> dbldgt(</SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000"> d) </SPAN><SPAN id=Codehighlighter1_2651_2720_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2651_2720_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> Math.round(d </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">.) </SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">10</SPAN><SPAN style="COLOR: #000000">.; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> show one digit after point</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top></SPAN><SPAN style="COLOR: #000000"> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top><BR><IMG id=Codehighlighter1_2763_2977_Open_Image onclick="this.style.display='none'; Codehighlighter1_2763_2977_Open_Text.style.display='none'; Codehighlighter1_2763_2977_Closed_Image.style.display='inline'; Codehighlighter1_2763_2977_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2763_2977_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2763_2977_Closed_Text.style.display='none'; Codehighlighter1_2763_2977_Open_Image.style.display='inline'; Codehighlighter1_2763_2977_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> main(String[] args) </SPAN><SPAN id=Codehighlighter1_2763_2977_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2763_2977_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  PrinterJob pj </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> PrinterJob.getPrinterJob();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>  pj.setPrintable(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> MyPrintableObject());<BR><IMG id=Codehighlighter1_2879_2974_Open_Image onclick="this.style.display='none'; Codehighlighter1_2879_2974_Open_Text.style.display='none'; Codehighlighter1_2879_2974_Closed_Image.style.display='inline'; Codehighlighter1_2879_2974_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2879_2974_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2879_2974_Closed_Text.style.display='none'; Codehighlighter1_2879_2974_Open_Image.style.display='inline'; Codehighlighter1_2879_2974_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (pj.printDialog()) </SPAN><SPAN id=Codehighlighter1_2879_2974_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2879_2974_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG id=Codehighlighter1_2888_2909_Open_Image onclick="this.style.display='none'; Codehighlighter1_2888_2909_Open_Text.style.display='none'; Codehighlighter1_2888_2909_Closed_Image.style.display='inline'; Codehighlighter1_2888_2909_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2888_2909_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2888_2909_Closed_Text.style.display='none'; Codehighlighter1_2888_2909_Open_Image.style.display='inline'; Codehighlighter1_2888_2909_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>   </SPAN><SPAN style="COLOR: #0000ff">try</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN id=Codehighlighter1_2888_2909_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2888_2909_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    pj.print();<BR><IMG id=Codehighlighter1_2938_2970_Open_Image onclick="this.style.display='none'; Codehighlighter1_2938_2970_Open_Text.style.display='none'; Codehighlighter1_2938_2970_Closed_Image.style.display='inline'; Codehighlighter1_2938_2970_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_2938_2970_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2938_2970_Closed_Text.style.display='none'; Codehighlighter1_2938_2970_Open_Image.style.display='inline'; Codehighlighter1_2938_2970_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align=top>   }</SPAN></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">catch</SPAN><SPAN style="COLOR: #000000"> (PrinterException e) </SPAN><SPAN id=Codehighlighter1_2938_2970_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_2938_2970_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>    System.out.println(e);<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></SPAN></DIV> <P><BR>Q?STRONG><FONT color=#0000ff>全文?/FONT></STRONG>Q?nbsp;   </P><img src ="http://www.aygfsteel.com/wolfsquare/aggbug/29732.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wolfsquare/" target="_blank">wolfsquare</a> 2006-02-06 21:44 <a href="http://www.aygfsteel.com/wolfsquare/archive/2006/02/06/29732.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Z拦截器的企业应用构?/title><link>http://www.aygfsteel.com/wolfsquare/archive/2005/12/06/22772.html</link><dc:creator>wolfsquare</dc:creator><author>wolfsquare</author><pubDate>Tue, 06 Dec 2005 12:49:00 GMT</pubDate><guid>http://www.aygfsteel.com/wolfsquare/archive/2005/12/06/22772.html</guid><wfw:comment>http://www.aygfsteel.com/wolfsquare/comments/22772.html</wfw:comment><comments>http://www.aygfsteel.com/wolfsquare/archive/2005/12/06/22772.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wolfsquare/comments/commentRss/22772.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wolfsquare/services/trackbacks/22772.html</trackback:ping><description><![CDATA[<P>    ?A HREF="/wolfsquare/archive/2005/12/05/22630.html">上一文?/A>里,我们使用了基于事件传递的机制来对企业应用的子pȝq行解耦,但是׃需要强制地l承或者实C个广播事件的接口EventBrocastQ实际上Q就职责分离和功能单一的角度来看,前篇文章中的例子中,q个机制对OrderService侵入太大了,我们必须L更ؓ(f)有效的方法,不需要程序实现某个接口或l承某个类来完成这个工作,q一切必d具体E序完全透明Q这个责任谁能承担呢Q毫无疑问,历史的重担就落在了AOPw上 Q)(j) 。下面我们来看看具体的实玎ͼ(x)<BR>    OrderService已经实现Q除了订单的处理Q没有Q何的职责Qؓ(f)了完成事件的q播Q必要有一个途径能够拦截到OrderService的所有方法调用,然后分析调用的语义(参数Q,q根据这些内容给q播出去。而恰好,AOPl织l一的接口MethodInterceptor可以完成q个功能。于是上文章的E序可以q样修改Q?/P> <P>   // 订单服务只负责做好自q?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"> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> OrderService {<BR>     </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> Order saveOrder(Order order){<BR>     。。。。处理订?BR>     。。。保?BR>     }<BR>  }</SPAN></DIV> <P> </P> <P>  而ؓ(f)了拦截Q何的Ҏ(gu)调用Q则实现了拦截器EventBrocasterQ?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: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> EventBrocaster </SPAN><SPAN style="COLOR: #0000ff">extends</SPAN><SPAN style="COLOR: #000000"> LifeEventBrocast </SPAN><SPAN style="COLOR: #0000ff">implements</SPAN><SPAN style="COLOR: #000000"> MethodInterceptor  {<BR>    </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> List eventListeners;<BR>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> setEventListener(List list){<BR>     </SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.eventListeners</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">list;<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> List geteEventListeners(){<BR>     </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> eventListeners;<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> Object invoke(MethodInvocation invoke) {<BR>      obj </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> invoke.proceed();</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 执行被拦截的Ҏ(gu)完成业务操作</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">      Object[] params </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> invoke.getArguments();<BR>     Object param </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> params.length </SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000"> params : params[</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">];<BR>     Event le </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Event(param, eventType);<BR>     brocast(le);</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> q播</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    }<BR>  }</SPAN></DIV> <P> </P> <P>  事g侦听器:(x)<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"> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> OrderEventListener </SPAN><SPAN style="COLOR: #0000ff">implements</SPAN><SPAN style="COLOR: #000000"> EventListener{<BR>  </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> FinancialService  financialService;<BR>   </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> setFinancialService(FinancialService fs){<BR>     </SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">.financialService</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">fs;<BR>   }<BR>  </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> performed(Event e){<BR>   Order order </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">(Order) e.getObject();<BR>    financialService.createRequestOfMoney(order.getAmount()<IMG src="http://www.aygfsteel.com/images/dot.gif">);<BR>  }<BR> }</SPAN></DIV> <P> </P> <P><BR>  然后Q在Spring配置里将q些lg全部q接hQ?/P> <P> 1.OrderService实现:<BR> <bean id="orderServiceImpl" class="OrderService" autowire="byName"><BR> </bean></P> <P> 2. 声明OrderService代理:</P> <P> <bean id="orderService" class="org.springframework.aop.framework.ProxyFactoryBean"><BR>  <property name="target"><BR>   <ref local="orderServiceImpl"/><BR>  </property><BR>  <property name="interceptorNames"> <!--拦截器列?-><BR>   <list><BR>    <value>eventBrocaster</value><BR>   </list><BR>  </property><BR>  <property name="singleton"><BR>   <value>true</value><BR>  </property><BR> </bean><BR>  3.事gq播拦截?BR> <bean id="eventBrocaster" class="com.wolfsquare.core.service.EventBrocaster" singleton="true"><BR>  <property name="lifecycleListeners"><BR>      <list><BR>       <ref bean="orderEventListener"/><BR>      </list><BR>     </property><BR> </bean><BR>  4.具体的胦(ch)务子pȝ的侦听器实现与胦(ch)务系l的通讯Q?BR>  <bean id="orderEventListener" class="OrderEventListener" autowire="byName"><BR>   <propety name="financialService"><ref bean="financialService"/></property><BR> </bean></P> <P>    q样Q我们与具体实现无关的事件广播就做到了,聪明的朋友看到这里,肯定惛_了拦截器方式不仅仅适用与事件广播,q可以实C务的l一理Q事实上Spring的事务管理就是这样完成的Q还可以实现权限的控制例如AcegiQ简直有点象万能的胶_(d)呵呵?/P> <P>    从两文章的逐步探讨下,同一个机器,同一个虚拟机之内的数据通讯都可以实CQ那么异构系l和多虚拟机间的通讯又如何处理呢Q于是ESBQ企业服务ȝQ的概念慢慢Q现出来了Q不q这个不在本文探讨的范畴了,也许在不久的来Q我?x)补上这一?/P> <P><FONT color=#0000ff><STRONG>Q全文完Q?/STRONG></FONT></P> <P> </P> <P> </P><img src ="http://www.aygfsteel.com/wolfsquare/aggbug/22772.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wolfsquare/" target="_blank">wolfsquare</a> 2005-12-06 20:49 <a href="http://www.aygfsteel.com/wolfsquare/archive/2005/12/06/22772.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Z事g分发机制的企业应用开?http://www.aygfsteel.com/wolfsquare/archive/2005/12/05/22630.htmlwolfsquarewolfsquareMon, 05 Dec 2005 12:31:00 GMThttp://www.aygfsteel.com/wolfsquare/archive/2005/12/05/22630.htmlhttp://www.aygfsteel.com/wolfsquare/comments/22630.htmlhttp://www.aygfsteel.com/wolfsquare/archive/2005/12/05/22630.html#Feedback3http://www.aygfsteel.com/wolfsquare/comments/commentRss/22630.htmlhttp://www.aygfsteel.com/wolfsquare/services/trackbacks/22630.html    做过DOS~程的h都知道,Dos~程和W(xu)indow~程最大不同之一是事g机制的编E,普遍的,目前事g机制的用已l在Windows下的应用E序中遍地开׃Q可是基于事件传播的应用仅仅限于window应用E序吗?{案是:(x)不?BR>    在IOC概念的不断冲MQ我们需要回头去审视前两q自己开发的Q心中ؓ(f)之骄(jing)傲的Q认为非怼U的程序,在这q程中,我们׃(x)看到q些?jing)傲在最新的概念冲击下烟消云散了。变成了丑陋的,紧耦合的反面范例。让我们来看看以下场景:(x)

 某公司有Z某^台的两子pȝQ订购系lA和胦(ch)务系lB。当采购员在预采购某物品前,先在定购pȝA中登记需要购买的货物和h(hun)|然后财务pȝB开始该W购物款的甌程?BR> 首先让我们来看看两年前的代码是怎么实现的:(x)

 

public class OrderService {
   
private FinancialService  financialService=new FinancialServiceImpl();
     
public Order saveOrder(Order order){
  。。。。处理订?BR>                financialService.createRequestOfMoney(order.getAmount());
   }

 }


从上面的代码中可以很明显看到Q定购系lA和胦(ch)务子pȝ发生了耦合Q也许有同志_(d)那我采用Spring{IOC框架来解耦:(x)
 

public class OrderService {
   
private FinancialService  financialService;
   
public void setFinancialService(FinancialService fs){
     
this.financialService=fs;
   }

     
public Order saveOrder(Order order){
  。。。。处理订?BR>                financialService.createRequestOfMoney(order.getAmount());
   }

 }


财务子系lB的实现FinancialServiceImpl是通过Spring{IOC框架讄q去的。这样不是很完美了吗Q?/P>

但是我仍然要_(d)q个只是五十步笑百步|了。再L(fng)以下场景Q该公司的业务规则v了变化,金额于1万元的定购不需要通过财务甌程。这栯(ch)务子pȝB升到B2了,多了一个直接拨ƄAPI payMoney()。这时候,定购pȝ该怎么办?除了修改代码没有别的办法。这个时候,Z事g分发处理的机制就大派用场了?BR>  修改原来的订单系l实C单消息的q播?BR> 

public class OrderService extend EventBrocast{
   
private FinancialService  financialService=new FinancialServiceImpl();
     
public Order saveOrder(Order order){
  。。。。处理订?BR>                brocastEvent(
new Event(order)); // ***
   }

 }

 

 实现一个消息监听器Q?BR>

public OrderEventListener implements EventListener{
  
public void performed(Event e){
   Order order 
=(Order) e.getObject();
    financialService.createRequestOfMoney(order.getAmount());
  }

 }

 

 在配|中讄Q这里我们用的是SpringQ?BR> <bean id="orderService" ...>
  <property name="eventListener">
   <list>
    <ref local="orderListener"/>
   </list>
  </property>
 </bean>
 <bean id="orderListener" ...>

 q样我们实C订单pȝ和胦(ch)务系l的解?如果财务pȝ发生的修改,我们只需实现新的监听器就可以了:(x)

 

public  NewOrderEventListener implements EventListener{
    
private FinancialService  financialService;
    
public void setFinancialService(FinancialService fs){
     
this.financialService=fs;
   }


  
public void performed(Event e){
   Order order 
=(Order) e.getObject();
    financialService.payMoney(order.getAmount());
  }

 }

 

 下一文?我将引入AOP的概忉|系l提高到更高的抽象层ơ?BR> Q全文完Q?/FONT>



wolfsquare 2005-12-05 20:31 发表评论
]]>
վ֩ģ壺 ƽ| Ϫ| | | | | | | ǿ| | ʷ| | Ͽ| | | | ɽ| ַ| ±| | | ȫ| ½| º| | | ־| | | ӯ| | | | | | | ߺ| | ޵| ¤| ͡|