7 Praktische Aspekte (Wie mache ich...) Im Praktikum verwendet: JacORB: Java-basierte ORB-implementierung GroupPac: FT-CORBA-Erweiterung zu JacORB JGroups: Java-Gruppenkommunikationsschicht APXGroup: Gruppenkommunikationsschicht des AspectIX-Projekts 7 Praktische Aspekte Software auf Abteilungsrechnern installiert Login auf ygramul.informatik.uni-ulm.de (via ssh oder Abteilungs-Pool) Pakete liegen unter /proj (Anzeige aller Projekte mit Skript lsproj ) /proj/jacorb--2.2.1 /proj/jacorb--1.4.1 /proj/grouppac--2.2.1 (Lokale Modifikationen für JacORB 1.4.1, benötigt sonst <= 1.4.0) /proj/jgroups--2.2.7 Java enthält eigenen CORBA-ORB => Konflikt mit JacORB Einfachste Lösung: jaco statt java verwenden (setzt bootclasspath und ORB-Properties automatisch richtig)
7 Einfaches Beispiel IDL-Definition der Schnittstelle (hello.idl) module test { interface hello { string say(in string x); ; ; Code-Generierung daraus idlj hello.idl idl hello.idl (Mit Sun-IDL-Compiler) (Mit JacORB-IDL-Compiler) 7 Einfaches Beispiel Implementierung des Dienstes package test; public class helloimpl extends hellopoa { public String say(string in) { return Hello +in;
7 Beispiel: Implementierung des Servers org.omg.corba.object _rootpoa = orb.resolve_initial_references( RootPOA ); POA rootpoa = POAHelper.narrow(_rootpoa); org.omg.corba.object _ref = rootpoa.servant_to_reference(new helloimpl()); hello ref = hellohelper.narrow(_ref); NamingContextExt nc = NamingContextExtHelper.narrow( orb.resolve_initial_references( NameService ); NameComponent path[] = nc.to_name( Hello ); nc.rebind(path, ref); orb.run(); 7 Beispiel: Implementierung des Servers org.omg.corba.object _rootpoa = orb.resolve_initial_references( RootPOA ); POA rootpoa = POAHelper.narrow(_rootpoa); org.omg.corba.object _ref = rootpoa.servant_to_reference(new helloimpl()); hello ref = hellohelper.narrow(_ref); (im wesentlichen) äquivalent zu: NamingContextExt nc = NamingContextExtHelper.narrow( orb.resolve_initial_references( NameService ); byte[] id=rootpoa.activate_object(new helloimpl()); NameComponent _ref = rootpoa.id_to_reference(id); path[] = nc.to_name( Hello ); nc.rebind(path, ref); orb.run();
7 Beispiel: Implementierung des Clients package test; import org.omg.corba.*; import org.omg.cosnaming.*; public class helloclient { static public void main(string args[]) { try { NamingContextExt nc = NamingContextExtHelper. narrow(orb.resolve_initial_references( NameService ); hello hello = hellohelper.narrow( nc.resolve_str( Hello ) ); System.out.println(hello.say( world )); catch(exception ex) { ex.printstacktrace(); 7 Ausführen des Beispiels Namensdienst muss gestartet werden JacORB sucht Datei jacorb.properties im CLASSPATH Angabe zu initialer Referenz (ORBInitRef.NameService) als corbaloc, file oder http-url JacORB-Namensdienst schreibt eigene Adresse automatisch in die Datei, die unter jacorb.naming.ior_filename angegeben ist export PATH=/proj/jacorb--2.2.1/bin:$PATH ns Starten des Dienstes und des Clients jaco test.helloservice & jaco test.helloclient
8 Weitere Schritte Präsentation des eigenen Themas am 29.04. (je ca. 5 Minuten) Bis dahin: Login auf ygramul einrichten lassen Mit Software vertraut machen, ggf. installieren (zu Hause, im Pool), Dokumentation beschaffen (JacORB, GroupPac, JGroups, AspectIX, Java) Meilensteine definieren und mit Betreuer absprechen Koordinierung mit Bearbeitern von verwandten Themen