hassan bahi
2011-07-04 15:55:57 UTC
file IDL :
interface Data
{
void Etudiant(in string nom , inout long data);
};
file Servant :
import org.omg.CORBA.*; // All CORBA applications need these
classes.
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
class servant extends DataPOA {
private ORB orb;
public servant(ORB orb) {
this.orb = orb;
}
public void Etudiant(String nom, IntHolder data) {
if(data.value==0){
System.out.println("L'etudiant :"+nom+" vient de se
connecter .");
}
else {
System.out.println("L'etudiant : "+nom+" a participé :
"+data.value+" fois");
}
}
}
file server
import org.omg.CORBA.Any;
import org.omg.CORBA.Request;
import org.omg.CORBA.TCKind;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
public class serveur
{
public static void main(String args[])
{
try{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
servant dataRef = new servant(orb);
POA rootpoa =
POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
org.omg.CORBA.Object ref =
rootpoa.servant_to_reference(dataRef);
Data href = DataHelper.narrow(ref);
String oir = orb.object_to_string(href);
java.io.PrintWriter out = new java.io.PrintWriter(new
java.io.FileOutputStream("c:/dev/Data.ref"));
out.println(oir);
out.close();
wait for invocations from clients
System.out.println("server ready ....");
orb.run();
} catch (Exception e) { System.err.println("ERROR: " + e);
e.printStackTrace(System.out); } }
}
How I can recover the two variables data and nom in the class server
on the client class side I have no problem
thank you in advance
interface Data
{
void Etudiant(in string nom , inout long data);
};
file Servant :
import org.omg.CORBA.*; // All CORBA applications need these
classes.
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
class servant extends DataPOA {
private ORB orb;
public servant(ORB orb) {
this.orb = orb;
}
public void Etudiant(String nom, IntHolder data) {
if(data.value==0){
System.out.println("L'etudiant :"+nom+" vient de se
connecter .");
}
else {
System.out.println("L'etudiant : "+nom+" a participé :
"+data.value+" fois");
}
}
}
file server
import org.omg.CORBA.Any;
import org.omg.CORBA.Request;
import org.omg.CORBA.TCKind;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
public class serveur
{
public static void main(String args[])
{
try{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
servant dataRef = new servant(orb);
POA rootpoa =
POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
org.omg.CORBA.Object ref =
rootpoa.servant_to_reference(dataRef);
Data href = DataHelper.narrow(ref);
String oir = orb.object_to_string(href);
java.io.PrintWriter out = new java.io.PrintWriter(new
java.io.FileOutputStream("c:/dev/Data.ref"));
out.println(oir);
out.close();
wait for invocations from clients
System.out.println("server ready ....");
orb.run();
} catch (Exception e) { System.err.println("ERROR: " + e);
e.printStackTrace(System.out); } }
}
How I can recover the two variables data and nom in the class server
on the client class side I have no problem
thank you in advance