1 package SOFA.SOFAnode.Made.TIR.Access.Browser; 2 import java.rmi.Naming ; 3 4 import SOFA.SOFAnode.Made.TIR.Identification; 5 import SOFA.SOFAnode.Made.TIR.ManageProfiles; 6 import SOFA.SOFAnode.Made.TIR.ProfileDef; 7 import SOFA.SOFAnode.Made.TIR.Repository; 8 9 10 public class Profiles { 11 12 public static void main(String [] argv) { 13 try { 14 System.setSecurityManager(new java.rmi.RMISecurityManager ()); 15 16 String rmiport = System.getProperty("sofa.rmiport","1099"); 17 String rmihost = System.getProperty("sofa.rmihost","localhost"); 18 System.out.print("Connecting to repository..."); 19 Repository rep = (Repository) Naming.lookup("//"+rmihost+":"+rmiport+"/Repository"); 20 System.out.println("OK"); 21 System.out.print("Getting profiles object..."); 22 ManageProfiles prof = rep.getProfiles(); 23 System.out.println("OK"); 24 System.out.print("Getting profiles..."); 25 ProfileDef[] p = prof.all_profiles(); 26 System.out.println("OK"); 27 System.out.println("Print profiles:"); 28 System.out.println("==============="); 29 for (int i=0;i<p.length;i++) { 30 System.out.println("Profile \""+p[i].name()+"\""); 31 Identification[] id = p[i].contents(); 32 for(int j=0;j<id.length;j++) { 33 System.out.println(" "+id[j].absolute_name().name()+":"+id[j].version()); 34 } 35 } 36 } catch (Exception e) { 37 System.out.println("Exception: " + e.getMessage()); 38 e.printStackTrace(); 39 } 40 } 41 } 42 | Popular Tags |