Call Corba (PB) component from Java(this howto is deprecated)Tag(s): DEPRECATED


// inter-component, on the same server
Properties props = new Properties();
props.put("org.omg.CORBA.ORBClass","com.sybase.CORBA.ORB");
ORB orb = ORB.init((String[])null,props);
MyPack.MyComponent stub =
  MyPack.MyComponentHelper.narrow
     (orb.string_to_object("MyPack/MyComponent"));

// same server but to identify ourself
Properties p = new Properties();
p.put("org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB");

p.put(javax.naming.Context.SECURITY_PRINCIPAL,
   request.getParameter("user"));
p.put(javax.naming.Context.SECURITY_CREDENTIALS,
   request.getParameter("pwd"));
MyPack.MyComponent stub =
  MyPack.MyComponentHelper.narrow(orb.string_to_object
     ("MyPack/MyComponent"));

// different server
String[] args={""};
java.util.Properties p = new java.util.Properties();
p.put("org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB");
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, p);
org.omg.CORBA.Object ior =
     orb.string_to_object("iiop://localhost:9000");
SessionManager.Manager manager =
   SessionManager.ManagerHelper.narrow(ior);
SessionManager.Session session = manager.createSession
   ("jagadmin", "");
SessionManager.Factory factory =
   SessionManager.FactoryHelper.narrow(session.lookup
     ("MyPack/MyComponent"));
MyPack.MyComponent stub =
   MyPack.MyComponentHelper.narrow(factory.create());

blog comments powered by Disqus