This discussion is archived
9 Replies Latest reply: May 25, 2012 3:22 PM by REDO LOG RSS

need to understand C/S in corba

REDO LOG Newbie
Currently Being Moderated
Hi all
I recently begin to learn corba, but while I'm reading thye client implementation, i couldn't see where exactly the task of invoking is sent to the server.

here is the Client implementation: Client.java file:



//Java
package hello;
import java.io.*;

public class Client
{
public static void main(String args[])
{

java.util.Properties props = System.getProperties();
props.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB");
props.put("org.omg.CORBA.ORBSingletonClass",
"com.ooc.CORBA.ORBSingleton");

int status = 0;
org.omg.CORBA.ORB orb = null;

try
{
orb = org.omg.CORBA.ORB.init(args, props);
status = run(orb);
}
catch(Exception ex)
{
ex.printStackTrace();
status = 1;
}

if(orb != null)
{
try
{
orb.destroy();
}
catch(Exception ex)
{
ex.printStackTrace();
status = 1;
}
}

System.exit(status);
}


static int run(org.omg.CORBA.ORB orb)
{
org.omg.CORBA.Object obj = null;
try
{
String refFile = "Hello.ref";
java.io.BufferedReader in = new java.io.BufferedReader(
new java.io.FileReader(refFile));
String ref = in.readLine();
obj = orb.string_to_object(ref);
}
catch(java.io.IOException ex)
{
ex.printStackTrace();
return 1;
}

Hello hello = HelloHelper.narrow(obj);
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));

String nom = new String();
nom = in.readLine();
hello.sayHello(nom);
}catch(java.io.IOException ex ){

}

return 0;
}
}




plz help

thanks in advance
regards raccio

Edited by: rachid on May 19, 2012 9:57 PM

Edited by: rachid on May 19, 2012 9:58 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points