1 18 package org.apache.geronimo.interop.rmi.iiop; 19 20 import java.util.HashMap ; 21 22 public abstract class RemoteObject { 23 24 protected HashMap methods = new HashMap (10); 25 26 public RemoteObject( ) { 27 registerMethods(); 28 } 29 30 protected void registerMethods() { 31 registerMethod("_is_a", -1); 32 } 33 34 protected void registerMethod( String methodName, int id ) 35 { 36 methods.put( methodName, new Integer (id) ); 37 } 38 39 protected Integer getMethodId( String methodName ) 40 { 41 return (Integer )methods.get( methodName ); 42 } 43 44 public void invoke(int id, byte[] objectKey, Object instance, ObjectInputStream input, ObjectOutputStream output) { 45 switch (id) { 46 case -1: 47 { 48 output.writeBoolean(_is_a(objectKey)); 49 break; 50 } 51 } 52 } 53 54 public boolean _is_a(byte[] objectKey) { 55 String ids[] = getIds(); 56 boolean isa = false; 57 58 String id = new String (objectKey); 59 60 if (ids != null && ids.length > 0) { 61 int i; 62 for (i = 0; i < ids.length && !isa; i++) { 63 isa = ids[i].equals(id); 64 65 } 66 } 67 68 return isa; 69 } 70 71 public abstract String [] getIds(); 72 } 73 | Popular Tags |