Précédent   Forum du club des développeurs et IT Pro > Autres langages > Autres langages > CORBA
CORBA Forum d'entraide et de discussion sur le développement distribué avec CORBA & les ORB
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 15/12/2011, 13h48   #1
salima198710
Invité régulier
 
Inscription : juin 2010
Messages : 32
Détails du profil
Informations forums :
Inscription : juin 2010
Messages : 32
Points : 8
Points : 8
Par défaut Dossier medical avec corba

salut voici mon idl
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module dossier
{
	struct MedicalNote
	{
		string author;
		string dateRedac;
		string text;
	};
	interface Patient
	{	
		readonly attribute string name;
		readonly attribute long nSS;
		MedicalNote getNote(in string author);
	};
	interface Doctor
	{	
		void insertNote(in string author,in string dateRedac,in string text);
	};
	interface Admin
	{	
		void setName(in string name);
		void setNSS(in long nSS);
	};
	interface MedicalRecord:Patient,Admin,Doctor
	{
	};
	interface PatientManager
	{	
		Patient rechercherPatient(in long nSS);
	};
	interface DoctorManager
	{	
		Doctor rechercherDoctor(in long nSS);
	};
	interface AdminManager
	{	
		Admin rechercherAdmin(in long nSS);
		void creerDos(in string name,in long nSS);
	};
	
	interface Manager:AdminManager,PatientManager,DoctorManager
	{
	};
};


et voici mon code d'implémentation de la classe ManagerImpl et MedicalRecordImpl
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package dossier;

import java.util.Vector;

public class ManagerImpl extends ManagerPOA
{
	private String title;
	Vector<MedicalRecordImpl> dosMed;
	public ManagerImpl(String title)
	{
		this.title=title;
		dosMed=new Vector<MedicalRecordImpl>();
	}
	public void creerDos(String name,int nSS)
	{
		MedicalRecordImpl dos=new MedicalRecordImpl(name,nSS);
		dosMed.add(dos);
	}
	public Admin rechercherAdmin(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
				return (Admin) med;
		return null;
	}
	
	public Patient rechercherPatient(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
				return (Patient) med;
		return null;
	}

	public Doctor rechercherDoctor(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
			{
				System.out.println("trouver");
				return (Doctor) med;
			}
		return null;
	}
}

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package dossier;

import java.util.Vector;

public class MedicalRecordImpl extends MedicalRecordPOA
{
	private String name;
	private int nss;
	Vector<MedicalNote> note;

	public MedicalRecordImpl(String name,int nss)
	{
		this.name=name;
		this.nss=nss;
		note=new Vector<MedicalNote>();
	}
	public String name()
	{
		return this.name;
	}
	public MedicalNote getNote(String author)
	{
		for(MedicalNote noteM:note)
		{
			if(noteM.author.equals(author))
				return noteM;
		}
		return null;
	}
	public void setName(String name)
	{
		this.name=name;
	}
	public void setNSS(int nSS)
	{
		this.nss=nSS;
	}
	public void insertNote(String author,String dateRedac,String text)
	{
		MedicalNote noteM=new MedicalNote(author,dateRedac,text);
		note.add(noteM);
	}
	@Override
	public int nSS() {
		return this.nss;
	}
}

voici mon serveur il marche correctement
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package dossier;


public class Server{
	
	
	
	public static void main(String args[])
	{
		
			// These properties are necessary to use the ORBACUS ORB instead of the JDK�s ORB.
			//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;	
			// The ORB must be initialized using ORB.init.
			org.omg.CORBA.ORB orb = null;
			try
			{
				orb = org.omg.CORBA.ORB.init(args,null);
				status = run(orb);
				System.out.print("orb runed");
			}
			catch(Exception ex)
			{
				ex.printStackTrace();
				status = 1;
			}

			// If the ORB was successfully created, it is destroyed. This releases the resources used by
			// the ORB.
			if(orb != null)
			{
				try
				{
					orb.destroy();
				}
				catch(Exception ex)
				{
					ex.printStackTrace();
					status = 1;
				}
			}
		
			// The exit status is returned. If there was no error, 0 is returned, or 1 otherwise.
			System.exit(status);
		}

		static int run(org.omg.CORBA.ORB orb) throws org.omg.CORBA.UserException
		{
			// A reference to the Root POA is obtained using the ORB reference, and the Root POA is
			// used to obtain a reference to its POA Manager.
			org.omg.PortableServer.POA rootPOA =
			org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
				
			org.omg.PortableServer.POAManager manager = rootPOA.the_POAManager();

			// A servant of type Hello_impl is created and is used to incarnate a CORBA object. 
			// The CORBA object is released automatically when it is not used anymore.
			ManagerImpl managImpl=new ManagerImpl("Salima");
			Manager AppManag=managImpl._this(orb);

			// The object reference is "stringified" and written to a file.
			try
			{
				String ref = orb.object_to_string(AppManag);
				String refFile = "Medical_Record.ref";
				java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileOutputStream(refFile));
				out.println(ref);
				out.close();
			}
			catch(java.io.IOException ex)
			{
				ex.printStackTrace();
				return 1;
			}

			// The server enters its event loop to receive incoming requests.
			manager.activate();
			orb.run();

			return 0;
		}


	
	
	
	
	


}

et voici mon client qu'il me retourne un erreur mais j'ai pas pu comprendre l'erreur
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package dossier;

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");
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;
}}
static int run(org.omg.CORBA.ORB orb)
{
org.omg.CORBA.Object obj=null;
try
{
String refFile="Medical_Record.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;
}
AdminManager AdminManag=AdminManagerHelper.narrow(obj);
AdminManag.creerDos("salima", 123);
AdminManag.creerDos("ahmed", 124);
DoctorManager docManag=DoctorManagerHelper.narrow(obj);
Doctor dosDoc=docManag.rechercherDoctor(123);
return 0;
}

}

voici l'erreur

Citation:
org.omg.CORBA.UNKNOWN vmcid: SUN minor code: 202 completed: Maybe
at com.ooc.OB.Util.unmarshalSystemException(Unknown Source)
at com.ooc.OB.GIOPConnection.processReply(Unknown Source)
at com.ooc.OB.GIOPConnection.processMessage(Unknown Source)
at com.ooc.OB.GIOPConnectionThreaded.execReceive(Unknown Source)
at com.ooc.OB.GIOPConnectionThreaded$ReceiverThread.run(Unknown Source)
est ce que vous pouvez m'aidez ???
salima198710 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/01/2012, 11h45   #2
moustaf_26
Nouveau Membre du Club
 
Inscription : mars 2009
Messages : 161
Détails du profil
Informations personnelles :
Âge : 26

Informations forums :
Inscription : mars 2009
Messages : 161
Points : 32
Points : 32
Citation:
Envoyé par salima198710 Voir le message
salut voici mon idl
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module dossier
{
	struct MedicalNote
	{
		string author;
		string dateRedac;
		string text;
	};
	interface Patient
	{	
		readonly attribute string name;
		readonly attribute long nSS;
		MedicalNote getNote(in string author);
	};
	interface Doctor
	{	
		void insertNote(in string author,in string dateRedac,in string text);
	};
	interface Admin
	{	
		void setName(in string name);
		void setNSS(in long nSS);
	};
	interface MedicalRecord:Patient,Admin,Doctor
	{
	};
	interface PatientManager
	{	
		Patient rechercherPatient(in long nSS);
	};
	interface DoctorManager
	{	
		Doctor rechercherDoctor(in long nSS);
	};
	interface AdminManager
	{	
		Admin rechercherAdmin(in long nSS);
		void creerDos(in string name,in long nSS);
	};
	
	interface Manager:AdminManager,PatientManager,DoctorManager
	{
	};
};


et voici mon code d'implémentation de la classe ManagerImpl et MedicalRecordImpl
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package dossier;

import java.util.Vector;

public class ManagerImpl extends ManagerPOA
{
	private String title;
	Vector<MedicalRecordImpl> dosMed;
	public ManagerImpl(String title)
	{
		this.title=title;
		dosMed=new Vector<MedicalRecordImpl>();
	}
	public void creerDos(String name,int nSS)
	{
		MedicalRecordImpl dos=new MedicalRecordImpl(name,nSS);
		dosMed.add(dos);
	}
	public Admin rechercherAdmin(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
				return (Admin) med;
		return null;
	}
	
	public Patient rechercherPatient(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
				return (Patient) med;
		return null;
	}

	public Doctor rechercherDoctor(int nSS) {
		for(MedicalRecordImpl med:dosMed)
			if(med.nSS()==nSS)
			{
				System.out.println("trouver");
				return (Doctor) med;
			}
		return null;
	}
}

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package dossier;

import java.util.Vector;

public class MedicalRecordImpl extends MedicalRecordPOA
{
	private String name;
	private int nss;
	Vector<MedicalNote> note;

	public MedicalRecordImpl(String name,int nss)
	{
		this.name=name;
		this.nss=nss;
		note=new Vector<MedicalNote>();
	}
	public String name()
	{
		return this.name;
	}
	public MedicalNote getNote(String author)
	{
		for(MedicalNote noteM:note)
		{
			if(noteM.author.equals(author))
				return noteM;
		}
		return null;
	}
	public void setName(String name)
	{
		this.name=name;
	}
	public void setNSS(int nSS)
	{
		this.nss=nSS;
	}
	public void insertNote(String author,String dateRedac,String text)
	{
		MedicalNote noteM=new MedicalNote(author,dateRedac,text);
		note.add(noteM);
	}
	@Override
	public int nSS() {
		return this.nss;
	}
}

voici mon serveur il marche correctement
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package dossier;


public class Server{
	
	
	
	public static void main(String args[])
	{
		
			// These properties are necessary to use the ORBACUS ORB instead of the JDK�s ORB.
			//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;	
			// The ORB must be initialized using ORB.init.
			org.omg.CORBA.ORB orb = null;
			try
			{
				orb = org.omg.CORBA.ORB.init(args,null);
				status = run(orb);
				System.out.print("orb runed");
			}
			catch(Exception ex)
			{
				ex.printStackTrace();
				status = 1;
			}

			// If the ORB was successfully created, it is destroyed. This releases the resources used by
			// the ORB.
			if(orb != null)
			{
				try
				{
					orb.destroy();
				}
				catch(Exception ex)
				{
					ex.printStackTrace();
					status = 1;
				}
			}
		
			// The exit status is returned. If there was no error, 0 is returned, or 1 otherwise.
			System.exit(status);
		}

		static int run(org.omg.CORBA.ORB orb) throws org.omg.CORBA.UserException
		{
			// A reference to the Root POA is obtained using the ORB reference, and the Root POA is
			// used to obtain a reference to its POA Manager.
			org.omg.PortableServer.POA rootPOA =
			org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
				
			org.omg.PortableServer.POAManager manager = rootPOA.the_POAManager();

			// A servant of type Hello_impl is created and is used to incarnate a CORBA object. 
			// The CORBA object is released automatically when it is not used anymore.
			ManagerImpl managImpl=new ManagerImpl("Salima");
			Manager AppManag=managImpl._this(orb);

			// The object reference is "stringified" and written to a file.
			try
			{
				String ref = orb.object_to_string(AppManag);
				String refFile = "Medical_Record.ref";
				java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileOutputStream(refFile));
				out.println(ref);
				out.close();
			}
			catch(java.io.IOException ex)
			{
				ex.printStackTrace();
				return 1;
			}

			// The server enters its event loop to receive incoming requests.
			manager.activate();
			orb.run();

			return 0;
		}


	
	
	
	
	


}

et voici mon client qu'il me retourne un erreur mais j'ai pas pu comprendre l'erreur
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package dossier;

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");
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;
}}
static int run(org.omg.CORBA.ORB orb)
{
org.omg.CORBA.Object obj=null;
try
{
String refFile="Medical_Record.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;
}
AdminManager AdminManag=AdminManagerHelper.narrow(obj);
AdminManag.creerDos("salima", 123);
AdminManag.creerDos("ahmed", 124);
DoctorManager docManag=DoctorManagerHelper.narrow(obj);
Doctor dosDoc=docManag.rechercherDoctor(123);
return 0;
}

}

voici l'erreur



est ce que vous pouvez m'aidez ???
salut, j'ai le même message d'erreur c'est vraiment trop bizzare
moustaf_26 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 19h20.


 
 
 
 
Partenaires

Hébergement Web