12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

实 例 服 务 器 应 用 程 序Java:}};以 下 的 代 码 示 例 说 明 Java 下 的 PrinterManager 实 现// PrinterManagerImpl.javaimport java.util.*;import org.omg.DynamicAny.*;import org.omg.PortableServer.*;public class PrinterManagerImpl extends Printer.PrinterManagerPOA {private com.inprise.vbroker.CORBA.ORB _orb;private DynAnyFactory _factory;private POA _poa;private byte[] _oid;public PrinterManagerImpl(com.inprise.vbroker.CORBA.ORB orb,DynAnyFactory factory, POA poa, byte[] oid) {_orb = orb;_factory = factory;_poa = poa;_oid = oid;}public synchronized void printAny(org.omg.CORBA.Any info) {// 在 假 定 我 们 不 知 道 关 于 Any 中 的 类 型 的 任 何 静 态 信 息 的 情 况 下// 显 示 Any 信 息try {// 创 建 DynAny 对 象DynAny dynAny = _factory.create_dyn_any(info);display(dynAny);}catch (Exception e) {e.printStackTrace();}}public void shutdown() {try {_poa.deactivate_object(_oid);System.out.println("Server shutting down");_orb.shutdown(false);}catch (Exception e) {System.out.println(e);}}private void display(DynAny value) throws Exception {switch(value.type().kind().value()) {case org.omg.CORBA.TCKind._tk_null:case org.omg.CORBA.TCKind._tk_void: {break;}case org.omg.CORBA.TCKind._tk_short: {System.out.println(value.get_short());break;}case org.omg.CORBA.TCKind._tk_ushort: {25-12 <strong>VisiBroker</strong> 开 发 者 指 南

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!