当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Its often very difficult to appl
 

 

    摘要:in this article, we will show how to provide single sign-on functionality in apaches pluto portlet container. pluto is the reference implementation of the java portlet specification (jsr 168). pluto......
    摘要:code generation is a key new trend in engineering, one that you need to understand well. the reason is simple: todays modern frameworks are extremely code-intensive. using a code generator to build th......


Using PatchExpert to Extend Your Code More Easily

its often very difficult to apply extensions or patches to an existing application. consider the steps required. first, a software developer has to modify some source code. then a platform engineer rebuilds and repackages the system, creating a detailed installation guideline. finally, a deployment engineer redeploys the software at customer site. hopefully, it all works. is there any method to make these tasks simpler?

problem 【程序编程相关:Using the Strategy D

java.net">patchexpert is a simple tool to satisfy this requirement. it can insert software extensions or patches through some predefined extension points. 【推荐阅读:Java Tech: Acquire I

testmain is a simple application used to print out an onscreen triangle of asterisk ("*") characters. it has a calculator class to calculate the level of triangle according to the given integer and asks triangleprint to print out the triangle. 【扩展信息:Principles, Patterns

lets look at an example first to see how difficult it is to apply a patch to an existing application.

heres the source code for a basic implementation. calculator uses the singleton pattern, and is used to figure out how many asterisks to print out. this implementation simply doubles the given argument.

public class calculator { static calculator instance = new calculator(); public static calculator getinstance() { return instance; } protected calculator() { } public int calc(int num) { return num * 2; } }

triangleprint prints out the triangle line by line, according to the given level.

public class triangleprint { int level; public triangleprint(int level) { this.level = level; } public void print() { for (int i = 1; i <= level; i++) system.out.println(getline(i)); } protected string getline(int num) { stringbuffer sb = new stringbuffer(); for(int i = 1; i <= num; i++) sb.append("*"); return sb.tostring(); } public int getlevel() { return level; } }

finally, testmain exercises the code by getting a calculator instance, calling calc(), and sending the result on to triangleprint.


...   下一页
 ·introduction to sitemesh    »显示摘要«
    摘要: does the page specifically request a decorator using a meta decorator tag? is the page a frame set (if so, dont apply a decorator)? does the page have a printable=true parameter> (if so, use th......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE