読者です 読者をやめる 読者になる 読者になる

AKAI TSUKI

System development or Technical something

CORBA Notification Service

JacORBのサンプルdemo.notification.office

1.idlから必要なクラスを生成

> cd demo\notification\office
> idl Office.idl

下のようなファイルが生成されました。

 demo
 └─notification
     └─office
         │  Job.java
         │  JobHelper.java
         │  JobHolder.java
         │  JobIDHelper.java
         │  Printer.java
         │  PrinterHelper.java
         │  PrinterHolder.java
         │  PrinterOperations.java
         │  PrinterPOA.java
         │  PrinterPOATie.java
         │  PrinterStatus.java
         │  PrinterStatusHelper.java
         │  PrinterStatusHolder.java
         │  Status.java
         │  StatusHelper.java
         │  StatusHolder.java
         │  UserIDHelper.java
         │  _PrinterStub.java
         │
         └─PrinterPackage
                 AlreadyPrinted.java
                 AlreadyPrintedHelper.java
                 DocumentHelper.java
                 OffLine.java
                 OffLineHelper.java
                 UnknownJobID.java
                 UnknownJobIDHelper.java

2.Naming と Notification Serviceの起動

 C:\Java\JacORB\bin>ns -Djacorb.naming.ior_filename=C:/Java/JacORB/data/NS_Ref
 java version "1.4.2_19"
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
 Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
 [jacorb.orb.singleton] INFO : created ORBSingleton
 C:\Java\JacORB\bin>ntfy -writeIOR c:\Java\JacORB\data\ES_Ref
 java version "1.4.2_19"
 Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
 Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
 [jacorb.orb.singleton] INFO : created ORBSingleton


3.サーバ側のクラスを実行

demo.notification.office.PrintServer


4.クライアント側のクラスを実行

demo.notification.office.PrintClient


ちなみに、
■jacorb.properties

ORBInitRef.NameService=file:/C:/Java/JacORB/data/NS_Ref
ORBInitRef.NotificationService=file:/c:/Java/JacORB/data/ES_Ref


■出力

 [jacorb.orb.singleton] INFO : created ORBSingleton
 Sending job, ID #0
 Sending job, ID #1
 Sending job, ID #2
 Sending job, ID #3
 Sending job, ID #4
 Sleep...
 Cancelling job ID #4
 Looking for structured events....
 got structured event.
 	Office.Printed#0
 	job_id : 0
 	user_id : MeMyselfAndI
 Looking for structured events....
 got structured event.
 	Office.Canceled#1
 	job_id  : 4
 	user_id  : MeMyselfAndI
 Looking for structured events....
 got structured event.
 	Office.Printed#2
 	job_id : 1
 	user_id : MeMyselfAndI
 Looking for structured events....
 got structured event.
 	Office.Printed#3
 	job_id : 2
 	user_id : MeMyselfAndI
 Looking for structured events....
 Disconnected!