您的位置:首页 > 编程语言 > Java开发

ICE学习笔记一----运行官方的java版demo程序

2013-09-22 11:43 627 查看
建议新手和我一样,从官网下载英文文档,开个有道词典,慢慢啃。


官方文档下载:

http://download.csdn.net/detail/xiong_mao_1/6300631

程序代码就不说了,我照抄文档的,以下都是个人笔记。

slice2java后,生成了这些文档,具体每个文件的含义有得学习,先mark个。



我是在eclipse中运行的,

结果图!嘿嘿,小兴奋中~~



eclipse工程打包下载:

http://download.csdn.net/detail/xiong_mao_1/6300697

关于客户端代码一个知识点:

源码:

Ice.ObjectPrx base = ic.stringToProxy("SimplePrinter:default -p 10000");

PrinterPrx printer = PrinterPrxHelper.checkedCast(base);

官方文档解释:

The proxy returned by sringToProxy is of type
Ice.ObjectPrx,which is at the root of the inheritance tree for interfaces and classes. But to actually talk to our printer, we need a proxy for aPrinterinterface, not anObject interface. To
do this,we need to do adown-cast by callingPrinterPrxHelper.checkedCast.A checked cast sends a message to the server, effectively asking “is this aproxy for a Printer interface?” If so, the
call returns a proxy of typeDemo::Printer; otherwise, if the proxy denotes an interface of some other type,the call returns null.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ice