Cisco Cisco Prime Optical 10.3 Developer's Guide

Page of 688
 
Cisco Prime Optical 10.3 GateWay/CORBA Programmer Reference Guide 
 
 
651
 
•  Sun Microsystems Java Development Kit (JDK) 1.6 (available at http://java.sun.com/) 
•  jacORB 2.x 
7.2.2  Sample Code in Java 
A typical CORBA client application involves the following steps:  
Step 1 
Initialize the client connection to the object request broker (ORB).  
Step 2 
Obtain a reference to the naming service. 
Step 3 
Resolve the reference to EMSSessionFactory. See 
 
Step 4 
Implement NmsSession_IOperations. See 
 
Step 5 
Retrieve EmsSession by supplying the username and password. See 
. 
Step 6 
Query EmsSession and obtain a list of managers available for operations. See 
. 
Step 7 
Invoke the desired method on that manager. See 
. 
If you want your client to receive notifications from GateWay/CORBA, the 
following additional steps are required:  
Step 8 
Obtain a reference to an EventChannel object in the notification server in Step 2. 
Step 9 
Obtain a ConsumerAdmin object reference. 
Step 10 
Invoke obtain_notification_push_consumer() on the SupplierAdmin object, 
specifying CosNotifyChannelAdmin::STRUCTURED_EVENT as a parameter. This 
operation returns a reference to the StructuredProxyPushSupplier. 
Step 11 
Implement an instance of StructuredPushConsumer (defined by the OMG). 
Step 12 
Invoke the connect_structured_push_consumer() operation on the 
StructuredProxyPushSupplier object to connect the StructuredPushConsumer 
implementation object to the notification channel. 
Step 13 
Monitor incoming notifications. 
The following sections show sample Java code for the steps required to develop a client 
application.  
  The sample code shown is for illustrative purposes only; the code might not compile as shown. The 
sample code does not handle all exceptions. 
 
7.2.2.1  Initialize the Client Connection