1 26 package org.objectweb.openccm.explorer.CORBA; 27 28 29 30 import org.objectweb.util.explorer.api.Context; 31 import org.objectweb.util.explorer.api.Entry; 32 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 33 import org.omg.CORBA.ORB ; 34 35 43 public class InitialReferenceContext 44 implements Context { 45 46 52 58 64 protected Entry getLocalEntry(String name, ORB orb) { 65 if (orb != null) { 66 Object value = getLocalValue(name, orb); 67 return (value != null) ? new DefaultEntry(name, value) : null; 68 } 69 return null; 70 } 71 72 protected Object getLocalValue(String name, ORB orb) { 73 if (orb != null) { 75 try { 76 return orb.resolve_initial_references(name); 77 } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { 78 return null; 79 } 81 } 82 return null; 83 } 84 85 91 95 public Entry[] getEntries(Object object) { 96 ORB orb = (ORB )object; 97 String [] objects = orb.list_initial_services(); 98 Entry[] values = new Entry[objects.length]; 99 for (int i = 0; i < objects.length; i++) 100 values[i] = getLocalEntry(objects[i], orb); 101 return values; 102 } 103 104 } 105 | Popular Tags |