1 26 package org.objectweb.openccm.explorer.CORBA; 27 28 29 import org.objectweb.util.explorer.context.lib.AbstractDecoder; 30 import org.omg.CORBA.ORB ; 31 32 40 public class CorbaIORDecoderHandler 41 extends AbstractDecoder { 42 43 44 protected final Class class_ = org.omg.CORBA.Object .class; 45 46 47 protected ORB orb_ = null; 48 49 52 public CorbaIORDecoderHandler() { 53 orb_ = org.objectweb.openccm.corba.TheORB.getORB(); 54 } 55 56 61 public Object decode(Object node) { 62 if(node == null) 69 return new String ("NULL CORBA OBJECT REFERENCE"); 70 71 if (class_.isAssignableFrom(node.getClass())) { 72 try { 73 TypageCORBA typeCORBA = new TypageCORBA((org.omg.CORBA.Object ) node, orb_); 74 Class [] argsType = new Class [] { org.omg.CORBA.Object .class }; 75 Object [] args = new Object [] { node }; 76 Class c = typeCORBA.getJavaHelperClass(); 77 if (c != null) { 78 Object o = c.getMethod("narrow", argsType).invoke(null, args); 79 if (!node.getClass().getName().equals(o.getClass().getName())) 80 return o; 81 } 82 } catch (NoSuchMethodException e) { 83 e.printStackTrace(); 84 } catch (IllegalAccessException e) { 85 e.printStackTrace(); 86 } catch (java.lang.reflect.InvocationTargetException e) { 87 e.printStackTrace(); 88 } catch (ObjectToStringNotSupportedException e) { 89 } 91 } else if (next_ != null) { 92 return next_.decode(node); 93 } 94 return node; 95 } 96 97 } 98 | Popular Tags |