??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲iv一区二区三区,怡红院av在线,国产午夜精品一区二区三区四区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" />

steeven 2006-06-19 18:15 发表评论
]]>
YY一下未来的用户界面http://www.aygfsteel.com/steeven/archive/2006/06/18/53657.htmlsteevensteevenSun, 18 Jun 2006 14:57:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/06/18/53657.htmlhttp://www.aygfsteel.com/steeven/comments/53657.htmlhttp://www.aygfsteel.com/steeven/archive/2006/06/18/53657.html#Feedback3http://www.aygfsteel.com/steeven/comments/commentRss/53657.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/53657.html
微Yq回蓄势待发xaml有多强大呢?3dQ感觉不够纯_)Q强大的数据l定Q动画/多媒体支持.Q.
q里可怕的不仅仅是框架Q还有配套的GUI开发工P有趣的是Interactive Designer据说是用wpf开发的Q?br />xaml只是个xml描述文gQ里面可以包含代码,~译成UI界面Q所有的界面内容也可以由E序动态运行.
q样未来q行在browser里面的UI不是复杂的ajaxQ是和后C致的托管代码Q?br />
Java怎样应对呢?Java+Flash? 开发bs都困N重.除非Flash能放弃asQ直接同javal合Q或者两个公司合作开发一个新框架Q这个新框架应该是什么样子呢Q完全的3D视角Q时间u控制Q.Q重演c#后来居上的历Ԍ

Java在Sun的手里一直半Mz,真希望能赶快被googleq购Q或者sund把java捐赠出来Q?br />
如果没有Q意外"Q在wpf正式发行以后Q桌面应用将逐步q渡到wpf开发.HTML׃其跨q_Q可能会q_U色Q?br />
面对wpfQ如何反抗?java.net是太监,?net阵营里面q二奉不算Q等于投降.
利用xaml? xaml被编译加载,其执行框架还?netQ机会似乎不大.在浏览器上可能会有类似lasszlo的组合.

作ؓJava爱好者,祷奇迹发生吧,q好在Java世界中奇qҎ家常侉K :)

steeven 2006-06-18 22:57 发表评论
]]>
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且加入了一些自qxQ供选型者参考:<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是gq发送到服务?而服务器只发送页面的变化部分到浏览器?/div> <div>3. gwt应用被编译成一个页面,虽然应用的复杂化Q这个编译结果也随之变得可怕。。?个h认ؓ随着~译器的发展Q不同的面可以做到lazy load)</div> <div>4. echo的js模块是lazy加蝲到浏览器的,界面上呈现哪些控件才d载ƈ且缓存对应的js模块。发送到客户端的不是逻辑代码Q只有用L态(个h认ؓecho2现在q于lazyQ导致初始化阶段多次讉Kserver加蝲一些基本的js模块Q应该揉合到一赗另外,因ؓecho逻辑代码在服务器上,相对来说可以防止盗版Q?/div> <div> </div> <div>中间层和数据讉KQ?/div> <div>1. 如果要访问数据,gwtq是要回Cl的模式Q通过rpc讉Kservlet。gwt提供把远E服务透明的包装v来,中间传送pojo. 管包装了,中间的安全和和校验还是必要开发者考虑?/div> <div>2. echo支持SOAQ但是不必须。大多数情况下安全不是问题,因ؓ数据和逻辑都不会暴露到览器上?以前lecho提过Q浏览器用户很可能去模拟一个被disabled按钮提交Q这U问题现在无需考虑Q?/div> <div> </div> <div>q行环境Q?/div> <div>1. gwtq行在浏览器上,q所有的javac都能编译成js. gwt现在只支持java.lang/java.util下面的一个子?版本 1.0.21)Q?7 classes, 11 interfaces, and 18 exception(q让人想起了j2me开?. 一些现有的cd别想了?/div> <div> </div> <div>调试Q?/div> <div>1. gwt调试需要一套和q行时完全不同的环境QHOST模式Q代码作为真正的java在运行?个h认ؓq里因ؓ是纯java调试Q比echo的web调试要稍微方便一些。做单元试也更方便些,但不是对最lbrowser的测试)</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认ؓQechostudio也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>个hl论Q?br />1. 开发方式都很优UQ用Ujava开发b/s<br />2. gwt可用于大型网站,把压力{嫁给客户端?br />3. echo可用于快速开发复杂的企业应用Q把压力丢给服务?企业里面最清闲的就是前台和服务?<br /><br />两个产品都很优秀QGWT?006q的IT飓风QL及后面几q。M$的日子要难过? GOOGLE的确是个令h头痛的对手?br /><div><br />然而,q有比gwt/echo2更美好的未来吗?</div><div>有!把他们的输出变成flashQ用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>转脓QComparing 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是样一个,但是背后站的是重量的googleQ强大的资源和数不完的银子。。。?br />
看到q玩意首先想到的是echo2, 客户端技术都是ajax, ~码都是java. 不同的是gwt发行时编译成HTML+JSQEcho2则是完全的服务器端生?更新。gwt跟server端交互依靠类gws的service把前后台完全区分开?br />
在echo的论坛里面已l有人在讨论q玩意了Qƈ且八卦了一下gwt的前w似乎是Morfik的一部分Q待证实Q?br />从原理上Qecho的开发者作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  

======================================
毕竟gwtq是baby, 以后怎么发展q难_现在下结论太早。这两天试用一下,有空从细节上Ҏ一下?br />



steeven 2006-06-01 00:55 发表评论
]]>
~程使用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的第一个节点的右键菜单中选择QSet 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" />

steeven 2006-05-15 19:00 发表评论
]]>
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信息,从而可以用于校验和界面辅助信息的生?cM于动态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个成员变量和性别cdh,出错.在错误代码前面加上包全名卛_.
4. 利用生成的代码构Z个家?输出xmlq且校验?

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里ECOREg不支持嵌套定?不像schema那样一个complexType声明里面可以定义的很复杂, 也不像Java的内部类. g被作了简? 更像关系数据库表之间的关p?

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

EMF的灵zd强大已经验证q? 用于C/Sq是B/S应该都不是问?


steeven 2006-05-14 21:27 发表评论
]]>
Java?006新春福http://www.aygfsteel.com/steeven/archive/2006/01/12/27697.htmlsteevensteevenThu, 12 Jan 2006 03:33:00 GMThttp://www.aygfsteel.com/steeven/archive/2006/01/12/27697.htmlhttp://www.aygfsteel.com/steeven/comments/27697.htmlhttp://www.aygfsteel.com/steeven/archive/2006/01/12/27697.html#Feedback1http://www.aygfsteel.com/steeven/comments/commentRss/27697.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/27697.html偶msn名字是:Year y2006 = /*happy*/ new Year(2006);
一个朋友受到启发,l偶写了一D능代码,E微改编一下送给大家

for(Blogger blogger :  BlogFarm.getInstance["BlogJava"].getBloggers()){
    blogger.setHealth(
Health.good);
    blogger.getFamily().setHappy(blogger.getFamily().getHappy() 
1);
    blogger.setMoney(blogger.getMoney 
* 10);
}

备注Q?BR>1.未单元测?BR>2. 感觉不如c#版新春祝?/A>优雅一?BR>



steeven 2006-01-12 11:33 发表评论
]]>
奢谈未来的java语言。。?http://www.aygfsteel.com/steeven/archive/2005/12/29/25904.htmlsteevensteevenThu, 29 Dec 2005 09:01:00 GMThttp://www.aygfsteel.com/steeven/archive/2005/12/29/25904.htmlhttp://www.aygfsteel.com/steeven/comments/25904.htmlhttp://www.aygfsteel.com/steeven/archive/2005/12/29/25904.html#Feedback5http://www.aygfsteel.com/steeven/comments/commentRss/25904.htmlhttp://www.aygfsteel.com/steeven/services/trackbacks/25904.htmlJava是个扶不L阿斗Qsun在赢了微软的官司以后g在忙于分U,相对于红U火火的.net世界Qsun几乎在坐以待毙,费无数开源爱好者的感情?BR>matrix展望2006的javaQ似乎只能看到开源爱好者的一腔热血?BR>
未来的java应该是什么样子呢Q下面是我期望: 

    /**
     * 1. I指针抑?lt;br>
     * JVM支持的RuntimeI指针抑ӞҎҎ的[Nullable]标记<br>
     * java里面有太多的NullPointer异常Q经帔R要复杂的,费没必要的代码?BR>     
*/

    [Nullable]
    
public void testNullable(A a){
        
return a.b().c.d(); //如果用if else写需要多代码?
    }

    
    
/**
     * 2. 动态属性支?lt;br>
     * cM范型的实玎ͼq译器支持卛_?lt;br>
     * 
@param a: A implements DynamicBean,没有定义c属?BR>     */

    
public void dynamicProperty(A a){
        
assert a != null;
        a.b.c 
= "abc"//{效于a.getProperty("b").setProperty("c","abc");
        ResultSet rs; //for database:
        String name = rs.name; //if ResultSet defined getStringProperty(): String name = rs.getStringProperty("a");
        Element order; //for xml, element auto-created in getProperty() method.
        order.address.phone = "1234"//order.getProperty("address").setProperty("phone","1234");
    }

    
    
    
/**
     * 3. 动态方法支?lt;br>
     * q译器支持卛_?lt;br>
     * 
@param a: A implements DynamicInvoke,没有定义b()Ҏ
     
*/

    
public void dynamicMethod(A a){
        a.b(
1,"x"); //~译为a.invoke("b",new Object[]{1,"x"]);
    }

    
    
/**
     * 4. 快速反?lt;br>
     * q译器支持卛_。便于编译期间错误检?lt;br>
     * 
@param a: A 定义了b(),c变量
     
*/

    
public void fastReflection(A a){
        Annotation[] mas 
= a.b().class.getAnnotations(); //a.getClass().getMethod("b").getAnnotations();
        Annotation[] mas = a.c.class.getAnnotations(); // a.getClass().getField("c").getAnnotations();
    }

    
    
/**
     * 5. 索引?lt;br>
     * cM.net的烦引器Q语法简z。编译期间支持即?lt;br>
     * 
@param a: A 实现了List接口QMap接口
     
*/

    
public void indexVisit(A a){
        Element order ; 
//xml element
        Element first = order[0]; //order.get(0);
        Element address = order["address"]; //order.get("address")
    }


    
/**
     * 6. AOP<br>
     * JVM内置支持AOP标记<br>
     * Trace是用戯行定制的Attribute, Trace.Interceptor指定拦截?nbsp;
     
*/

    [Trace]
    [Role(
"admin")][Transactional]
    
public void jvmAOP(A a){
        
    }

    
    
/**
     * 7. 条g~译<br>
     * ~译器支持Condition标记,可以用于所有元素,甚至package<br>
     * 用于试期间、调试期间编译出不同的结?BR>     
*/

    
    
/**
     * 8. SchemaQDataBase~译支持<br>
     
*/

    
public static void schemaSupport() {
        [Schema(url
="file://test.xsd")]
        Document doc;
        Element c 
= doc.a.b.c; //Ҏschema~译期间?/SPAN>
    }

    
    
/**
     * 9. 内置对象数据库,支持cM记忆的遗忘模式以节省I间
     
*/

    
public void databaseSupport(){
        Database.
default.find("");
    }

    
    
/**
     * 10. q_支持<br>
     * ~写windows的服务,调用windows的注册表/log/ad/schedule/菜单、工h、桌面。。?BR>     
*/

    
public void platformSupport(){
        PlatformRegistry.getString(
".");
    }



希望sun早日把java捐赠到开源社区,象eclipse一L发青春?



steeven 2005-12-29 17:01 发表评论
]]>
վ֩ģ壺 | | Ľ| | | ɽ| ƽ| ¡| Ӳ| ï| | | | ʯȪ| | ƽɽ| | ʯʨ| ʲ| Դ| Ʊ| | ī| | | | կ| Ϫ| | | | | ʢ| β| | | | | ຣʡ| | ɽ|