ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>久久免费国产精品1,午夜精品久久久久久,亚洲视频狠狠http://www.aygfsteel.com/steeven/category/6473.htmlzh-cnWed, 28 Feb 2007 01:07:53 GMTWed, 28 Feb 2007 01:07:53 GMT60db4oåQŒæ²¡æœ‰ä¸»é”®ï¼Ÿhttp://www.aygfsteel.com/steeven/archive/2006/06/19/53836.htmlsteevensteevenMon, 19 Jun 2006 10:15:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/06/19/53836.htmlhttp://www.aygfsteel.com/steeven/comments/53836.htmlhttp://www.aygfsteel.com/steeven/archive/2006/06/19/53836.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/53836.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/53836.htmldb4o目前˜q˜æ²¡æœ‰unique index/primary key机制ã€?5.4)

     public   static   void  main(String[] args)  {
        ObjectContainer db 
=  Db4o.openFile( " test.yap " );
        db.set(
new  User( " abc " , 234 ));
        db.set(
new  User( " abc " , 234 ));
        ObjectSet
< User >  list  =  db.query(User. class );
        System.out.println(list);
        db.close(); 
// halt without this line in 5.2
    }

上面的例子会存储两个同样的User对象ã€?br />仅有的ID是一个存储文件中的ID, ¾lè¿‡¼„Žç‰‡æ•´ç†ä¹‹åŽä¼šå‘生变化,昄¡„¶ä¸é€‚用ã€?br />要实çŽîC¸€ä¸ªauto_increament的主键恐怕要自行实现。或者用已有的UUID实现ã€?br />
可能db4o太年è½Èš„关系åQŒç›®å‰è¿˜æ²¡æœ‰æ”¯æ´˜q™äº›åŠŸèƒ½ã€‚å¾è®®ç”¨@Annotationæ¥å®žçŽ°ã€‚åÆˆä¸”æŽ§åˆ¶å­˜å‚¨ã€?br />@ID
@Unique
@Index
在EJB3里面已经有现成的定义可以参考�img src ="http://www.aygfsteel.com/steeven/aggbug/53836.html" width = "1" height = "1" />

]]>
CSDN Java沙龙上æ“v‹zÕdЍhttp://www.aygfsteel.com/steeven/archive/2006/06/07/51224.htmlsteevensteevenWed, 07 Jun 2006 15:44:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/06/07/51224.htmlhttp://www.aygfsteel.com/steeven/comments/51224.htmlhttp://www.aygfsteel.com/steeven/archive/2006/06/07/51224.html#Feedback4http://www.aygfsteel.com/steeven/comments/commentRss/51224.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/51224.html
零星è®îCº†ä¸€äº›ç¬”讎ͼŒå¯ÒŽˆ‘˜q™ä¸ªajax门外汉来说收莯‚¿˜æ˜¯å¾ˆå¤§ã€‚主讲是ajaxcn.org的两位高手。robbinçš„Rubby讲åñ”å› äØ“æ—‰™—´å…³ç³»è¦æ”¹æœŸã€?br />
1. JS2的一些新ç‰ÒŽ€§ï¼šclass/extend/interface/package/import/块作用域/操作½W¦å‡½æ•? 明年底会有browser开始支持ã€?br />//òq²è„†æŠŠjava直接搬到browser里面½Ž—了ã€?br />//以后是不是弄个标准接口允许加载不同语­a€çš„脚本引擎?大家ž®×ƒ¸ç”¨å—js的鸟气了ã€?br />2. 推荐的ajax框架åQšDojo/DWR/Prototype/GWT/YUI
//排名有先�br />3. 新技术:
canvas ç”Õd›¾åQŒå·²æœ‰å¤šæ•°æµè§ˆå™¨æ”¯æŒã€‚据说有人用它实çŽîCº†3D游戏
SVG åŸÞZºŽxml的矢量图。据说和canvas都支æŒ?d¾l˜å›¾ã€?br />E4X: xml的包è£? firefox支持
4. 技术和需求水涨船é«?//我们不会å¤×ƒ¸šäº?br />5. HiJax:
用传¾lŸæ–¹å¼å¿«é€Ÿå¼€å‘。在传统¾|‘页基础上hack成ajax应用ã€?br />对禁用js的浏览器表现ä¸ÞZ¼ ¾lŸç½‘™åüc€?br />前期开发和后期攚w€ ç‹¬ç«‹æ€§å¾ˆå¼ºã€?br />//åŽæœŸè¦æ”¹é€ äØ“å®Œç¾Žçš„ajaxåQŒå¯¹server端要做些ž®çš„æ”¹åŠ¨æ¥é€‚åº”ã€?br />6. 推荐用FireFox调试AJAX, 插äšg三剑客:
firebug/web develope tool/temper data分别用来调试脚本åQŒè§‚察页面domåQŒç›‘听通信ã€?br />//js调试的日子好˜q‡å¤šäº†ï¼Œä½†ä¸è¦å¿˜è®°æ€ÖM½“效率。。ã€?br />
回来路上和一位tx聊è“v来ajax在企业中的地位好像不高,他对敏捷开发很有好感,对办公室环境的要求很有趣ã€?br />本次‹zÕdŠ¨çš„ä¸»è¦å¿ƒå¾—æ˜¯åQšè‡ªåŠ©é¤å¾ˆå¥½åƒï¼Œä»¥åŽæœ‰æ´»åŠ¨è¿˜è¦åŽ»å?:)

]]>
gwtå’Œecho2的对æ¯?/title><link>http://www.aygfsteel.com/steeven/archive/2006/06/01/49502.html</link><dc:creator>steeven</dc:creator><author>steeven</author><pubDate>Thu, 01 Jun 2006 03:32:00 GMT</pubDate><guid>http://www.aygfsteel.com/steeven/archive/2006/06/01/49502.html</guid><wfw:comment>http://www.aygfsteel.com/steeven/comments/49502.html</wfw:comment><comments>http://www.aygfsteel.com/steeven/archive/2006/06/01/49502.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/steeven/comments/commentRss/49502.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/steeven/services/trackbacks/49502.html</trackback:ping><description><![CDATA[ <p>前面转脓Liebeck(echo的主要开发者,我的偶像)关于echo2å’Œgwt的对æ¯?http://www.aygfsteel.com/steeven/archive/2006/06/01/49379.html<br /><br />今天仔细做了一些笔讎ͼŒòq¶ä¸”加入了一些自å·Þqš„æƒÏx³•åQŒä¾›é€‰åž‹è€…参考:<br /><br />¾l¼åˆå¯Òޝ”åQ?br />1. 两个都是非传¾lŸçš„b/s框架åQŒéƒ½æ˜¯ç”¨AJAX来构造动态网站。编½E‹è¿‡½E‹éƒ½å’ŒSWT/Swing差不多ã€?br />2. 区别在于一个运行于客户端,一个运行于服务å™?/p> <div>3. gwtæŠŠä»£ç ç¼–è¯‘äØ“html+js, 目前只支持java1.4规范。echo没这限制ã€?/div> <div>4. gwt可以˜qè¡ŒäºŽä“Q何web server, echo则需要传¾lŸçš„servlet容器。(意义不大åQŒçŽ°åœ¨å“ªæœ‰é™æ€ç½‘ç«™å•ŠåQŒåŽåîCº¤äº’肯定还是需要的åQ?/div> <div>5. echo2的客æˆïL«¯å¼•擎通过ajax提交用户动作åQŒå¯¹ç”¨æˆ·ç•Œé¢å¢žé‡æ›´æ–°ã€?/div> <div> </div> <div>性能åQ?/div> <div>1. gwt的页面logic都在‹¹è§ˆå™¨ä¸ŠåQŒæ‰€ä»¥å¾ˆå¿«ã€‚但是如果需要和中间层交互,ž®×ƒ¼š¼„°åˆ°åŒæ ·çš„网¾lœé—®é¢˜ã€?/div> <div>2. echo2的代码跑在server上,所以所有的交互都需要反馈给server。echo2在设计上ž®½é‡å‡å°‘˜q™ç§äº¤äº’åQŒæ¯”如客户对文本的修攚wƒ½æ˜¯åšg˜qŸå‘送到服务å™?而服务器只发送页面的变化部分到浏览器ã€?/div> <div>3. gwt应用被编译成一个页面,虽然应用的复杂化åQŒè¿™ä¸ªç¼–译结果也随之变得可怕。。ã€?个ähè®¤äØ“éšç€¾~–译器的发展åQŒä¸åŒçš„™åµé¢å¯ä»¥åšåˆ°lazy load)</div> <div>4. echoçš„js模块是lazy加蝲到浏览器的,界面上呈现哪些控件才åŽÕdŠ è½½åÆˆä¸”ç¼“å­˜å¯¹åº”çš„js模块。发送到客户端的不是逻辑代码åQŒåªæœ‰ç”¨æˆïLŠ¶æ€ï¼ˆä¸ªähè®¤äØ“echo2现在˜q‡äºŽlazyåQŒå¯¼è‡´åˆå§‹åŒ–阶段多次讉K—®server加蝲一些基本的js模块åQŒåº”该揉合到一赗÷€‚å¦å¤–ï¼Œå› äØ“echo逻辑代码在服务器上,相对来说可以防止盗版åQ?/div> <div> </div> <div>中间层和数据讉K—®åQ?/div> <div>1. 如果要访问数据,gwt˜q˜æ˜¯è¦å›žåˆîC¼ ¾lŸçš„æ¨¡å¼åQŒé€šè¿‡rpc讉K—®servlet。gwt提供把远½E‹æœåŠ¡é€æ˜Žçš„åŒ…è£…è“v来,中间传送pojo. ž®½ç®¡åŒ…装了,中间的安全和和校验还是必™å»è¦å¼€å‘者考虑ã€?/div> <div>2. echo支持SOAåQŒä½†æ˜¯ä¸å¿…é¡»ã€‚å¤§å¤šæ•°æƒ…å†µä¸‹å®‰å…¨ä¸æ˜¯é—®é¢˜ï¼Œå› äØ“æ•°æ®å’Œé€»è¾‘éƒ½ä¸ä¼šæš´éœ²åˆ°‹¹è§ˆå™¨ä¸Šã€?以前¾l™echoæè¿‡å»ø™®®åQŒæµè§ˆå™¨ç”¨æˆ·å¾ˆå¯èƒ½åŽ»æ¨¡æ‹Ÿä¸€ä¸ªè¢«disabled按钮提交åQŒè¿™¿Ué—®é¢˜çŽ°åœ¨æ— éœ€è€ƒè™‘åQ?/div> <div> </div> <div>˜qè¡ŒçŽ¯å¢ƒåQ?/div> <div>1. gwt˜qè¡Œåœ¨æµè§ˆå™¨ä¸Šï¼Œòq‰™žæ‰€æœ‰çš„java¾c»éƒ½èƒ½ç¼–译成js. gwt现在只支持java.lang/java.util下面的一个子é›?版本 1.0.21)åQ?7 classes, 11 interfaces, and 18 exception(˜q™è®©äººæƒ³èµ·äº†j2meå¼€å?. 一些现有的¾cÕdº“ž®±åˆ«æƒ³äº†ã€?/div> <div> </div> <div>调试åQ?/div> <div>1. gwt调试需要一套和˜qè¡Œæ—¶å®Œå…¨ä¸åŒçš„环境åQšHOST模式åQŒä»£ç ä½œä¸ºçœŸæ­£çš„java在运行ã€?个ähè®¤äØ“˜q™é‡Œå› äؓ是纯java调试åQŒæ¯”echoçš„web调试要稍微方便一些。做单元‹¹‹è¯•也更方便些,但不是对最¾lˆbrowser的测试)</div> <div>2. echo调试ž®±æ˜¯ä¼ ç»Ÿçš„servlet调试ã€?/div> <div> </div> <div>授权åQ?/div> <div>1. gwtçš„api是开源的åQŒç¼–译器和host模式‹¹è§ˆå™¨ä¸å…¬å¼€ã€‚整体来è¯ß_¼šfree. åQˆä¸ªäºø™®¤ä¸ºï¼Œå¦‚果要扩充gwt可能会遇到麻烦)</div> <div>2. echo2开源,mozilla public license. free(个ähè®¤äØ“åQšechostudio也freež®±å¥½äº†ã€‚nextapp毕竟要生存)</div> <div> </div> <div>应用åQ?/div> <div>1. gwt可以嵌入传统的静态html, ä¹Ÿèƒ½ä½œäØ“ä¸€ä¸ªå®Œæ•´åº”ç”¨ã€‚åšå¤§åº”ç”¨è¦è€ƒè™‘¾~–译后的重量、本地化、库支持½{‰é—®é¢˜ï¼ˆå…³äºŽ18n, 可以在gwt支持论坛上搜索i18n,ä¼ég¹Žå·²ç»æœ‰æ–¹æ¡ˆï¼‰</div> <div>2. echo2成熟得可以适用各种应用åQŒä½†æ˜¯ä¸èƒ½ä½œä¸ºé™æ€é¡µé¢çš„一部分使用。(有点吹牛åQŒåœ¨å¤§è®¿é—®é‡ä¸‹ï¼ŒæœåŠ¡å™¨çš„åŽ‹åŠ›è‚¯å®šä¸ä¼šž®ï¼‰</div> <div> </div> <div> </div> <div> </div> <div> <div>个äh¾l“论åQ?br />1. 开发方式都很优¿U€åQŒç”¨¾U¯java开发b/s<br />2. gwt可用于大型网站,把压力è{嫁给客户端ã€?br />3. echo可用于快速开发复杂的企业应用åQŒæŠŠåŽ‹åŠ›ä¸¢ç»™æœåŠ¡å™?企业里面最清闲的就是前台和服务å™?<br /><br />两个产品都很优秀åQŒGWTæ˜?006òq´çš„IT飓风åQŒæ‡L及后面几òq´ã€‚M$的日子要难过äº? GOOGLE的确是个令äh头痛的对手ã€?br /><div><br />然而,˜q˜æœ‰æ¯”gwt/echo2更美好的未来吗?</div><div>有!把他们的输出变成flashåQŒç”¨java开发flash应用。去òq´æŽ¢ç´¢è¿‡ä¸€ŒD‰|—¶é—ß_¼ŒåŽŸåž‹å·²ç»å‡ºæ¥åQŒå› ä¸ºflash开发调试太ugly, 没有¾l§ç®‹ä¸‹åŽ»ã€?br />另外åQŒå¾®è½¯çš„WPF(AVALON)相当值得å…Ïx³¨ã€?br /></div></div> </div> <img src ="http://www.aygfsteel.com/steeven/aggbug/49502.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/steeven/" target="_blank">steeven</a> 2006-06-01 11:32 <a href="http://www.aygfsteel.com/steeven/archive/2006/06/01/49502.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转脓åQšComparing the Google Web Toolkit to Echo2 http://www.aygfsteel.com/steeven/archive/2006/06/01/49379.htmlsteevensteevenWed, 31 May 2006 16:55:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/06/01/49379.htmlhttp://www.aygfsteel.com/steeven/comments/49379.htmlhttp://www.aygfsteel.com/steeven/archive/2006/06/01/49379.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/49379.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/49379.html Google Web Toolkit 虽然˜q˜æ˜¯beta版本åQŒå’Œgoogle的其他äñ”å“ä¸€æ øP¼Œåˆšå‡ºç”Ÿå°±æ³¨å®šä¸å‡¡åQŒä¹Ÿè®¸å°†å½±å“åŽé¢å‡ å¹´çš„b/s开发ã€?br />
gwt利用了java开发的一切成熟条ä»Óž¼ŒåŒ…括Unit test, refactor, IDE(eclipse...)åQŒä¼ ¾lŸçš„b/s framework必将受到重创åQŒæ¨ªæ‰«è¿‡åŽï¼ŒJSF/ECHO½{‰Server side framework可能òq¸å­˜ã€‚如果哪天google加上serverside支持åQˆä»ŽåŒ…命名上看是留有余地的)。。。虽然gwt目前˜q˜æ˜¯ž®æ ·ä¸€ä¸ªï¼Œä½†æ˜¯èƒŒåŽç«™çš„æ˜¯é‡é‡çñ”çš„googleåQŒå¼ºå¤§çš„资源和数不完的银子。。。ã€?br />
看到˜q™çŽ©æ„é¦–å…ˆæƒ³åˆ°çš„æ˜¯echo2, 客户端技术都是ajax, ¾~–码都是java. 不同的是gwt发行时编译成HTML+JSåQŒEcho2则是完全的服务器端生æˆ?更新。gwtè·Ÿserver端交互依靠类ä¼égºŽwsçš„service把前后台完全区分开ã€?br />
在echo的论坛里面已¾læœ‰äººåœ¨è®¨è®º˜q™çŽ©æ„äº†åQŒåƈ且八卦了一下gwt的前íw«ä¼¼ä¹Žæ˜¯Morfik的一部分åQˆå¾…证实åQ?br />从原理上åQŒecho的开发者作å‡ÞZº†å¯Òޝ”åQŒè¿™ä¸ªç½‘站似乎被ž®é”åQŒè¿™é‡Œè{贴一ä¸?


åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQï¼åQ?br />http://echotwo.blogspot.com/ 作者tod liebeck

Comparing the Google Web Toolkit to Echo2
The Google Web Toolkit (GWT) is being compared to Echo2 quite frequently. Some of these comparisons have been fairly accurate, while others contain bits of misinformation. This article, written by the lead developer of Echo2, discusses the similarities and differences between these two frameworks.

Overview

The Google Web Toolkit and Echo2 definitely make for an interesting comparison. Both of these frameworks take a non-traditional approach toward web application development, even considering the latest crop of "AJAX-based frameworks" available today.

The most obvious similarity between GWT and Echo2 is that they both enable the developer to create dynamic, AJAX-driven web user interfaces using only Java. In both projects, UIs are developed in a fashion similar to SWT or Swing: by assembling hierarchies of components and registering event handlers. Neither project requires the developer to work with HTML, JavaScript, or XML.

The most obvious difference between GWT and Echo2 is that all of your GWT code is executed on the client, whereas your Echo2 code is executed on the server. There are advantages and disadvantages to both of these approaches, which will be highlighted throughout the article.

GWT's defining attribute is the Java-to-JavaScript compiler. This compiler allows you to develop the web interface to your application in Java, then compile it to JavaScript. GWT limits the developer to a subset of the Java 1.4 libraries. GWT applications can be served by any web server, such as Apache, without the need for server-side processing.

Echo2 applications are compiled to Java byte code and run on a Java server. Their Java code is executed by Echo2's "Web Application Container" layer, which sits atop a Java Servlet. On the web browser, the Echo2 "Client Engine" communicates user input to the Web Application Container via AJAX requests, with the server responding with directives to perform incremental updates to the state of the client web browser.

User Interface Performance

With GWT, all of your user interface code exists on the client browser. In operations that do not require server communication--that is, that do not require retrieving data from the middle tier--this configuration results in response times that are not dependent on the server. When data must be retrieved from the application's middle tier or business logic layer, the response time is subject to the same criteria as any other AJAX application, i.e., network latency, bandwidth, and server performance.

Echo2 application code is run on the server, so for each user interaction that requires a call to the middle tier or immediate execution of the application's Java code, an AJAX connection is made to the server. Echo2 components are designed to minimize the client/server communication as much as is possible, limiting it to times when the server must be notified immediately of events. For example, simple events such as user input to a TextField component will not result in server contact. The server's response is the minimum set of instructions to incrementally update the client to reflect the new screen state.

GWT applications are served to the client as a single HTML/JavaScript file, containing the entirety of the user interface. The size of this file will be proportional to the size of your user interface code and the toolkit libraries used by your application.

Echo2 JavaScript modules are lazy-loaded to the client, and thereafter cached. A module will be retrieved when a component first appears on-screen that requires it. Application code is never sent to the client, only the state of the user interface.

Middle Tier / Data Retrieval

To access business data or perform a business process, a GWT user interface makes a remote procedure call (RPC) from the browser to a Servlet. GWT provides a mechanism to make the RPC invocation transparent to the developer, allowing the developer to build the application with "Plain Old Java Objects" (POJOs). However, any application that provides an RPC capability is a distributed application -- even when the RPC is accomplished transparently to the developer. Distributed applications in businesses and enterprises usually have security considerations and the remote objects serving the GWT clients must be designed with a focus on security to deflect attacks from imitated or hostile client applications.

Echo2 applications support, but do not require, the use of distributed application logic or a Service Oriented Architecture (SOA). Alternatively, Echo2 applications can be built to run entirely within a single JVM instance, backed by a POJO-based middle tier. This allows Echo2 developers to build applications without the security concerns of distributed application logic -- and leverage the many strong frameworks built around POJO development such as the Spring Framework and Hibernate. Echo2 accomplishes this by keeping the state of a user's web interface on the server so that no remote objects need to be exposed.

Run-time Environment

GWT has some limitations due to the fact that applications are run on the client browser. First, GWT applications are limited to using a subset of the core Java class libraries, consisting of 27 classes, 11 interfaces, and 18 exception types found in the java.util and java.lang packages (as of GWT 1.0.21). This limitation prevents GWT applications from linking to most existing Java libraries. Additionally, all Java code must be compliant with the Java 1.4 specification; 1.5 is not supported. Localization-related portions of the Java API are not provided.

Debugging

GWT provides an alternate deployment environment for applications to facilitate debugging. The environment, called "Hosted Mode", allows a GWT application to be run as Java byte code in a local JVM, to which an IDE's debugger can be connected. In this mode, the application's user interface is displayed in a special web browser (a Mozilla/Firefox derivative).

Echo2 applications may be debugged in the conventional manner, by connecting an IDE's debugger to a JVM running a Servlet container.

Licensing

The primary component of GWT, the Java-to-JavaScript cross-compiler, is proprietary, binary-only software. The Java API libraries are open source software, distributed under the Apache License. The API libraries have essentially no value without the proprietary compiler. The (non-critical) hosted-mode browser is also under the proprietary license. GWT is provided free of charge.

Echo2 is open source software, licensed under the Mozilla Public License, and provided free of charge.

Applicability

GWT can be used as a means of creating AJAX components to embed in traditional web applications (or even in static web pages) as well as for creating complete application user interfaces. There are some issues to using it for the creation of large applications, where downloading an entire application to a client web browser in one shot would not be practical. The lack of localization and full Java API support also presents a problem for larger solutions.

Echo2 is practical for creating web applications of any size. It is however not intended to scale downward to function as a platform for simply creating AJAX components in traditional web frameworks (or static web sites).

More Information

Google Web Toolkit:
Home Page, Example Applications, Getting Started Guide, Developer Guide

Echo2:
Home Page, Example Applications, Tutorial
posted by Tod Liebeck at 5:13 AM | 0 comments  

======================================
毕竟gwt˜q˜æ˜¯ž®baby, 以后怎么发展˜q˜éš¾è¯ß_¼ŒçŽ°åœ¨ä¸‹ç»“è®ºå¤ªæ—©ã€‚è¿™ä¸¤å¤©è¯•ç”¨ä¸€ä¸‹ï¼Œæœ‰ç©ºä»Žç»†èŠ‚ä¸Šå¯Òޝ”一下ã€?br />



]]>
EMF之ResourceSet探烦(4)http://www.aygfsteel.com/steeven/archive/2006/05/26/48271.htmlsteevensteevenFri, 26 May 2006 02:22:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/26/48271.htmlhttp://www.aygfsteel.com/steeven/comments/48271.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/26/48271.html#Feedback1http://www.aygfsteel.com/steeven/comments/commentRss/48271.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/48271.html‹¹‹è¯•一下getResource(URI,boolean):

        System.out.println(EcorePackage.eINSTANCE.eResource());  // 1
        System.out.println(XMLTypePackage.eINSTANCE.eResource());  // 2

        ResourceSet rs 
=   new  ResourceSetImpl();
        rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
                Resource.Factory.Registry.DEFAULT_EXTENSION,
                
new  XMIResourceFactoryImpl());
        String uri 
=   " http://abc.eg/asdf " ;
//         System.out.println(rs.createResource(URI.createURI(uri)));  //  如果创徏˜q‡äÍæ—¶çš„åQŒå¾—到这ä¸?br /> //         System.out.println(rs.createResource(URI.createURI(uri)));  //  如果创徏˜q‡å¤šä¸ªäÍæ—¶çš„åQŒè¿”回第一个,˜q™ä¸ªå¿½ç•¥
        rs.getPackageRegistry().put(uri, EcorePackage.eINSTANCE);  // 得到¾l“æžœå?,如果上面取消注释åQŒæœ¬åœ°åˆ›å»ºçš„优先

        System.out.println(rs.getResource(URI.createURI(uri), 
false ));  // �


createResource每次创徏新的åQŒgetResource则是唯一实例的ã€?/p>

每个生成的XxxPackage.eINSTANCEä¼šè‡ªè¡Œåˆ›å»ø™‡ªå·Þqš„Resource。如果在插äšg中修改了EcorePackge.eInstance.eResource()åQŒä¼šä¸ä¼šå¤©ä¸‹å¤§äؕ呢?

==================
eclispe¾~–辑器右边的Mark Occurrence很方便,但是安™‡Œç”µè„‘上的˜q™ä¸ªé»„色ž®æ ‡è®°å¾ˆä¸æ¸…楚。前几天调整了老半天,修改配色æ–ÒŽ¡ˆåQŒæ¢æ˜„¡¤ºå™¨é©±åŠ¨ï¼Œè°ƒæ•´æ˜„¡¤ºå™¨å¯¹æ¯”度、亮度都收效不大。昨天偶然把XP的桌面风格换回传¾lŸæ¨¡å¼ï¼Œæžå®šäº†ã€?/p>

ecore.ecore˜q™ä¸ªé—®é¢˜å¾ˆæœ‰æ„æ€ï¼Œä»¥å‰çœ‹è¿‡schema.xsdåQŒå°±æ˜¯è‡ªå·±å®šä¹‰è‡ªå·±ã€‚据说JDK也是用java开发编译出来的。。ã€?br />先有鸡还是现有蛋呢?



]]>
EMF之ResourceSet探烦(3) http://www.aygfsteel.com/steeven/archive/2006/05/26/48249.htmlsteevensteevenThu, 25 May 2006 17:23:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/26/48249.htmlhttp://www.aygfsteel.com/steeven/comments/48249.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/26/48249.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/48249.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/48249.html在RS中同一URI可以createResource多个ResourceåQŒList方式存放。还存在另外一¿UMap存放方式, getResource(URI,boolean loadOnDemand)ž®±æ˜¯é€šè¿‡˜q™ç§æ–¹å¼å­˜å–åQŒå¦‚果不存在的话创徏。这两个æ–ÒŽ³•看è“v来有些冲½Hã€‚似乎用于不同场合ã€?br />
再来看看怎样通过URL存取EObject:
RS整个相当于一个DataBase, Resource相当于表åQŒå­˜æ”„¡š„是EObject, 每个EObject可以看成对象或者XMLã€?br />表用URI来区分,URI中的Segment用来定位EObject。URI的例子参见探ç´?1)
getEObject(URL, boolean loadOnDemand)很简单,getResource扑ֈ°å¯¹åº”çš„Resource,在里面根据Segment查找åQŒå°±æ˜¯é‚£ä¸?a href="mailto:#///@xxx.n">#///@xxx.n格式的东西,注意åQŒè¿˜æœ‰ID方式ã€?br />
getPackageRegistry()用来˜q”回RSçš„URL->Package注册表,它也是个本地的注册表åQŒä»£ç†äº†å…¨å±€çš„EPackage.Registry.INSTANCE。这个注册表用于取得EPackageåQˆç±»åž‹ä¿¡æ¯ï¼‰å’ŒEFactoryåQˆåˆ›å»ºå®žä¾‹ï¼‰


Resourcež®×ƒ¸è¯´äº†åQŒä¸»è¦load,save, 一些具体子¾c»ï¼Œæ¯”如XmlResourceImpl可以直接使用åQŒæŒ‡å®šEncoding之类ã€?br />
看看ResourceSet对EMF了解了很多~



]]>
EMF之ResourceSet探烦(2) http://www.aygfsteel.com/steeven/archive/2006/05/26/48242.htmlsteevensteevenThu, 25 May 2006 16:02:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/26/48242.htmlhttp://www.aygfsteel.com/steeven/comments/48242.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/26/48242.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/48242.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/48242.html1. getResourceFactoryRegistry()
  public Resource.Factory.Registry getResourceFactoryRegistry()
  
{
    
if (resourceFactoryRegistry == null)
    
{//可以自行Set一个注册表实现åQŒæ²¡æœ‰çš„话用¾pȝ»Ÿ¾~ºçœæ³¨å†Œè¡?/span>
      resourceFactoryRegistry =
        
new ResourceFactoryRegistryImpl()
        
{
          
public Resource.Factory delegatedGetFactory(URI uri)
          
{
            
return Resource.Factory.Registry.INSTANCE.getFactory(uri);
          }

        }
; //代理¾pȝ»Ÿæ³¨å†Œè¡¨ï¼Œæ³¨æ„˜q™ä¸ªåº”该是正宗的ã€?/span>
    }

    
return resourceFactoryRegistry;
  }

所以自己new 出来的ResourceSet可以向注册表中ä“Q意添加工厂实现ã€?br />2. 调用注册表的getFactory(URI), 实现如下åQ?br />
 public Resource.Factory getFactory(URI uri)
  
{
    String protocol 
= uri.scheme();
    Object resourceFactory 
=  protocolToFactoryMap.get(protocol); //先根据protocol查找
    if (resourceFactory == null)
    
{
      String extension 
= uri.fileExtension();
      resourceFactory 
= extensionToFactoryMap.get(extension); //找不到再æ ÒŽ®æ‰©å±•名查æ‰?/span>
      if (resourceFactory == null)
      
{
        resourceFactory 
= extensionToFactoryMap.get("*"); //ž®è¯•查找¾~ºçœæ‰©å±•
        if (resourceFactory == null)
        
{
          resourceFactory 
= delegatedGetFactory(uri); //自行实现可以扩展此方法解析�/span>
        }

      }

    }


    
//Descriptor可以用于¾~–程使用
    return 
      resourceFactory 
instanceof Resource.Factory.Descriptor ?
        ((Resource.Factory.Descriptor)resourceFactory).createFactory() :
        (Resource.Factory)resourceFactory;
  }

æŸ¥æ‰¾ä¸€ä¸ªå·¥åŽ‚å±…ç„¶è¿™ä¹ˆå¤æ‚ï¼æ­£å› ä¸ø™¿™ä¹ˆå¤æ‚,才能支持platform/file/fttp½{‰ä¼—多千奇百怪的URI
不同¾cÕdž‹çš„工厂加工出不同¾cÕdž‹çš„Resource, 才会输出为XSD/XML/XMI/....

如果直接操作¾pȝ»Ÿæ³¨å†Œè¡¨è¦ž®å¿ƒã€‚EMF中定义了几个扩展点,可以实现¾cÖM¼¼ç›®çš„ã€?br />已知的ResourceFactory实现有:XSD/ECore/EMOF/XML/XMIåQŒXSD的输出方法的介绍可以参考Eclipse Development using the Graphical Editing Framework and the Eclipse Modeling Framework电子书ã€?br />




]]>
EMF之ResourceSet探烦(1)http://www.aygfsteel.com/steeven/archive/2006/05/25/48229.htmlsteevensteevenThu, 25 May 2006 14:40:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/25/48229.htmlhttp://www.aygfsteel.com/steeven/comments/48229.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/25/48229.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/48229.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/48229.html先看看现象,以EMF例子Library.ecoreä¸ÞZ¾‹, ‹¹‹è¯•代码如下åQ?br />
public class Test {
    
public static void main(String[] args) throws IOException {
        ResourceSet rs 
= new ResourceSetImpl();
        rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
                Resource.Factory.Registry.DEFAULT_EXTENSION,
                
new XMIResourceFactoryImpl()); //outside eclipse
        Resource resource 
= rs.createResource(URI
                .createURI(EXTLibraryPackage.eNS_URI));
        
//step a
        Library library = EXTLibraryFactory.eINSTANCE.createLibrary();
        library.setName(
"some lib");
        resource.getContents().add(library);
        
//step b
//        Book book = EXTLibraryFactory.eINSTANCE.createBook();
//        book.setTitle("some book");
//        Employee employee = EXTLibraryFactory.eINSTANCE.createEmployee();
//        employee.setFirstName("some one");
        
//step c
//        library.getBooks().add(book);
//        library.getEmployees().add(employee);
        
//step d
//        resource.getContents().add(book);
    
//        System.out.println(EcoreUtil.getURI(employee));
//        System.out.println(EcoreUtil.getURI(book));
        resource.save(System.out, null);
    }

}


步骤 输出
a ----------------
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib"/>
b #//
#//
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib"/>
c http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#//@employees.0
#//
<?xml version="1.0" encoding="ASCII"?>
<extlib:Library xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0" name="some lib">
  <employees firstName="some one"/>
</extlib:Library>
d http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#/0/@employees.0
http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0#/1
<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http:///org/eclipse/emf/examples/library/extlibrary.ecore/1.0.0">
  <extlib:Library name="some lib">
    <employees firstName="some one"/>
  </extlib:Library>
  <extlib:Book title="some book"/>
</xmi:XMI>

可以看到åQŒæ²¡æœ‰åŠ å…¥lib的时候,employee/book实例的URI都是#//, employee加入以后有了#//@employees.0, book依旧ã€?br />在book加入resource以后有了#/1çš„URI, employee/book在containment定义分别是true,falseåQŒæ‰€ä»¥employee加入lib以后ž®±éšlib加入resourceåQˆå®žä¾‹å®¹å™¨ï¼‰ã€‚book则要单独加入ã€?br />
另外一个有­‘£çš„现象是Resource可以容纳多个实例åQŒåœ¨step d可以看到输出的根节点由lib变成匿名容器ã€?br />
如果lib不加入resource又如何呢åQ?br />
步骤 输出
a ----------------
b #//
#//
c #///@employees.0
#//
d ----------------
没加入resource之前åQŒURI是未知的åQŒçŸ¥é“的只是相对父节点的相对segment.



]]>
EMF验证扩展åQšè‡ªå®šä¹‰éªŒè¯è§„则http://www.aygfsteel.com/steeven/archive/2006/05/19/47107.htmlsteevensteevenFri, 19 May 2006 11:03:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/19/47107.htmlhttp://www.aygfsteel.com/steeven/comments/47107.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/19/47107.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/47107.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/47107.htmlå› äØ“æ¯”è¾ƒž®‘,所以这里æ€È»“一下ã€?br />
验证的定义有两种方式åQ?br />1. 生成验证æ–ÒŽ³•框架åQŒä»£ç è‡ªå·±å®žçŽ°ã€‚å‚è§?a >EMF Overview:
  æ·ÕdŠ Annotatio, Source=http://www.eclipse.org/emf/2002/Ecore, 然后æ·ÕdŠ DetailsEntryåQškey=constraints, Value=validateXxx
  EDataType,EClass支持åQŒå±žæ€§ä¸æ”¯æŒã€?br />2. 定义¾cÖM¼¼Schemaçš„FacetåQŒè‡ªåŠ¨ç”Ÿæˆå¯¹åº”çš„éªŒè¯ä»£ç åQŒç”¨äºŽéªŒè¯ç®€å•数据类型:
  æ·ÕdŠ Annotatio, Source=http:///org/eclipse/emf/ecore/util/ExtendedMetaData, 然后æ·ÕdŠ DetailsEntryåQškey=maxLength, Value=2
  支持的facet参见ExtendedMetaDataã€?br />  ä»…EDataType支持åQŒå±žæ€§ä¸æ”¯æŒã€?br />
½CÞZ¾‹Ecore:

新生成SqlmodelValidator.java, 代码如下åQ?br />
可见Table_ValidateC, MyLabel_ValidateA,MyLabel_validateB都自动生成,修改里面的if(false)为需要的业务判断逻辑ã€?br />validateMyLabel_MaxLength()æ–ÒŽ³•是根据ExtendedMetaData自动生成的,无需修改ã€?br />
æ€È»“åQ?br />1. EMF验证利用了Annotation扩展åQŒè¿™¿Uæœºåˆ¶å¾ˆç‰|´»åQŒä½†æ˜¯ç»™ç”¨æˆ·å¸¦æ¥ä¸ä¾¿ã€?br />2. Attribute属性不能生成验证规则(eclipse3.2rc3åQ‰ï¼Œå¯ä»¥å®šä¹‰ä¸ºå•独的EDataTypeåQŒç„¶åŽå¼•用之ã€?br />3. Constraints+Facet+本èín的结构验证可以构成很强的验证规则åQŒåƈ且属于Model层,数据本èín卛_¯éªŒè¯è‡ªèínã€?br />4. EObjectValidator.DynamicEDataTypeValidatorä¼ég¹Žå¯ç”¨äºŽåŠ¨æ€éªŒè¯ï¼Œæœ‰çŸ¥é“ç”¨æ³•çš„æœ‹å‹¾l™è®²è§£ä¸€ä¸‹~



]]>
¾~–程使用SDO[EMF兄弟½‹‡]http://www.aygfsteel.com/steeven/archive/2006/05/15/46266.htmlsteevensteevenMon, 15 May 2006 11:00:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/15/46266.htmlhttp://www.aygfsteel.com/steeven/comments/46266.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/15/46266.html#Feedback0http://www.aygfsteel.com/steeven/comments/commentRss/46266.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/46266.html主要特点åQšï¼ˆä¸ªäh理解åQ?br />可验è¯?br />强类åž?br />可取出完整数据和差异ã€?br />
生成SDO代码和EMF大同ž®å¼‚åQŒä¸»è¦æ˜¯åœ¨my.genmodel的第一个节点的右键菜单中选择åQšSet SDO defaults.

体验åQ?br />1. 生成Editor后,执行生成的Editor Plugin
2. 新徏Example EMF Model Creation Wizards->Data Graph Model
3. 在Changes节点上Start Loggin, 然后¾~–辑数据卛_¯çœ‹åˆ°è‡ªåŠ¨ç”Ÿæˆçš„å·®å¼‚ã€?br />
¾|‘上手工操作SDO的示例代码比较少åQŒè¿™é‡Œç®€å•demo如下åQ?br />
import java.util.Iterator;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.sdo.EDataGraph;
import org.eclipse.emf.ecore.sdo.SDOFactory;
import org.steeven.family.FamilyFactory;
import org.steeven.family.个äh;
import org.steeven.family.家庭;

import commonj.sdo.ChangeSummary;
import commonj.sdo.DataGraph;
import commonj.sdo.DataObject;

public class Server {

    
public static void main(String[] args) {
        
// client side
        EDataGraph graph = loadGraph();
        graph.getChangeSummary().beginLogging(); // important!
        家庭 family 
= (家庭) graph.getRootObject();
        family.setTitle(
"my family");
        个äh baby 
= FamilyFactory.INSTANCE.create个äh();
        baby.set姓名(
"sophie");
        family.get兔崽�).add(baby);
        graph.getChangeSummary().endLogging();
        saveGraph(graph);
        update(graph);
    }


    
//server side
    public static EDataGraph loadGraph() {
        家庭 family 
= FamilyFactory.INSTANCE.create家庭(); // or load from
        
// database
        EDataGraph graph = SDOFactory.eINSTANCE.createEDataGraph();
        graph.setERootObject((EObject) family);
        
return graph;
    }


    
//server side full save
    public static void saveGraph(EDataGraph graph) {
        System.out.println(graph.getRootObject());
    }


    
//server side update changed objects
    public static void update(DataGraph dataGraph) {
        ChangeSummary changeSummary 
= dataGraph.getChangeSummary();
        
for (Iterator it = changeSummary.getChangedDataObjects().iterator(); it
                .hasNext();) 
{
            DataObject changedObject 
= (DataObject) it.next();
            System.out.println(
"Update for " + changedObject);
            
for (Iterator settingIt = changeSummary.getOldValues(changedObject)
                    .iterator(); settingIt.hasNext();) 
{
                ChangeSummary.Setting changeSetting 
= (ChangeSummary.Setting) settingIt
                        .next();
                System.out.println(
" (changed "
                        
+ changeSetting.getProperty().getName() + " from \""
                        + changeSetting.getValue() + "\" to \""
                        
+ changedObject.get(changeSetting.getProperty())
                        
+ "\")");
            }

        }

    }

}

输出åQ?br />
org.steeven.family.impl.家庭Impl@9664a1 (title: my family)
Update for org.steeven.family.impl.个ähImpl@1729854 (姓名: sophie, 性别: ç”?
Update for org.steeven.family.impl.家庭Impl@9664a1 (title: my family)
 (changed title from "null" to "my family")
 (changed 兔崽子 from "[]" to "[org.steeven.family.impl.个ähImpl@1729854 (姓名: sophie, 性别: ç”?]")

SDO生成的代码似乎更加纯净一点,没有很多的eXxxx()æ–ÒŽ³•åQˆæœ‰éœ€è¦çš„也可以取刎ͼ‰ã€?br />据说log的开销比较大,不徏议对大量数据使用ã€?img src ="http://www.aygfsteel.com/steeven/aggbug/46266.html" width = "1" height = "1" />

]]>
EMF¾~–程使用http://www.aygfsteel.com/steeven/archive/2006/05/14/46129.htmlsteevensteevenSun, 14 May 2006 13:27:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/05/14/46129.htmlhttp://www.aygfsteel.com/steeven/comments/46129.htmlhttp://www.aygfsteel.com/steeven/archive/2006/05/14/46129.html#Feedback3http://www.aygfsteel.com/steeven/comments/commentRss/46129.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/46129.html看到eclipse3.2里面的GMF, 觉得比较有趣,底层˜q˜æ˜¯ç”¨åˆ°äº†EMF. èŠ×ƒº†ä¸¤å¤©æ—‰™—´ä»”细研究了以下EMF,的确是个好东è¥?

EMFæ ÒŽ®ecore建模(可以和schemaçš„xsdç›æ€º’转换)生成强类型的EMF代码. ˜q™ä¸ªå¼ºç±»åž‹æ›´å¼ºçš„地方是可以取得meta信息,从而可以用于校验和界面辅助信息的生æˆ?¾cÖM¼¼äºŽåŠ¨æ€bean,属性也可以æ ÒŽ®åç§°åŠ¨æ€å–å¾?

以前考虑˜q‡ç”¨xsd描述界面, 但是数据载体只能是xml, 即ä‹É利用apacheçš„schema¾~–译工具生成强类型的¾c?后台代码也是xml. 不利于持久化. emf在代码生成引擎比较智èƒ?可以标记出用户代码和自动生成代码.不会有生成覆盖问é¢?

˜q™é‡Œåšä¸ª½Ž€å•示ä¾?
1. Ecore:
可以新徏Ecore, 建立好以后用GMF可视化编�Eclipse3.2RC2)

2. 生成Model:
点击my.ecoreæ–‡äšg,菜单:File->New->Other->Eclipse Modeling Framework->EMF Model
3. 打开生成的my.genmodel, 选择树顶点的:Generate Model Code
生成的代码里面会有一个编译错è¯? 是中文编½E‹çš„问题, 中文没有大小å†?先天不èƒöå•?,¾l“果性别˜q™ä¸ªæˆå‘˜å˜é‡å’Œæ€§åˆ«¾cÕdæ·äh·†,出错.在错误代码前面加上包全名卛_¯.
4. 利用生成的代码构å»ÞZ¸€ä¸ªå®¶åº?输出xmlòq¶ä¸”校验ä¹?

import  java.io.IOException;
import  java.util.Iterator;

import  org.eclipse.emf.common.util.Diagnostic;
import  org.eclipse.emf.common.util.URI;
import  org.eclipse.emf.ecore.EObject;
import  org.eclipse.emf.ecore.resource.Resource;
import  org.eclipse.emf.ecore.util.Diagnostician;
import  org.eclipse.emf.ecore.xmi.XMLResource;
import  org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
import  org.steeven.family.FamilyFactory;
import  org.steeven.family.人物;
import  org.steeven.family.家庭;
import  org.steeven.family.性别;

public   class  TestMy  {

    
public   static   void  main(String[] args)  throws  IOException  {
        testFamily();
    }


    
private   static   void  testFamily()  throws  IOException  {
        家庭 family 
=  FamilyFactory.eINSTANCE.create家庭();
        family.setTitle(
" steevenå®?/span> " );
        family.set老公(FamilyFactory.eINSTANCE.create人物());
        family.get老公().set姓名(
" steeven " );
        family.set老婆(FamilyFactory.eINSTANCE.create人物());
        family.get老婆().set姓名(
" stella " );
        family.get老婆().set性别(性别.女_LITERAL);
        人物 sophie 
=  FamilyFactory.eINSTANCE.create人物();
        sophie.set姓名(
" sophie " );
        sophie.set性别(性别.女_LITERAL);
        family.get兔崽�).add(sophie);
        dump(family);
        validate(family);
    }


    
private   static   void  validate(EObject family)  {
        Diagnostic diagnostic 
=  Diagnostician.INSTANCE.validate(family);
        System.out.println(diagnostic);
        
for  (Iterator it  =  diagnostic.getChildren().iterator(); it.hasNext();)  {
            Diagnostic diag 
=  (Diagnostic) it.next();
            System.out.println(diag.getMessage());
        }

    }


    
private   static  Resource dump(EObject objs)  throws  IOException  {
        
//  ResourceSet rs = new ResourceSetImpl();
        
//  rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
        
//  Resource.Factory.Registry.DEFAULT_EXTENSION,
        
//  new XMIResourceFactoryImpl());
        
//  Resource resource = rs.createResource(URI
        
//  .createFileURI("c:\\temp\\test.xml"));
        XMLResource resource  =   new  XMLResourceImpl(URI
                .createFileURI(
" c:\\temp\\test.xml " ));
        resource.setEncoding(
" GBK " );
        
for  (EObject obj : objs)
            resource.getContents().add(obj); 
//  目前版本不加入resource验证会报singling异常
        resource.save(System.out,  null );
        
return  resource;
    }

}

˜qè¡Œ¾l“果如下:

<? xml version="1.0" encoding="GBK" ?>
< family: 家庭 xmlns:family ="http://org.steeven/family"  title ="steeven�  老公 ="/"  老婆 ="/"  兔崽�/span> ="/" />
Diagnostic ERROR 
The feature '老公' of 'org.steeven.family.impl.家庭Impl@f6a746{file:/c:/temp/test.xml#/}' contains a dangling reference 'org.steeven.family.impl.人物Impl@6eb38a{#//}'
The feature '老婆' of 'org.steeven.family.impl.家庭Impl@f6a746{file:/c:/temp/test.xml#/}' contains a dangling reference 'org.steeven.family.impl.人物Impl@1cd2e5f{#//}'
The feature '兔崽� of 'org.steeven.family.impl.家庭Impl@f6a746{file:/c:/temp/test.xml#/}' contains a dangling reference 'org.steeven.family.impl.人物Impl@19f953d{#//}'

可见输出的xml中没有包含äh物的具体信息. 修改my.ecore中老公/老婆/兔崽子属性的containmentå±žæ€§äØ“true,重新生成代码后运行结果如ä¸?
<?xml version="1.0" encoding="GBK"?>
<family:家庭 xmlns:family="http://org.steeven/family" title="steeven�>
  
<老公 姓名="steeven"/>
  
<老婆 性别="� 姓名="stella"/>
  
<兔崽子 性别="� 姓名="sophie"/>
</family:家庭>
Diagnostic OK


====================
EMF单独˜qè¡ŒæˆåŠŸ~

˜q™é‡ŒECOREä¼ég¹Žä¸æ”¯æŒåµŒå¥—定ä¹?不像schema那样一个complexType声明里面可以定义的很复杂, 也不像Java的内部类. ä¼ég¹Žè¢«ä½œäº†ç®€åŒ? 更像关系数据库表之间的关¾p?

待求证问�
1. EMF的校验信息是否支持国际化.
2. EMF数据的能否更方便的保存到数据.

EMF的灵‹zÕd’Œå¼ºå¤§å·²ç»éªŒè¯˜q? 用于C/S˜q˜æ˜¯B/S应该都不是问é¢?


]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º ¹àÄÏÏØ| Ô¶°²ÏØ| Áù°²ÊÐ| ËÉÏªÏØ| ÒËÕÂÏØ| ƼÏçÊÐ| ÉîÛÚÊÐ| ËìÏªÏØ| Ìì¾þÏØ| ³¤Ô«ÏØ| ¼´Ä«ÊÐ| µæ½­ÏØ| Îä°²ÊÐ| ÐÂÔ´ÏØ| ²ªÀûÏØ| Íû¶¼ÏØ| ¾Ą̊ÊÐ| ·ï³ÇÊÐ| Èð½ðÊÐ| ¦·³ÏØ| Ǭ°²ÏØ| ¾Å½­ÊÐ| ¼ÎÒåÏØ| ±¦ÛæÇø| °¢ºÏÆæÏØ| ÃàÑôÊÐ| ÈýÃ÷ÊÐ| ³Ç²½| ´óÍÝÏØ| Õò°ÍÏØ| ·±²ýÏØ| ¹ȪÊÐ| ÅíÉ½ÏØ| »¸Ì¨ÏØ| ÒÍÁ¼ÏØ| Î÷ÄþÊÐ| ËæÖÝÊÐ| ±±³½Çø| ¶þÁ¬ºÆÌØÊÐ| Á°Ë®ÏØ| ¼ÃÄÏÊÐ|