1 26 package org.objectweb.openccm.explorer.CosNaming; 27 28 import java.util.List ; 29 import java.util.Vector ; 30 31 import org.objectweb.openccm.explorer.CORBA.ConsoleFactory; 32 import org.objectweb.util.explorer.api.Context; 33 import org.objectweb.util.explorer.api.Entry; 34 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 35 import org.omg.CosNaming.NamingContextExt ; 36 37 45 public class NameServiceContext 46 implements Context 47 { 48 49 55 61 67 73 public Entry[] getEntries(Object object) { 74 NamingContextExt namingContext = (NamingContextExt )object; 75 List l = new Vector (); 76 try{ 77 org.omg.CosNaming.BindingListHolder bindingList = new org.omg.CosNaming.BindingListHolder (); 78 org.omg.CosNaming.BindingIteratorHolder bindingIterator = new org.omg.CosNaming.BindingIteratorHolder (); 79 namingContext.list(100, bindingList, bindingIterator); 80 while(true){ 81 for(int i = 0; i< bindingList.value.length ; i++){ 82 try{ 83 l.add(new DefaultEntry(namingContext.to_string(bindingList.value[i].binding_name), namingContext.resolve(bindingList.value[i].binding_name))); 84 } catch (org.omg.CosNaming.NamingContextPackage.NotFound e) { 85 System.out.println(getClass().getName() + " : Object Not Found Exception !"); 86 } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) { 87 System.out.println(getClass().getName() + " : CannotProceed Exception"); 88 } catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { 89 System.out.println(getClass().getName() + " : InvalidName Exception"); 90 } 91 } 92 if(!bindingIterator.value.next_n(100, bindingList)) break; 93 } 94 } catch(Exception e) { 95 ConsoleFactory.getDebugConsole().add(e.getMessage()+ "\n"); 96 } 97 return (Entry[])l.toArray(new Entry[0]); 98 } 99 100 } 101 | Popular Tags |