1 7 8 package java.rmi.activation; 9 10 import java.io.IOException ; 11 import java.rmi.MarshalledObject ; 12 import java.util.Arrays ; 13 import java.util.ArrayList ; 14 import java.util.Collection ; 15 import java.util.Collections ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 import java.util.Properties ; 19 20 21 46 public final class ActivationGroupDesc implements java.io.Serializable { 47 48 51 private String className; 52 53 56 private String location; 57 58 61 private MarshalledObject data; 62 63 67 private CommandEnvironment env; 68 69 73 private Properties props; 74 75 76 private static final long serialVersionUID = -4936225423168276595L; 77 78 97 public ActivationGroupDesc(Properties overrides, 98 CommandEnvironment cmd) 99 { 100 this(null, null, null, overrides, cmd); 101 } 102 103 121 public ActivationGroupDesc(String className, 122 String location, 123 MarshalledObject data, 124 Properties overrides, 125 CommandEnvironment cmd) 126 { 127 this.props = overrides; 128 this.env = cmd; 129 this.data = data; 130 this.location = location; 131 this.className = className; 132 } 133 134 141 public String getClassName() { 142 return className; 143 } 144 145 150 public String getLocation() { 151 return location; 152 } 153 154 159 public MarshalledObject getData() { 160 return data; 161 } 162 163 168 public Properties getPropertyOverrides() { 169 return (props != null) ? (Properties ) props.clone() : null; 170 } 171 172 177 public CommandEnvironment getCommandEnvironment() { 178 return this.env; 179 } 180 181 182 189 public static class CommandEnvironment 190 implements java.io.Serializable 191 { 192 private static final long serialVersionUID = 6165754737887770191L; 193 194 197 private String command; 198 199 202 private String [] options; 203 204 219 public CommandEnvironment(String cmdpath, 220 String [] argv) 221 { 222 this.command = cmdpath; 224 if (argv == null) { 226 this.options = null; 227 } else { 228 this.options = new String [argv.length]; 229 System.arraycopy(argv, 0, this.options, 0, argv.length); 230 } 231 } 232 233 240 public String getCommandPath() { 241 return (this.command); 242 } 243 244 254 public String [] getCommandOptions() { 255 return (this.options != null 256 ? (String []) this.options.clone() 257 : new String [0]); 258 } 259 260 268 public boolean equals(Object obj) { 269 270 if (obj instanceof CommandEnvironment) { 271 CommandEnvironment env = (CommandEnvironment) obj; 272 return 273 ((command == null ? env.command == null : 274 command.equals(env.command)) && 275 Arrays.equals(options, env.options)); 276 } else { 277 return false; 278 } 279 } 280 281 287 public int hashCode() 288 { 289 return (command == null ? 0 : command.hashCode()); 291 } 292 } 293 294 302 public boolean equals(Object obj) { 303 304 if (obj instanceof ActivationGroupDesc ) { 305 ActivationGroupDesc desc = (ActivationGroupDesc ) obj; 306 return 307 ((className == null ? desc.className == null : 308 className.equals(desc.className)) && 309 (location == null ? desc.location == null : 310 location.equals(desc.location)) && 311 (data == null ? desc.data == null : data.equals(desc.data)) && 312 (env == null ? desc.env == null : env.equals(desc.env)) && 313 (props == null ? desc.props == null : 314 props.equals(desc.props))); 315 } else { 316 return false; 317 } 318 } 319 320 325 public int hashCode() 326 { 327 return ((location == null 330 ? 0 331 : location.hashCode() << 24) ^ 332 (env == null 333 ? 0 334 : env.hashCode() << 16) ^ 335 (className == null 336 ? 0 337 : className.hashCode() << 8) ^ 338 (data == null 339 ? 0 340 : data.hashCode())); 341 } 342 343 } 344 345 | Popular Tags |