User guide

C-7
Cisco Transport Manager Release 9.2 GateWay/CORBA User Guide and Programmer Manual
OL-20937-01
Appendix C OSS Use Cases and Client Development
C.2.2 Sample Code in Java
poa.the_POAManager().activate();
}
catch (SystemException ex) {
// Exception handling
}
}
C.2.2.2 Get Reference to the Naming Service
// Get Nameservice reference
NamingContext nsRootContext = null;
try {
// Step 2: Get reference to the name service
// Option 1: Resolve initial reference (RIR)
// org.omg.CORBA.Object obj = global_orb.resolve_initial_references("NameService");
// or
// Option 2: corbaloc URL
String objRef = "corbaloc:iiop:gatewayserver.cisco.com:14005/NameServiceGWC";
org.omg.CORBA.Object obj = global_orb.string_to_object(objRef);
/* NOTE: Please replace "gatewayserver.cisco.com" with the name of the server on
which CORBA Naming service is running. */
// Narrow to root naming context
NamingContextExt root_context = NamingContextExtHelper.narrow(obj);
}
catch (org.omg.CORBA.ORBPackage.InvalidName inEx) {
// Exception handling
}
C.2.2.3 Get Reference to EMSSessionFactory
Follow the example in C.2.2.2 Get Reference to the Naming Service, page C-7 to obtain a reference to
the naming service.
NameComponent name = new NameComponent[6];
name[0] = new NameComponent("TMF_MTNM", "Class");
name[1] = new NameComponent("Cisco Systems", "Vendor");
name[2] = new NameComponent("Cisco Transport Manager", "EMSInstance");
name[3] = new NameComponent(version, "Version"); //where version = "9_1" for CTM 9.2
name[4] = new NameComponent(ctm_sys_id, "EMS"); // ctm_sys_id = "CTM"
name[5] = new NameComponent("SessionFactory", "EmsSessionFactory");
try {
org.omg.CORBA.Object emsSessionI = root_context.resolve(name);
}
catch (InvalidName inEx) {
// Exception handling
}
catch (NotFound nfEx) {
// Exception handling
}
C.2.2.4 Implement NmsSession_IOperations
import org.tmforum.mtnm.session.*;
import org.tmforum.mtnm.nmsSession.*;
public class SessionImpl implements NmsSession_IOperations {