1 21 22 27 28 package javax.activation; 29 30 import java.io.*; 31 import java.beans.Beans ; 32 33 46 47 public class CommandInfo { 48 private String verb; 49 private String className; 50 51 56 public CommandInfo(String verb, String className) { 57 this.verb = verb; 58 this.className = className; 59 } 60 61 66 public String getCommandName() { 67 return verb; 68 } 69 70 80 public String getCommandClass() { 81 return className; 82 } 83 84 114 public Object getCommandObject(DataHandler dh, ClassLoader loader) 115 throws IOException, ClassNotFoundException { 116 Object new_bean = null; 117 118 new_bean = java.beans.Beans.instantiate(loader, className); 120 121 if (new_bean != null) { 123 if (new_bean instanceof CommandObject ) { 124 ((CommandObject )new_bean).setCommandContext(verb, dh); 125 } else if (new_bean instanceof Externalizable) { 126 if (dh != null) { 127 InputStream is = dh.getInputStream(); 128 if (is != null) { 129 ((Externalizable)new_bean).readExternal( 130 new ObjectInputStream(is)); 131 } 132 } 133 } 134 } 135 136 return new_bean; 137 } 138 } 139 | Popular Tags |