ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>阿v视频在线观看,视频在线观看你懂的,亚洲网友自拍http://www.aygfsteel.com/kuuyee/category/49118.htmlwhile (产品+需æ±?设计+å¼€å?‹¹‹è¯•+部çÖv+发布 == doing) { CI }zh-cnFri, 14 Jun 2013 10:48:06 GMTFri, 14 Jun 2013 10:48:06 GMT60当EffectiveJava遇见Guava - 使类和成员的可访问性最ž®åŒ–(规则13)http://www.aygfsteel.com/kuuyee/archive/2013/06/14/400560.htmlkuuyeekuuyeeFri, 14 Jun 2013 09:09:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2013/06/14/400560.htmlhttp://www.aygfsteel.com/kuuyee/comments/400560.htmlhttp://www.aygfsteel.com/kuuyee/archive/2013/06/14/400560.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/400560.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/400560.html

软äšg设计的基本原则之一åQŒå°±æ˜¯ç³»¾lŸè¦æ¨¡å—化,模块之间只通过他们的API˜q›è¡Œé€šä¿¡åQŒä¸€ä¸ªæ¨¡å—不需要知道其他模块的内部工作情况åQŒè¿™ä¸ªæ¦‚å¿ëЧ°ä½œä¿¡æ¯éšè—?information hiding)或封è£?encapsulation)ã€?/span>

需要遵守的原则
  • ž®½å¯èƒ½åœ°ä½¿æ¯ä¸ªç±»æˆ–成员不被外界访问ã€?/strong>换句话说åQŒåº”该ä‹É用与你正在编写的软äšg的对应功能相一致、尽可能最ž®çš„讉K—®¾U§åˆ«ã€?/p>

  • 对于™å¶å±‚çš?非嵌套的)¾cÕd’ŒæŽ¥å£åQŒåªæœ‰ä¸¤¿Uå¯èƒ½éžè®‰K—®¾U§åˆ«åQŒè¦ä»Žæ˜¯åŒ…çñ”¿Uæœ‰çš„也ž®±æ˜¯defaultåQŒè¦ä¹ˆæ˜¯publicçš?包çñ”¿Uæœ‰ž®±æ„å‘³ç€å®ƒæ˜¯˜q™ä¸ªåŒ?strong>实现的一部分åQŒä¸ä¼šä½œä¸ø™¯¥åŒ…API被导出,˜q™æ ·åœ¨ä»¥åŽçš„发型版本中,对它修改、替换、删除就不用担心会媄响先有客æˆïL«¯çš„程序ã€?/p>

  • 如果一个包¾U§ç§æœ‰çš„™å¶å±‚¾c?或者接å?只是在某一个类内部被用刎ͼŒž®±åº”该考虑把它变成唯一使用它的那个¾cȝš„¿Uæœ‰åµŒå¥—¾c…R€?/p>

  • 降低不必要公有类的可讉K—®æ€§ï¼Œæ¯”降低包¾U§ç§æœ‰çš„™å¶å±‚¾cÀL›´é‡è¦çš„多åQŒå› ä¸ºå…±æœ‰ç±»æ˜¯API的一部分åQŒè€ŒåŒ…¾U§ç§æœ‰çš„™å¶å±‚¾cÕd·²¾læ˜¯åŒ…实现的一部分了ã€?/p>

  • 受保æŠ?protected)的类或成员是导出API的一部分åQŒå¿…™åÀL°¸˜qœå¾—到支持,应该避免ž®½é‡ž®‘用ã€?/p>

  • 如果子类覆盖了超¾cȝš„一个方法,子类中的讉K—®¾U§åˆ«ž®×ƒ¸å…è®¸ä½ŽäºŽ­‘…类中的讉K—®¾U§åˆ«åQŒå¦åˆ™ä¼š¾~–译错误。实çŽîCº†æŽ¥å£çš„æ‰€æœ‰æ–¹æ³•也必须是共有的åQŒå› ä¸ºæŽ¥å£ä¸­çš„æ‰€æœ‰æ–¹æ³•都是隐含着共有讉K—®¾U§åˆ«ã€?/p>

  • ä¸ÞZº†ä¾¿äºŽ‹¹‹è¯•åQŒä¸åº”该把其讉K—®¾U§åˆ«æˆäØ“å…±æœ‰çš„ï¼Œå–è€Œä»£ä¹‹æ˜¯æŠŠæµ‹è¯•ç±»æˆäØ“åŒ…çš„ä¸€éƒ¨åˆ†åQŒä»Žè€Œèƒ½å¤Ÿè®¿é—®å®ƒçš„包¾U§ç§æœ‰å…ƒç´ ã€?/p>

  • 实例域决不能是共有的åQŒåŒ…含公有可变域的类即便是final的也不是¾U¿ç¨‹å®‰å…¨çš?/strong>åQ?/p>

Note
长度非零的数¾l„æ€ÀL•°å¯å˜çš„,所以,¾cÕd…·æœ‰å…¬æœ‰çš„静态final数组域,或者返回这¿UåŸŸçš„访问方法,˜q™å‡ ä¹Žæ€ÀL•°é”™è¯¯çš„ã€?br />

public class UnmodifiableArray {
// 潜在安全漏洞
public static final String[] VALUES = { "RED", "GREEN" };

public static void main(String[] args) {
UnmodifiableArray UF = new UnmodifiableArray();
UF.VALUES[1] = "YELLO";//讄¡½®final数组成员
System.out.println(UF);
}
//使用Guava
@Override
public String toString() {
return Objects.toStringHelper(this).add("VALUES0", UnmodifiableArray.VALUES[0])
.add("VALUES1", UnmodifiableArray.VALUES[1]).toString();
}
}

上面的例子里åQŒæˆ‘们成功更改了一个不可变数组åQŒæŠŠæˆå‘˜GREEN修改ä¸?tt>YELLOåQŒæ‰§è¡Œè¾“出如下:

UnmodifiableArray{VALUES0=RED, VALUES1=YELLO}

我们可以通过增加一个不可变集合列表来解册™¿™ä¸ªå®‰å…¨é—®é¢˜ï¼Œòq¶æŠŠåŽŸæ¥public讉K—®¾U§åˆ«æ”¹äØ“private的:

public class UnmodifiableArrayList {
// 消除安全漏洞
private static final String[] PRIVATE_VALUES = { "RED", "GREEN" };
public static final List<String> PVALUES = Collections.unmodifiableList(Arrays.asList(PRIVATE_VALUES));
public static void main(String[] args) {
UnmodifiableArrayList UF = new UnmodifiableArrayList();
UF.PVALUES.add(1, "YELLO"); //会抛出UnsupportedOperationException异常
System.out.println(UF);
}
//使用Guava
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("PVALUES0", UnmodifiableArrayList.PVALUES.get(0))
.add("PVALUES1", UnmodifiableArrayList.PVALUES.get(1))
.toString();
}
}

构徏一个不可变集合åQŒGuava¾l™å‡ºäº†æ›´½Ž€‹zçš„办法åQ?/p>

ImmutableList mmutableList = ImmutableList.of(PRIVATE_VALUES);

2013-06-14


]]>
Java四大名著下蝲大全åQˆä¸­æ–?英文åQ?/title><link>http://www.aygfsteel.com/kuuyee/archive/2013/06/03/400084.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 03 Jun 2013 00:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2013/06/03/400084.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/400084.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2013/06/03/400084.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/400084.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/400084.html</trackback:ping><description><![CDATA[<div style="float: left; min-height: 1px; margin-left: 30px; width: 870px; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px; background-color: #f0efe7;"><br /><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">抽时间整理了一下Java四大名著åQŒåˆ†äº«å‡ºæ¥æ–¹ä¾¿å¤§å®¶å­¦ä¹ ï¼</span></h2><div style="padding-left: 15px; margin: 0px 0px 20px; border-left-width: 5px; border-left-style: solid; border-left-color: #eeeeee;"><table style="max-width: 100%; background-color: transparent; border-collapse: collapse; border-spacing: 0px;"><tbody><tr><td><div>Note</div></td><td><strong>郑重声明åQæœ¬äººå¼ºçƒˆæ”¯æŒæ­£ç‰ˆï¼Œå››å¤§åè‘—我已¾lä¹°äº†ä¸‰æœ¬ï¼Œä¸‹è²ç”µå­ç‰ˆåªæ˜¯æ–¹ä¾‰K˜…读!毕竟˜q™ä¹ˆ¾lå…¸çš„书是必收藏的!</strong></td></tr></tbody></table></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Java¾~–程思想(½W?ç‰?</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版: <a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=502949&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDFåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503042&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503044&uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Effective JavaåQˆç¬¬2版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版: <a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503046&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDFåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503049&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503051&uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Java核心技æœ?卷IåQˆç¬¬8版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版: <a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503052&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDFåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503055&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503056&uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Java核心技æœ?卷IIåQˆç¬¬8版)</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版: <a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503057&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版CHMåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503058&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503056&uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Java语言½E‹åºè®¾è®¡(½W?ç‰?</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清版: <a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503059&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版CHMåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503060&uk=2785758310</a></p></li></ul></div></li><li><p style="margin: 0px 0px 10px;"><a style="color: #0088cc; text-decoration: none;">Java¾~–程思想(½W?ç‰?</a></p><div><ul style="padding: 0px; margin: 0px 0px 0px 25px;"><li><p style="margin: 0px 0px 10px;">中文高清非扫描版åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503099&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">英文原版PDFåQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503102&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">随书源码åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503103&uk=2785758310</a></p></li><li><p style="margin: 0px 0px 10px;">习题½{”案åQ?nbsp;<a style="color: #0088cc; text-decoration: none;">http://pan.baidu.com/share/link?shareid=503105&uk=2785758310</a></p></li></ul></div></li></ul></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-30</div></div></div><img src ="http://www.aygfsteel.com/kuuyee/aggbug/400084.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2013-06-03 08:30 <a href="http://www.aygfsteel.com/kuuyee/archive/2013/06/03/400084.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>当EffectiveJava遇见Guava - 静态工厂方法代替构造器(规则1)http://www.aygfsteel.com/kuuyee/archive/2013/05/30/399987.htmlkuuyeekuuyeeThu, 30 May 2013 09:09:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2013/05/30/399987.htmlhttp://www.aygfsteel.com/kuuyee/comments/399987.htmlhttp://www.aygfsteel.com/kuuyee/archive/2013/05/30/399987.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/399987.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/399987.html

Effective Java中指出,使用静态工厂方法代替构造器有几大优势:

½W¬ä¸€å¤§ä¼˜åŠ?- 他们有名¿U°ã€?/h4>

多个构造器只能通过匚w…å‚æ•°¾cÕdž‹çš„顺序不同来区分使用哪一个,˜q™æ ·å¸¸å¸¸ä¼šå¯¼è‡´ç”¨æˆ¯‚°ƒç”¨é”™è¯¯æž„造器åQŒè€Œé™æ€å·¥½E‹æ–¹æ³•则不同åQŒå¯ä»¥é€šè¿‡æ–ÒŽ³•名清晰的指明用意ã€?/p>

//本例只用来说明第一大优势,请不要纠¾l“其它问é¢?/span> 
public class Foo {
Set<Bar> bars;
List<Car> cars;
//构造器1
private Foo(Set<Bar> bars) {
this.bars = bars;
}
//构造器2
private Foo(List<Car> cars) {
this.cars = cars;
}
//构造器3
private Foo(Set<Bar> bars, List<Car> cars) {
this.bars = bars;
this.cars = cars;
}
//静态工厂方�
public static Foo newInstanceByBar(){
return new Foo(new HashSet<Bar>());
}
//静态工厂方�
public static Foo newInstanceByCar(){
return new Foo(new ArrayList<Car>());
}
//静态工厂方�
public static Foo newInstanceByAll(){
return new Foo(new HashSet<Bar>(),new ArrayList<Car>());
}
public static void main(String[] args) {
// 通过构造器创徏实例åQŒä¸å¥½åŒºåˆ†å®¹æ˜“ä‹É用错è¯?br /> Foo fbar = new Foo(new HashSet<Bar>());
Foo fcar = new Foo(new ArrayList<Car>());
Foo fall = new Foo(new HashSet<Bar>(),new ArrayList<Car>());
// 通过静态工厂方法可以清晰的用方法名识别
Foo fbar_static = Foo.newInstanceByBar();
Foo fcar_static = Foo.newInstanceByCar();
Foo fall_static = Foo.newInstanceByAll();
}
}
class Bar {}
class Car {}

对于GuavaåQŒåƈ没有提供创徏静态工厂方法的工具åQŒä½†æ•´ä¸ªGuava API到处都是静态方法的实现åQŒæˆ‘们以Guava Collections Framewrok举例说明ã€?/p>

Guava对于½W¬ä¸€å¤§ä¼˜åŠ¿æœ‰å¾ˆå¤šå®žçŽ°åQ?/p>

List<Type> exactly100 = Lists.newArrayListWithCapacity(100);
List<Type> approx100 = Lists.newArrayListWithExpectedSize(100);
Set<Type> approx100Set = Sets.newHashSetWithExpectedSize(100);

½W¬äºŒå¤§ä¼˜åŠ?- 不必在每‹Æ¡è°ƒç”¨ä»–们的时候都创徏一个新对象ã€?/h4>

方便对象重用åQŒè¿˜å¯ä»¥¼‹®ä¿ä¸å¯å˜çš„不会存在两个相等的实例,如果a==b那么a.equals.(b)才会˜q”回true ,如果能保证这一点,ž®±å¯ä»¥ä‹Éç”?tt>==操作½W¦æ¥æ¯”较对象åQŒä¼šæœ‰å¾ˆå¤§çš„æ€§èƒ½æå‡ã€?/p>

½W¬ä¸‰å¤§ä¼˜åŠ?- 他们可以˜q”回原返回类型的ä»ÖM½•子类型的对象ã€?/h4>

˜q™æ˜¯ä¸€ä¸ªéžå¸¸å¼ºå¤§çš„ç‰ÒŽ€§ï¼Œ Effective Java中列举了API、SPI、服务提供框架的关系来说明:

API(Service Interface): 服务公共接口 SPI(Service Provider Interface)åQ?服务提供商接å?nbsp;SPF(Service Provider Framework): 服务提供框架

看例�

// 服务提供框架½Cºæ„æ¨¡åž‹ - 服务API 
public interface ServiceAPI {
// ˜q™é‡Œæ˜¯æœåŠ¡æŒ‡å®šçš„æ–ÒŽ³•
}
// 服务提供框架½Cºæ„æ¨¡åž‹ - 服务SPI
public interface ServiceSPI {
ServiceAPI newService();
}
// 服务提供框架½Cºæ„æ¨¡åž‹å®žçް
// 不可实例化的¾c»ï¼Œç”¨æ¥æ³¨å†Œåˆ›å¾å’Œæä¾›è®¿é—?/span>
public class ServiceFramework {
private ServiceFramework() {
}// 强制防止实例化(规则4åQ?br />
// 映射服务名到服务
private static final ConcurrentMap<String, ServiceSPI> spis = new MapMaker().makeMap();//使用Guava创徏
public static final String DEFAULT_SPI_NAME = "<def>";

// 默认SPI注册API
public static void registerDefaultSPI(ServiceSPI spi) {
registerSPI(DEFAULT_SPI_NAME, spi);
}

// 指定SPI注册API
public static void registerSPI(String name, ServiceSPI spi) {
spis.put(name, spi);
}

// 服务讉K—®API
public static ServiceAPI newInstance() {
return newInstance(DEFAULT_SPI_NAME);
}
public static ServiceAPI newInstance(String name) {
ServiceSPI spi = spis.get(name);
if(spi == null)
throw new IllegalArgumentException(
"No provider registered with name: " + name);
return spi.newService();
}
}
Note
静态工½E‹æ–¹æ³•返回的对象所属的¾c»ï¼Œåœ¨ç¼–写这个包含静态工厂方法的¾cÀL—¶å¯ä»¥ä¸å¿…存在。上面的例子在编写ServiceFramework¾cÀL—¶åQŒServiceAPI的实现类òq¶ä¸å­˜åœ¨ã€‚这大大增加了框架的灉|´»æ€§ã€?/strong>

现在¾~–写客户端测试程åº?/p>

// ½Ž€å•的服务提供框架‹¹‹è¯•½E‹åº 
public class Test {
public static void main(String[] args) {
// 服务提供商执行下面的注册
ServiceFramework.registerDefaultSPI(DEFAULT_PROVIDER);
ServiceFramework.registerSPI("comp", COMP_PROVIDER);
ServiceFramework.registerSPI("armed", ARMED_PROVIDER);
// 客户端执行下面的创徏
ServiceAPI s1 = ServiceFramework.newInstance();
ServiceAPI s2 = ServiceFramework.newInstance("comp");
ServiceAPI s3 = ServiceFramework.newInstance("armed");
System.out.printf("%s, %s, %s%n", s1, s2, s3);
}
private static ServiceSPI DEFAULT_PROVIDER = new ServiceSPI() {
public ServiceAPI newService() {
return new ServiceAPI() {
@Override
public String toString() {
return "默认服务";
}
};
}
};
private static ServiceSPI COMP_PROVIDER = new ServiceSPI() {
public ServiceAPI newService() {
return new ServiceAPI() {
@Override
public String toString() {
return "Complementary 服务";
}
};
}
};
private static ServiceSPI ARMED_PROVIDER = new ServiceSPI() {
public ServiceAPI newService() {
return new ServiceAPI() {
@Override
public String toString() {
return "Armed 服务";
}
};
}
};
}

//输出如下 �/span>�/span>�/span>�/span>, Complementary �/span>�/span>, Armed �/span>�/span>

½W¬å››å¤§ä¼˜åŠ?- 在创建参数化¾cÕdž‹å®žä¾‹çš„æ—¶å€™ï¼Œä»–们使代码变得更加简‹zã€?/h4>

在JDK7之前åQŒæˆ‘们创å»ÞZ¸€ä¸ªCollections大致是这么做的:

List<TypeThatsTooLongForItsOwnGood> list = new ArrayList<TypeThatsTooLongForItsOwnGood>();

JDK7发布以后åQŒæˆ‘们可以简化成˜q™æ ·åQ?/p>

List<TypeThatsTooLongForItsOwnGood> list = new ArrayList<>();

但是Guava˜q˜æ˜¯å®æ„¿ä½¿ç”¨é™æ€å·¥½E‹æ–¹æ³•ï¼Œå› äØ“çœŸçš„éžå¸¸æ–¹ä¾¿åQ?/p>

Set<Type> copySet = Sets.newHashSet(elements); 
List<String> theseElements = Lists.newArrayList("alpha", "beta", "gamma");

静态工½E‹æ–¹æ³•çš„¾~ºç‚¹

  • ¾cÕd¦‚果不含公有的或者受保护的构造器åQŒå°±ä¸èƒ½è¢«å­¾cÕdŒ–åQŒè¿™ä¹Ÿè®¸ä¼šå› ¼œ¸å¾—¼›ï¼Œå› äؓ它鼓励开发äh员ä‹É用复合,而不是ç‘ôæ‰Ñ€?/p>

  • 他们与其他的静态方法实际上没有ä»ÖM½•区别 如果API文档没有明确的说明这是一个静态工½E‹æ–¹æ³•,ž®×ƒ¼šå¾ˆéš¾è¯†åˆ«å‡ºæ¥ã€‚遵循标准的命名规范习惯åQŒå¯ä»¥å×I补这一劣势åQŒä¸‹é¢åˆ—å‡ÞZ¸€äº›æƒ¯ç”¨å‘½åï¼š

    • valueOf - ˜q™æ ·çš„静态工厂方法实际上是类型è{æ?/p>

    • of - valueOf的简‹zæ–¹å¼?/p>

    • getInstance - ˜q”回实例通过æ–ÒŽ³•参数描述åQŒå¯¹äºŽå•例,该方法没有参敎ͼŒòq¶è¿”回唯一的实ä¾?/p>

    • newInstance - 与getInstance不同的是åQŒå®ƒ˜q”回的实例与所有其它实例都是不同的

    • getType - 像getInstanceä¸€æ øP¼Œä½†æ˜¯åœ¨å·¥åŽ‚æ–¹æ³•å¤„äºŽä¸åŒçš„¾cÖM¸­çš„æ—¶å€™ä‹É用。Type表示i˜q”回对象¾cÕdž‹

    • newType - 像newInstanceä¸€æ øP¼Œä½†æ˜¯åœ¨å·¥åŽ‚æ–¹æ³•å¤„äºŽä¸åŒçš„¾cÖM¸­çš„æ—¶å€™ä‹É用。Type表示i˜q”回对象¾cÕdž‹

2013-05-29


]]>
当EffectiveJava遇见Guava - toString(规则10)http://www.aygfsteel.com/kuuyee/archive/2013/05/29/399914.htmlkuuyeekuuyeeWed, 29 May 2013 03:40:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2013/05/29/399914.htmlhttp://www.aygfsteel.com/kuuyee/comments/399914.htmlhttp://www.aygfsteel.com/kuuyee/archive/2013/05/29/399914.html#Feedback2http://www.aygfsteel.com/kuuyee/comments/commentRss/399914.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/399914.html

我们都知道Java书籍有四大名著,其中 Effective Java可以说是高手˜q›é˜¶å¿…看的,作è€?nbsp;Joshua Bloch是Google的首席Java架构师,如果æŠ?James Gosling¿UîCØ“Java之父åQŒé‚£ä¹ˆJoshua Blochž®±åƒæ˜¯Java之母åQŒæ˜¯ä»–把Java养育成äh。之前曾有äh讨论˜q‡Google有很多编码规范,ä¸ÞZ»€ä¹ˆå”¯ç‹¬æ²¡æœ‰Java版的问题åQŒæœ€¾lˆçš„¾l“论ž®±æ˜¯åQ?/span>Googleçš„Java¾~–码规范ž®±æ˜¯ Effective Java一ä¹?/strong>åQŒå¯è§æ­¤ä¹¦æœ‰å¤šä¹ˆé‡è¦ã€‚现在Google又推å‡ÞZº†å¼ºå¤§å¥½ç”¨çš„Java通用¾cÕdº“ GuavaåQŒå…¬è®¤äؓ比Apache Common好用åQŒå› ä¸ºApache要兼容老版本,所以妨¼„äº†å¾ˆå¤šJava的新ç‰ÒŽ€§çš„使用ã€?/span>

既然Effective Javaå’ŒGuava都诞生于GoogleåQŒé‚£ä¹ˆå½“他们盔R‡ä¼šä»€ä¹ˆæ ·å‘¢ï¼Œä¸ºæ­¤æˆ‘决定重温Effective Java˜q™éƒ¨è‘—作åQŒåƈ针对每一条规则寻找Guava¾l™å‡ºçš„è§£å†Ïx–¹æ¡ˆï¼Œå¸Œæœ›èƒ½æ›´æ·±å…¥çš„æŽŒæ¡Javaã€?/p>

Effective Java½W?0条规则: å§‹ç»ˆè¦è¦†ç›?/strong>toStringæ–ÒŽ³•

Effective Java里指出,"廸™®®æ‰€æœ‰çš„子类都覆盖这ä¸?tt>toStringæ–ÒŽ³•"åQŒè¿™æ ·å¯ä»¥ä‹É¾cȝ”¨èµäh¥æ›´åŠ èˆ’é€‚ã€‚æœ€é‡è¦çš„æ˜¯˜q™æ ·çš„做法对调试非常有帮助,Guava通过 Objects.toStringHelper为我们提供了方便创徏toString的方法。看下面的样例:

// Returns "ClassName{x=1}"
   Objects.toStringHelper(this)
       .add("x", 1)
       .toString();

   // Returns "MyObject{x=1}"
   Objects.toStringHelper("MyObject")
       .add("x", 1)
       .toString();


Guava关于toString的文档连接: https://code.google.com/p/guava-libraries/wiki/CommonObjectUtilitiesExplained

下面我把Effective Java的样例代码列出,òq¶ç”¨Guava重新äº?tt>toStringæ–ÒŽ³•

// 重写PhoneNumberçš„toStringæ–ÒŽ³• - Effective Java中文½W¬äºŒç‰ˆç¬¬44™å?/span>
package org.effectivejava.examples.chapter03.item10;

import java.util.HashMap;
import java.util.Map;

import com.google.common.base.Objects;

public final class PhoneNumber {
        private final short areaCode;
        private final short prefix;
        private final short lineNumber;

        public PhoneNumber(int areaCode, int prefix, int lineNumber) {
                rangeCheck(areaCode, 999, "area code");
                rangeCheck(prefix, 999, "prefix");
                rangeCheck(lineNumber, 9999, "line number");
                this.areaCode = (short) areaCode;
                this.prefix = (short) prefix;
                this.lineNumber = (short) lineNumber;
        }

        private static void rangeCheck(int arg, int max, String name) {
                if (arg < 0 || arg > max)
                        throw new IllegalArgumentException(name + ": " + arg);
        }

        @Override
        public boolean equals(Object o) {
                if (o == this)
                        return true;
                if (!(o instanceof PhoneNumber))
                        return false;
                PhoneNumber pn = (PhoneNumber) o;
                return pn.lineNumber == lineNumber && pn.prefix == prefix
                                && pn.areaCode == areaCode;
        }

        @Override
        public int hashCode() {
                int result = 17;
                result = 31 * result + areaCode;
                result = 31 * result + prefix;
                result = 31 * result + lineNumber;
                return result;
        }

    //Effective Java原有的toStringæ–ÒŽ³•
        /*
         * @Override public String toString() { return
         * String.format("(%03d) %03d-%04d", areaCode, prefix, lineNumber); }
         */

        /**
         * 采用Guava实现的toString
         *
         */
        @Override
        public String toString() {
                return Objects.toStringHelper(this)
                                .addValue(String.format("(%03d) %03d-%04d", areaCode, prefix,lineNumber))
                                .add("areaCode", areaCode)
                                .add("prefix", prefix)
                                .add("lineNumber", lineNumber)
                                .toString();
        }

        public static void main(String[] args) {
                Map<PhoneNumber, String> m = new HashMap<PhoneNumber, String>();
                m.put(new PhoneNumber(707, 867, 5309), "Jenny");

                System.out.println(m);
        }
}

输出å¯Òޝ”

//原输�br />{(707) 867-5309=Jenny}  

//Guava实现输出
{PhoneNumber{(707) 867-5309, areaCode=707, prefix=867, lineNumber=5309}=Jenny}

2013-05-24


]]>
CDI在JavaEE7中占据如此重要的åœîC½åQ?/title><link>http://www.aygfsteel.com/kuuyee/archive/2013/05/17/399413.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Fri, 17 May 2013 07:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2013/05/17/399413.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/399413.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2013/05/17/399413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/399413.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/399413.html</trackback:ping><description><![CDATA[<header style="line-height: 20px;"> <div style="width: 1270px; margin-right: auto; margin-left: auto;"> <h1 style="color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif;"><span style="font-size: 21px; line-height: 30px;">从下面的JavaEE7新特性列表中åQŒä½ ä¼šå‘现CDI是多么的重要åQŒå®ƒæ— å¤„不在åQ?/span></h1><strong><span style="color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px;">到处都标½Cºç€“</span><span style="color: #ff0066; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px;">CDI Integration</span><font color="#4e443c" face="adelle, Georgia, Times New Roman, serif"><span style="font-size: 21px;">”åQŒæœ¬æ–‡æ‘˜è‡?nbsp;</span></font><a style="color: #0088cc; font-family: adelle, Georgia, 'Times New Roman', serif; font-size: 21px; text-decoration: none;">˜q™é‡Œ</a></strong><p> </p> </div> </header> <div style="width: 1270px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"> <div style="text-align: left; color: #5a5a5a;"> <div style="margin-left: -30px;"> <div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;"> <h2><u>EJB 3.2</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Enterprise Java Bean 3.2 <a style="color: #0088cc; text-decoration: none;">(JSR 345)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhancing EJB architecture to enable the PaaS model with features such as multi-tenancy</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Factorization of container-managed transactions to use other component technologies of the Java EE platform</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhanced use of annotations to simplify EJB programming model</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Alignment and integration with other specifications related to JSRs within the Java EE 7 platform such as<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> , JMS, Bean Validation, etc</li> </ul> <h2><u>EL 3.0</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Expression Language 3.0 <a style="color: #0088cc; text-decoration: none;">(JSR 341)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Separate expression language context into parsing and evaluation contexts independent of the JSP specification</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Introduction of new customizable expression language coercion rules</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Adding equality, string concatenation, and sizeof operators</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> Integration so that +events+ can be generated before/during/after the expressions are evaluated</li> </ul> <h2><u>JMS 2.0</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Messaging Service 2.0 <a style="color: #0088cc; text-decoration: none;">(JSR 343) </a>The new introduction will be an evolution of the previous version, JSR-914.</p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhanced JMS programming model to make application development easier, cleaning up ambiguities in the present specification</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhanced integration with <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> for easier and more unified use of API</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Make necessary changes to API in allowing any JMS provider to integrate with any Java EE containerinvocation</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Make JSR more cloud-friendly, leveraging multi-tenancy and other cloud-related features from the platform</li> </ul> <h2><u>EL 3.0</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Expression Language 3.0 <a style="color: #0088cc; text-decoration: none;">(JSR 341)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Separate expression language context into parsing and evaluation contexts independent of the JSP specification</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Introduction of new customizable expression language coercion rules</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Adding equality, string concatenation, and sizeof operators</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> Integration so that events can be generated before/during/after the expressions are evaluated</li> </ul> </div> <div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;"> <h2><u>Servlet 3.1</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Servlet 3.2 <a style="color: #0088cc; text-decoration: none;">(JSR 340) </a>Servlet早在JavaEE6ž®±å·²¾læ— ¾~é›†æˆäº† <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Optimize Java EE PaaS model, leveraging the cloud for Web applications</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Optimizing PaaS model leveraging multi-tenancy. To support this into the Web container, the main areas of optimization will be security, session state, resources and</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> other multi-tenant awareness requirements for Web applications.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhance the asynchronous support of Servlet 3.0 and simplify further in building asynchronous applications</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Utilize Java EE concurrency APIs for asynchronous support</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Enhance the Servlet 3.0 built-in security features</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Optimize the built-in plug-ability support of Servlet 3.0</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Focus on providing necessary functionality for building easier-to-use, high-level protocol support for Web Sockets and other protocols that work with HTTP in the Servlet API</li> </ul> <h2><u>JAX-RS 2.0</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java API for RESTful Web Services 2.0 <a style="color: #0088cc; text-decoration: none;">(JSR 339)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Define two client APIs, both REST-compatible -- a low-level API using builder pattern and a higher-level API leveraging the low-level APIs</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Hypermedia, an important RESTful feature of Web applications, will be easy to create, and it will process links associated with resources in representation either as a header or as a links within the entity peripheral.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Make it possible to validate parameters of forms or query using bean validation and return a meaningful response on failure to validate</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Closer integration <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> @Inject</li> </ul> <h2><u>JSF 2.2</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Server Faces 2.2 <a style="color: #0088cc; text-decoration: none;">(JSR 344)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Making configuration options dynamic, eliminate tag handler class even for non-composite JSP components, introduce shorthand URLs for Facelet Tag Libraries, make cc:interface in composite components optional, enhance deployment, integrate with <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code></li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Component identification and Ajax</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Support implementation of Portlet Bridge 2.0</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Support for HTML5 features, such as Forms, Heading, Metadata and Section content model, Flow management, Listener for page navigation events, and new components like FileUpload and BackButton</li> </ul> <h2><u>CDI 1.1</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Context and Dependency Injection 1.1 <a style="color: #0088cc; text-decoration: none;">(JSR 346)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Global ordering of interceptors and decorators,</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> API for managing built-in context,</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Embedded mode to allow startup outside the Java EE container</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Declarative control over which packages/classes are scanned in a bean archive</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Bean declaration at constructor level</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Injection for static members, such as loggers</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Send <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> events for Servlet events</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Better support for <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> in libraries when used in the Java EE platform</li> </ul> </div> <div style="float: left; min-height: 1px; margin-left: 30px; width: 370px;"> <h2><u>JPA 2.1</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Java Persistence API 2.1 <a style="color: #0088cc; text-decoration: none;">(JSR 338)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Addition of the javax.persistence.StoredProcedureQuery interface to control stored procedure query execution. >Javax.persistence.EntityManager has added four variants of methods that return a StoredProcedureQuery for executing a stored procedure, including one allowing named stored procedure query. The newly introduced annotation @NamedStoredProcedureQuery can be specified on an entity or mapped class, similar to the @NamedQuery. The parameters IN, OUT and INOUT can be used to manipulate values from the stored procedure.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> The javax.persistence.criteria.AbstractQuery interface has been refactored by CriteriaUpdate, CriteriaDelete and CommonAbstractQuery interfaces.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Added new identifiers for persistence query language (JPQL), such as FUNCTION for supporting JPQL built-in functions, TREAT for down casting within path expressions in the FROM and WHERE clauses, and ON for specifying the relationship between the tables.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> <code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> Integration Listener.The entity listeners can be annotated with @PostConstruct and @PostDestroy for their lifecycle. Also, the usual lifecycle callback methods, such as @PrePersist, @PostPersist, @PreUpdate and @PreRemove can be used for entities.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Added support for unsynchronized persistence context to create container-managed unsynchronized persistence context. For example, @PersistenceContext (synchronization=SynchronizationType.UNSYNCHRONIZED)</li> </ul> <h2><u>Bean Validation 1.1</u></h2> <p style="margin: 0px 0px 10px; font-size: 16px; line-height: 1.5;">Bean Validation 1.1 <a style="color: #0088cc; text-decoration: none;">(JSR 349)</a></p> <ul clearfix"="" style="padding: 0px; margin: 0px 0px 10px; list-style: none;"> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Integration with other Java EE specsåQ?nbsp;<code style="padding: 2px 4px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 30px; color: #dd1144; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: nowrap; background-color: #f7f7f9; border: 1px solid #e1e1e8;">CDI</code> etc.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> APIs to validate parameters and return values of method calls.</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Validate parameters and return values on HTTP calls</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Ability to translate a group into another group while cascading the validation</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> APIs to validate parameters and return values of method calls</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Apply constraints on group collection</li> <li style="line-height: 25px; float: left; width: 370px;"><em style="display: inline-block; width: 14px; height: 14px; margin-top: 1px; line-height: 14px; vertical-align: text-top; background-image: url(http://10.128.143.87:4242/images/glyphicons-halflings.png); background-position: -433px -96px; background-repeat: no-repeat no-repeat;"></em> Extend the model to support AND and OR style composition</li> </ul> </div> </div> </div> </div>  <img src ="http://www.aygfsteel.com/kuuyee/aggbug/399413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2013-05-17 15:40 <a href="http://www.aygfsteel.com/kuuyee/archive/2013/05/17/399413.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CDI(JSR-346)-JavaEEòq›_°ä¸Šä¸‹æ–‡ä¾èµ–注入规èŒ?1.1 新特æ€?/title><link>http://www.aygfsteel.com/kuuyee/archive/2013/05/09/399037.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Thu, 09 May 2013 03:47:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2013/05/09/399037.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/399037.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2013/05/09/399037.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/399037.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/399037.html</trackback:ping><description><![CDATA[<div style="width: 1170px; margin-right: auto; margin-left: auto; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="margin-left: -30px;"><div style="float: left; min-height: 1px; margin-left: 30px; width: 870px;"><div style="background-color: #fcfcfa; border: 1px solid #e2e0d8; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding: 22px; margin-bottom: 35px;"><h2><span style="font-size: 14px;">主要功能改进</span></h2><div><div><p style="margin: 0px 0px 10px;">˜q™äº›ä¸»è¦åŠŸèƒ½æ”¹å˜å·²ç»åœ¨CDI 1.1中引入:</p></div><div><ul style="padding: 0px; margin: 0px 0px 10px 25px;"><li><p style="margin: 0px 0px 10px;">加入全局拦截å™?(参阅Java Interceptors Specification 1.2)åQ?全局装饰å™?å’Œä‹Éç”?tt>@Priority</tt>注解实现替代选择</p></li><li><p style="margin: 0px 0px 10px;">¾l™æ³¨è§£äØ“<tt>@AroundConstruct</tt>的构造器加入生命周期回调支持 (参阅 Java Interceptors Specification 1.2)</p></li><li><p style="margin: 0px 0px 10px;">允许¾l‘定拦截构造器</p></li><li><p style="margin: 0px 0px 10px;">拦截器绑定移入拦截器规范åQŒä»¥ä¾›å…¶å®ƒè§„范ä‹Éç”?/p></li><li><p style="margin: 0px 0px 10px;">Beans内徏支持装饰å™?nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入<tt>EventMetadata</tt>允许事äšg元数据检æŸ?/p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>@Vetoed</tt> æ³¨è§£è®©Classes失去原有½E‹åºèƒ½åŠ›</p></li><li><p style="margin: 0px 0px 10px;">很多改进来强化beans功能åQŒåŒ…æ‹?nbsp;<tt>@TransientReference</tt> æ³¨è§£å…è®¸ä¿ç•™å®žåŠ›¾l™è°ƒç”¨å®ƒçš„æ–¹æ³•或构造函æ•?nbsp;</p></li><li><p style="margin: 0px 0px 10px;">加入‹È€‹zÕd’Œé”€æ¯å‘¨æœŸçš„事äšg回调 </p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>AlterableContext</tt> å…è®¸bean实例被明¼‹®çš„销æ¯?/p></li><li><p style="margin: 0px 0px 10px;">¾l™bean在周期注解、EJB、在JavaEE中自启动CDI功能 </p></li><li><p style="margin: 0px 0px 10px;">åœ?nbsp;<tt>bean.xml</tt>中加入class˜q‡æ×o排除åQŒä»¥é˜²æ­¢æ‰«æclasseså’Œpackage </p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>Unmanaged</tt> å…è®¸æ–¹ä¾¿çš„访问无上下文的bean实例</p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>CDI</tt> ä»¥æ–¹ä¾¿çš„讉K—®å½“前的CDI容器</p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>AfterTypeDiscovery</tt>事äšgåQŒå…è®¸åœ¨¾cÕdž‹å‘现之后扩展附加注册</p></li><li><p style="margin: 0px 0px 10px;">加入 <tt>@WithAnnotation</tt> æ³¨è§£ä½œäؓ一¿Uæ”¹å–„负载性能的方å¼?/p></li><li><p style="margin: 0px 0px 10px;">在便携的扩展加入很多‹Æ¡è¦çš„æ”¹˜q?/p></li></ul></div></div><p style="margin: 0px 0px 10px;"></p><div>2013-05-09</div></div></div></div></div><footer style="text-align: center; padding: 20px 0px; margin-top: 20px; border-top-width: 1px; border-top-style: solid; border-top-color: #e5e5e5; background-color: #f5f5f5; color: #4e443c; font-family: adelle, Georgia, 'Times New Roman', serif; line-height: 20px;"><div style="width: 1170px; margin-right: auto; margin-left: auto;"></div></footer><img src ="http://www.aygfsteel.com/kuuyee/aggbug/399037.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2013-05-09 11:47 <a href="http://www.aygfsteel.com/kuuyee/archive/2013/05/09/399037.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse配色æ–ÒŽ¡ˆæ’äšg 真漂亮!http://www.aygfsteel.com/kuuyee/archive/2013/02/26/395728.htmlkuuyeekuuyeeTue, 26 Feb 2013 02:43:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2013/02/26/395728.htmlhttp://www.aygfsteel.com/kuuyee/comments/395728.htmlhttp://www.aygfsteel.com/kuuyee/archive/2013/02/26/395728.html#Feedback3http://www.aygfsteel.com/kuuyee/comments/commentRss/395728.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/395728.html最˜q‘发çŽîCº†ä¸€ä¸ªEclipse配色æ–ÒŽ¡ˆæ’äšgåQŒè¿™å›žç»™Eclipse配色太方便了ã€?/p>

插äšg主页åQ?a style="color: #0088cc; text-decoration: initial;">http://eclipsecolorthemes.org/

插äšg提供了上万种配色æ–ÒŽ¡ˆåQŒéžå¸¸æ¼‚亮,上图看下åQ?/p>

安装很简单,打开 Eclipse Marketplace

查找 Eclipse Color ThemeåQŒä¼šæ‰‘Öˆ°˜q™ä¸ªæ’äšgã€?/p>


安装完成后进å…?nbsp;Preferences —> Appearance —> Color Theme ž®±å¯é€‰æ‹©ä¸»é¢˜äº?/p>



]]>
Jboss Seam2.3.0.BETA1发布http://www.aygfsteel.com/kuuyee/archive/2012/04/08/373585.htmlkuuyeekuuyeeSun, 08 Apr 2012 12:00:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2012/04/08/373585.htmlhttp://www.aygfsteel.com/kuuyee/comments/373585.htmlhttp://www.aygfsteel.com/kuuyee/archive/2012/04/08/373585.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/373585.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/373585.htmlJbossåœ?æœ?0号发布了Seam2.3.0.BETA1åQ?/span>Release Notes如下åQ?br />
  • 修正了大量的Bug
  • 全面支持JSF2
  • 加入 bean validation å’?EJB 3.1 的支æŒ?/li>
  • 升çñ”Drools版本è‡?.1
  • 升çñ”Junit版本è‡?
  • 更新大量例子支持JSF2
Jboss Seam计划在这个月发布另一个里½E‹ç¢‘ 2.3.0.Beta2åQŒé€æ­¥å®Œå–„ Arquillian å’?Seam Gen ç‰ÒŽ€§ã€‚其后就集中åœ?2.3.0 çš„BUG 修复上ã€?nbsp;

下蝲åQ?/span>http://www.seamframework.org/Seam2/Downloads 
文档åQ?/span>http://www.seamframework.org/Seam2/Seam2Documentation. 

]]>
用Weblogic WLST脚本 ˜qœç¨‹éƒ¨çÖvWeb应用http://www.aygfsteel.com/kuuyee/archive/2011/10/13/361213.htmlkuuyeekuuyeeThu, 13 Oct 2011 15:46:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/10/13/361213.htmlhttp://www.aygfsteel.com/kuuyee/comments/361213.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/10/13/361213.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/361213.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/361213.html
 1 import re
 2  
 3 warPath = 'helloWebApp'
 4 serverUrl = 't3://192.168.1.100:7001'
 5 username = 'weblogic'
 6 password = 'weblogic'
 7 targetServer="examplesServer"
 8 deployAppName='DeployExample2'
 9 
10  
11 connect(username, password, serverUrl)
12  
13 appList = re.findall(deployAppName, ls('/AppDeployments'))
14 print "========================="
15 print len(appList)
16 if len(appList) > 0:
17     #oldestArchiveVersion = min(map(int, appList))
18     print 'come in!!!'            
19     undeploy(deployAppName)
20  
21 #deploy(appName='DeployExample', path = 'helloWebApp', targets = 'examplesServer',timeout=600000, block = 'true')
22 
23 deploy(deployAppName, warPath, targets=targetServer, securityModel = "Advanced",timeout=600000, block = "true")
24 exit()
Ok

]]>
JBoss AS7配置MySQL数据æº?/title><link>http://www.aygfsteel.com/kuuyee/archive/2011/07/19/354598.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 19 Jul 2011 02:49:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2011/07/19/354598.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/354598.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2011/07/19/354598.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/354598.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/354598.html</trackback:ping><description><![CDATA[     摘要: AS7默​认​的​数​据​源​是​H2åQŒè™½â€‹ç„¶â€‹H2方​便​,但​是​一​般​的​生​äñ”​环​境​都​是​MySQL、​ORACLE、​SQLServer居​多​,本​文​描​述​如​何​在​AS7配​置​MySQL数​据​源​ã€?nbsp; <a href='http://www.aygfsteel.com/kuuyee/archive/2011/07/19/354598.html'>阅读全文</a><img src ="http://www.aygfsteel.com/kuuyee/aggbug/354598.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2011-07-19 10:49 <a href="http://www.aygfsteel.com/kuuyee/archive/2011/07/19/354598.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBoss AS7 发布http://www.aygfsteel.com/kuuyee/archive/2011/07/13/354224.htmlkuuyeekuuyeeWed, 13 Jul 2011 01:43:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/07/13/354224.htmlhttp://www.aygfsteel.com/kuuyee/comments/354224.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/07/13/354224.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/354224.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/354224.html阅读全文

]]>
JavaEE6 FAQs 之@Modelhttp://www.aygfsteel.com/kuuyee/archive/2011/07/12/354161.htmlkuuyeekuuyeeTue, 12 Jul 2011 06:14:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/07/12/354161.htmlhttp://www.aygfsteel.com/kuuyee/comments/354161.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/07/12/354161.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/354161.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/354161.html阅读全文

]]>
(¾˜»è¯‘)JavaEE6规范 CDI教程½W¬äº”部分http://www.aygfsteel.com/kuuyee/archive/2011/07/12/354145.htmlkuuyeekuuyeeTue, 12 Jul 2011 02:38:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/07/12/354145.htmlhttp://www.aygfsteel.com/kuuyee/comments/354145.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/07/12/354145.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/354145.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/354145.html阅读全文

]]>
(¾˜»è¯‘)JavaEE6规范 CDI教程½W¬å››éƒ¨åˆ†http://www.aygfsteel.com/kuuyee/archive/2011/06/28/353291.htmlkuuyeekuuyeeTue, 28 Jun 2011 10:26:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/06/28/353291.htmlhttp://www.aygfsteel.com/kuuyee/comments/353291.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/06/28/353291.html#Feedback4http://www.aygfsteel.com/kuuyee/comments/commentRss/353291.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/353291.html阅读全文

]]>
Maven™å¹ç›®å¸¸è§é—®é¢˜å®žæˆ˜(一) è§£å†³ç›æ€º’依赖http://www.aygfsteel.com/kuuyee/archive/2011/06/28/353158.htmlkuuyeekuuyeeTue, 28 Jun 2011 04:40:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/06/28/353158.htmlhttp://www.aygfsteel.com/kuuyee/comments/353158.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/06/28/353158.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/353158.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/353158.html阅读全文

]]>
(¾˜»è¯‘)JavaEE6规范 CDI教程½W¬ä¸‰éƒ¨åˆ†http://www.aygfsteel.com/kuuyee/archive/2011/06/20/352650.htmlkuuyeekuuyeeMon, 20 Jun 2011 03:43:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/06/20/352650.htmlhttp://www.aygfsteel.com/kuuyee/comments/352650.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/06/20/352650.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/352650.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/352650.html阅读全文

]]>
(¾˜»è¯‘)JavaEE6规范 CDI教程½W¬äºŒéƒ¨åˆ†http://www.aygfsteel.com/kuuyee/archive/2011/06/17/352490.htmlkuuyeekuuyeeFri, 17 Jun 2011 03:10:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/06/17/352490.htmlhttp://www.aygfsteel.com/kuuyee/comments/352490.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/06/17/352490.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/352490.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/352490.html  é˜…读全文

]]>
(¾˜»è¯‘)JavaEE6规范 CDI教程½W¬ä¸€éƒ¨åˆ†http://www.aygfsteel.com/kuuyee/archive/2011/06/16/352421.htmlkuuyeekuuyeeThu, 16 Jun 2011 06:03:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/06/16/352421.htmlhttp://www.aygfsteel.com/kuuyee/comments/352421.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/06/16/352421.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/352421.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/352421.htmlCDI是​依​赖​注​入â€?DI)和​拦​截â€?AOP)的​Java标​准​规​范​。​DI和​AOP有​着​很​高​的​知​名​度​,Java需​要​处​理​DI和​AOP以​便​在​此​之​上​构​徏​其​它​的​标​准​。​DI和​AOP是​很​多​Java框​架​的​基​础​。â€?
CDI是​JavaEE 6的​基​础​。​它​很​快​就​得​到​了​Caucho's Resin、​IBM's WebSphere、​Oracle's Glassfish、​Red Hat's JBoss和​众​多​应​用​服​务​器​的​支​持​。​CDI与​Spring和​Guice框​架​非​常​相​似​,ž®±â€‹åƒâ€‹JPA很​像​ORM。​CDI½Ž€â€‹åŒ–​了​对​于​DI和​AOP的​API。​如​果​你​ä‹É​用​过​Spring或​者​GuiceåQŒä½ â€‹ä¼šâ€‹å‘​现​CDI更​容​易  é˜…读全文

]]>
Ceylon语言介绍½W¬ä¸€éƒ¨åˆ†åQˆç¿»è¯‘)——Hibernate之父的又一力作http://www.aygfsteel.com/kuuyee/archive/2011/05/24/350885.htmlkuuyeekuuyeeMon, 23 May 2011 23:25:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/05/24/350885.htmlhttp://www.aygfsteel.com/kuuyee/comments/350885.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/05/24/350885.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/350885.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/350885.htmlCeylon是一门新的语­a€åQŒå®ƒ˜qè¡Œåœ¨Java虚拟æœÞZ¸ŠåQŒç›®å‰æ­£æœ‰æˆ‘所在的ž®ç»„开发,它隶属于RedHat。我们都是Javaå’ŒJava生态系¾lŸçš„¾_‰ä¸åQŒå› ä¸ºå®ƒçš„实用性、广阔的文化氛围和开发社区、天生适用于商业应用以及可¿UÀL¤æ€§ã€‚然而我们必™åÀL‰¿è®¤è¿™é—¨è¯­­a€å’Œå…¶çŽ°æœ‰çš„ç±»åº“ï¼Œå·²ç»˜q‡äº†15òq´çš„发展åQŒå®ƒä¸èƒ½å†æä¾›æ›´å¥½çš„功能来解决现在的商业问题ã€?nbsp; é˜…读全文

]]>
XSL入门(¾˜»è¯‘)http://www.aygfsteel.com/kuuyee/archive/2011/03/09/345993.htmlkuuyeekuuyeeWed, 09 Mar 2011 00:58:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/03/09/345993.htmlhttp://www.aygfsteel.com/kuuyee/comments/345993.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/03/09/345993.html#Feedback1http://www.aygfsteel.com/kuuyee/comments/commentRss/345993.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/345993.html本书不错,所以翻译了一下XSL的入门部åˆ?
XSL是​一​个​模​板​语​言​,而​不​是​一​个​程​序​语​言​。​这​意​味​着​stylesheet制​定​了​一​个​输​出​样​本​,而​不​是​ä‹É​用​程​序​按​步​骤​生​成​。​一​个​stylesheetåŒ…â€‹å«â€‹äº†â€‹ä¸€â€‹ä¸ªâ€‹æØœâ€‹åˆâ€‹çš„â€‹è¾“â€‹å‡ºâ€‹æ ·â€‹æœ¬â€‹ï¼Œòq¶â€‹ä¸”â€‹äØ“â€‹æ¯â€‹ä¸ªâ€‹æ ·â€‹æœ¬â€‹ä½©â€‹æˆ´â€‹äº†â€‹è¾“â€‹å‡ºâ€‹æŒ‡â€‹ä×o​。​每​一​个​晓​得​输​出​样​本​加​上​处​理​指​ä×o​就​构​成​了​一​个​模​板​。â€?
  é˜…读全文

]]>
装蝲嵌入式JBoss到Tomatä¸?/title><link>http://www.aygfsteel.com/kuuyee/archive/2011/03/08/345915.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Tue, 08 Mar 2011 01:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2011/03/08/345915.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/345915.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2011/03/08/345915.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/345915.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/345915.html</trackback:ping><description><![CDATA[     摘要: 最​近​准​备​研​究​下​Seam框​架​,丠Z€‹è¦â€‹æ˜¯â€‹ä¸“​注​一​下​JBPM集​成​部​分​的​内​容​。​由​于​Seam是​Jboss的​äñ”​品​,所​以​官​方​推​荐​ä‹É​用​JBoss应​用​服​务​器​。​个​ähâ€‹è®¤â€‹äØ“â€‹é‚£â€‹ä¸œâ€‹è¥¿â€‹å¤ªâ€‹å¤§â€‹æœ‰â€?00多​MBåQŒæ‡’​得​下​蝲​! 查​看​了​下​Seam文​档​,上​面​说​可​以​ä‹É​用​Tomcat+嵌​入​式​JBossåQŒè¿™â€‹ä¸ªâ€‹æ¯”​较​爽​,嵌​入​式​JBoss才â€?0MB。​下​面​记​录​一​下​配​置​过​程​。â€?<br>   <a href='http://www.aygfsteel.com/kuuyee/archive/2011/03/08/345915.html'>阅读全文</a><img src ="http://www.aygfsteel.com/kuuyee/aggbug/345915.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2011-03-08 09:19 <a href="http://www.aygfsteel.com/kuuyee/archive/2011/03/08/345915.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Jenkins文档¾˜»è¯‘(1)-½Ž¡ç†http://www.aygfsteel.com/kuuyee/archive/2011/03/07/345864.htmlkuuyeekuuyeeMon, 07 Mar 2011 02:54:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2011/03/07/345864.htmlhttp://www.aygfsteel.com/kuuyee/comments/345864.htmlhttp://www.aygfsteel.com/kuuyee/archive/2011/03/07/345864.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/345864.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/345864.htmlJenkins需​要​一​些​磁​盘​空​间​来​执​行​构​徏​和​归​档​。​你​可​以​在​Jenkins的​配​置​页​面​查​看​磁​盘​所​在​的​èµ\​径​。​默​认​情​况​下​是​~/.jenkinsåQŒä½ â€‹å¯â€‹ä»¥â€‹é€šâ€‹è¿‡â€‹å¦‚​下​的​方​法​来​改​变​设​置​:   é˜…读全文

]]>
˜qœç¨‹è°ƒè¯•Tomcat7下的应用http://www.aygfsteel.com/kuuyee/archive/2010/12/03/339730.htmlkuuyeekuuyeeFri, 03 Dec 2010 09:46:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2010/12/03/339730.htmlhttp://www.aygfsteel.com/kuuyee/comments/339730.htmlhttp://www.aygfsteel.com/kuuyee/archive/2010/12/03/339730.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/339730.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/339730.html 

˜qœç¨‹è°ƒè¯•Tomcat7下的应用

kuuyee  |  2010-12-03  |  Tomcat   debug  

首先在Tomcat的bin目录下修改catalina.sh,加入JAVA_OPTS参数:

JPDA_ADDRESS=20777 JAVA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20777'

其中JPDA_ADDRESS要指定一个没有被占用的端�如果不指�默认值是8000

然后用下面的方式启动tomcatåQ?/p>

catalina.sh jpda start

最后启动EclipseåQŒé€‰æ‹©ä½ æƒ³è¦Debug的类òq¶è®¾¾|®æ–­ç‚¹ï¼Œç„¶åŽé€‰æ‹©Debug工具栏下的Debug子菜å?Debug…)åQŒåœ¨å¼¹å‡ºçš„Debug½H—口中,在左边的菜单™å¹ä¸­é€‰æ‹©˜qœç¨‹è°ƒè¯•(Remote Java Application)åQŒç„¶åŽè¾“入机器名和端口,比如è¯?92.168.1.1å’?0777åQŒç„¶åŽApplyòq¶ä¸”开始Debug

2010-12-03

 



]]>
JDK7 ½W¬å››ä¸ªé‡Œ½E‹ç¢‘版本攑ևºåQˆè¯‘åQ?/title><link>http://www.aygfsteel.com/kuuyee/archive/2009/08/04/289693.html</link><dc:creator>kuuyee</dc:creator><author>kuuyee</author><pubDate>Mon, 03 Aug 2009 18:20:00 GMT</pubDate><guid>http://www.aygfsteel.com/kuuyee/archive/2009/08/04/289693.html</guid><wfw:comment>http://www.aygfsteel.com/kuuyee/comments/289693.html</wfw:comment><comments>http://www.aygfsteel.com/kuuyee/archive/2009/08/04/289693.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/kuuyee/comments/commentRss/289693.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/kuuyee/services/trackbacks/289693.html</trackback:ping><description><![CDATA[原文åQšhttp://blogs.sun.com/mr/entry/jdk7_m4<br /> <br /> 7æœ?0号Sun攑ևºäº†JDK7的第4个里½E‹ç¢‘版本<a >JDK Milestone 4</a>åQŒSun计划åœ?010òq?月放出第8个里½E‹ç¢‘版本åQŒå±Šæ—¶ä¹Ÿæ˜¯æœ€åŽä¸€ä¸ªé‡Œ½E‹ç¢‘版本åQŒä¹Ÿž®±æ˜¯è¯´æˆ‘们至ž®‘要åœ?010òq?月后才能看到JDK7的最¾lˆç‰ˆæœ¬ï¼Œè€Œä¸”前提是Sun不蟩¼œ¨ã€?br /> <br /> 查看详细的JDK里程¼„‘版本计划请看http://openjdk.java.net/projects/jdk7/milestones/<br /> <br /> ˜q™ä¸ªé‡Œç¨‹¼„‘版本添加了如下新特性:<br /> <ol> <li> 兼容JDK6u10的新ç‰ÒŽ€§ï¼š<a >Java Plug-In</a>技术(主要是针对Applet的)åQ?a >Java Kernel</a>åQˆç²¾½Ž€çš„JREåQ‰ä»¥å?a >Quick Starter</a>(快速启动,据说能把内存使用控制åœ?0MBå†?</li> <li> JSR 308åQ?a >Annotations on Java types</a>,对Java注解语法的扩展,使注解能够用在Java¾cÕdž‹ä¸Šï¼Œå§‹è€Œèƒ½å¤Ÿæ£€æŸ¥å„¿Uå„æ ïLš„¾~–译旉™”™è¯¯ï¼ˆ<a >compile-time error checkers</a>åQ‰ã€?/li> </ol> <br /> 计划更新çš?a >XML stack</a>òq¶æ²¡æœ‰å‡ºçŽ°åœ¨M4中,我们只能期待M5来兑çŽîCº†ã€?br /> <br /> 完整的更新列表请çœ?a >˜q™é‡Œ</a><img src ="http://www.aygfsteel.com/kuuyee/aggbug/289693.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/kuuyee/" target="_blank">kuuyee</a> 2009-08-04 02:20 <a href="http://www.aygfsteel.com/kuuyee/archive/2009/08/04/289693.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用maven-jdocbook-plugin½Ž€å•配¾|®docbook5.0环境http://www.aygfsteel.com/kuuyee/archive/2009/07/27/288613.htmlkuuyeekuuyeeMon, 27 Jul 2009 09:24:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2009/07/27/288613.htmlhttp://www.aygfsteel.com/kuuyee/comments/288613.htmlhttp://www.aygfsteel.com/kuuyee/archive/2009/07/27/288613.html#Feedback2http://www.aygfsteel.com/kuuyee/comments/commentRss/288613.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/288613.html文章介绍5.0的编译环å¢?真的比较½Ž€å?不过我今天看了看jboss seamçš„æ–‡æ¡£æž„å»ø™¿‡½E?构徏环境搭徏真是½Ž€å•的不能再简单了,jboss seam使用maven来发布docbook文档,用到了maven-jdocbook-plugin,我把jboss seam的构建提取出æ?大家可以参考来方便构徏自己的docbook.

创徏一个最最½Ž€å•çš„maven½Iºé¡¹ç›?pom.xml内容如下:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation
="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
<modelVersion>4.0.0</modelVersion>
    
<groupId>org.kuuyee</groupId>
    
<artifactId>first-docbook</artifactId>
    
<packaging>jar</packaging>
    
<version>1.0-SNAPSHOT</version>
    
<name>first-docbook</name>

            
<build>
                
<plugins>
               
<!-- the docbook generation plugin for the user guide -->
                    
<plugin>
                        
<groupId>org.jboss.maven.plugins</groupId>
                        
<artifactId>maven-jdocbook-plugin</artifactId>
                        
<version>2.1.1</version>
                        
<extensions>true</extensions>
                        
<dependencies>
                            
<dependency>
                                
<groupId>org.jboss</groupId>
                                
<artifactId>jbossorg-docbook-xslt</artifactId>
                                
<version>1.1.0</version>
                            
</dependency>
                            
<dependency>
                                
<groupId>org.jboss</groupId>
                                
<artifactId>jbossorg-jdocbook-style</artifactId>
                                
<version>1.1.0</version>
                                
<type>jdocbook-style</type>
                            
</dependency>
                        
</dependencies>
                        
<executions>
                            
<execution>
                                
<id>tutorial_zh_CN</id>
                                
<phase>package</phase>
                                
<goals>
                                    
<goal>resources</goal>
                                    
<goal>generate</goal>
                                
</goals>
                                
<configuration>
                                    
<sourceDocumentName>master.xml</sourceDocumentName>
                                    
<sourceDirectory>${basedir}/src/main/docbook/zh_CN</sourceDirectory>
                                    
<imageResource>
                                        
<directory>${basedir}/src/main/docbook/images</directory>
                                    
</imageResource>
                                    
<cssResource>
                                        
<directory>${basedir}/src/main/docbook/css</directory>
                                    
</cssResource>
                                    
<targetDirectory>${basedir}/target/docbook/zh_CN</targetDirectory>

                                    
<formats>
                                        
<format>
                                            
<formatName>pdf</formatName>
                                            
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
                                            
<finalName>zh_CN.pdf</finalName>
                                        
</format>
                                        
<format>
                                            
<formatName>html</formatName>
                                            
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
                                            
<finalName>index.html</finalName>
                                        
</format>
                                        
<format>
                                            
<formatName>html_single</formatName>
                                            
<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
                                            
<finalName>index.html</finalName>
                                        
</format>
                                    
</formats>
                                    
<options>
                                        
<xincludeSupported>true</xincludeSupported>
                                    
</options>
                                
</configuration>
                            
</execution>
                        
</executions>
                    
</plugin>
                
</plugins>
            
</build>
    
    
<!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
    
<repositories>
        
<repository>
            
<id>snapshots.jboss.org</id>
            
<url>http://snapshots.jboss.org/maven2</url>
        
</repository>
        
<repository>
            
<id>repository.jboss.org</id>
            
<url>http://repository.jboss.org/maven2</url>
        
</repository>
    
</repositories>
</project>

在src/main/docbook/zh_CN下新å»ÞZ¸¤ä¸ªxmlæ–‡äšgmaster.xml,chap1.xml.˜q™é‡Œç”¨åˆ°äº†docbook的物理分割概å¿?ž®±æ˜¯æŠŠå•ä¸ªæ–‡æ¡£æ‹†åˆ†æ–‡æ¡£äØ“å¤šä¸ªæ–‡äšg,˜q™åœ¨æ–‡æ¡£æ¯”较巨大的时候很实用.
master.xml是文档主文äšg,内容如下:
<?xml version='1.0' encoding="utf-8"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>光子的第一本Docbook�/span></title>
<xi:include href="chap1.xml"/>
</book>

chap1.xml是文档的½W¬ä¸€ç«?内容如下:
<?xml version='1.0' encoding="utf-8"?>
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN"
  xmlns:xlink
="http://www.w3.org/1999/xlink" id="ch1" xmlns:xi="http://www.w3.org/2001/XInclude">

    
<title>光子的第一½‹‡Docbook 5.0文档</title>
                  
  
<section>   
    
<title>½W¬ä¸€ç« æ ‡é¢?/span></title>
    
<para>
      ˜q™æ˜¯å…‰å­çš„第一½‹‡Docbook 5.0文档åQŒæˆ‘çš„BLOG
<link xlink:href='http://www.aygfsteel.com/kuuyee/'>光子CI之旅</link>ã€?br />     </para>
  
</section>
</chapter>

ok,我们可以发布文档äº?没错!ž®±æ˜¯˜q™ä¹ˆ½Ž€å?在项目根目录˜qè¡Œå‘½ä×o
mvn clean package

如果大家不明白可以下载附件源码看çœ?样式˜q˜æ˜¯ä½¿ç”¨jbossçš?不过可以自己修改xsl!
样例代码

贴张囄¡œ‹çœ‹ç”Ÿæˆçš„æ–‡æ¡£,呵呵!








]]>
maven-tomcat-plugin试用http://www.aygfsteel.com/kuuyee/archive/2009/07/21/287639.htmlkuuyeekuuyeeTue, 21 Jul 2009 06:13:00 GMThttp://www.aygfsteel.com/kuuyee/archive/2009/07/21/287639.htmlhttp://www.aygfsteel.com/kuuyee/comments/287639.htmlhttp://www.aygfsteel.com/kuuyee/archive/2009/07/21/287639.html#Feedback0http://www.aygfsteel.com/kuuyee/comments/commentRss/287639.htmlhttp://www.aygfsteel.com/kuuyee/services/trackbacks/287639.html
<properties>
    
<!-- Cargo settings -->
    
<cargo.container.manager.url>http://192.168.1.107/manager</cargo.container.manager.url>
    
<cargo.container.username>admin</cargo.container.username>
    
<cargo.container.password>123456</cargo.container.password>
    
<cargo.wait>false</cargo.wait>
</properties>
<build>
    
<plugins>
        
<plugin>
            
<groupId>org.codehaus.mojo</groupId>
            
<artifactId>tomcat-maven-plugin</artifactId>
            
<version>1.0-beta-1</version>
            
<configuration>
                
<path>/runes</path>
                
<url>${cargo.container.manager.url}</url>
                
<username>${cargo.container.username}</username>
                
<password>${cargo.container.password}</password>
                
<warDirectory>${basedir}/src/main/webapp</warDirectory>
            
</configuration>
            
<executions>
                
<execution>
                    
<id>tomcat-deploy</id>
                    
<phase>deploy</phase>
                    
<goals>
                        
<goal>deploy</goal>
                    
</goals>
                
</execution>
                
<!--execution>
                                <id>undeploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution
-->
            
</executions>
        
</plugin>
    
</plugins>
</build>
maven-tomcat-plugin通过tomcatçš„manager控制台来deploy或undeploy应用,所以要把你的tomcat的相关信息配¾|®ä¸Š,包括manager url,用户名及密码½{?

]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º °²ÏçÏØ| È«ÖÝÏØ| ºÓ¼äÊÐ| ÑŰ²ÊÐ| Ê©µéÏØ| ÅͰ²ÏØ| ÆîÑôÏØ| ÄþÑôÏØ| ÁúÖÝÏØ| Ïç³ÇÏØ| º¼½õºóÆì| ×ÊÐËÊÐ| ÆîÑôÏØ| ÐÂÉÛÏØ| ²ìÑÅÏØ| ¶·ÁùÊÐ| ƽ°²ÏØ| ÔÆÄÏÊ¡| ¼âÔúÏØ| ±±íÕÇø| ´ó×ãÏØ| Ê¯Ì¨ÏØ| À¼Î÷ÏØ| ¾°Äþ| °²Î÷ÏØ| Û³ÁêÏØ| ·¨¿âÏØ| ±ÈÈçÏØ| ³ØÖÝÊÐ| ÇçÂ¡ÏØ| µÂÐËÊÐ| ¹ãºÓÏØ| аͶû»¢ÓÒÆì| ÓÚ¶¼ÏØ| ƽÂÞÏØ| ¿âÂׯì| µç°×ÏØ| Çø¡£| Îå¼ÒÇþÊÐ| ÕþºÍÏØ| ¿ËÉ½ÏØ|