1 4 package org.oddjob.arooa.registry; 5 6 import java.io.Serializable ; 7 8 12 public class Address implements Serializable { 13 private static final long serialVersionUID = 20051117; 14 15 16 private final ServerId serverId; 17 18 19 private final Path path; 20 21 26 public Address(Path path) { 27 this(ServerId.local(), path); 28 } 29 30 36 public Address(ServerId serverId, Path path) { 37 if (path == null) { 38 throw new NullPointerException ("Path must not be null."); 39 } 40 if (serverId == null) { 41 throw new NullPointerException ("URL must not be null."); 42 } 43 this.path = path; 44 this.serverId = serverId; 45 } 46 47 52 public Path getPath() { 53 return path; 54 } 55 56 61 public ServerId getServerId() { 62 return serverId; 63 } 64 65 69 public String toString() { 70 return serverId.toString() + ":" + path.toString(); 71 } 72 73 79 public static String arrayAsString(Address[] addresses) { 80 if (addresses.length == 0) { 81 return "[No Addresses]"; 82 } 83 StringBuffer buf = new StringBuffer (); 84 for (int i = 0; i < addresses.length; ++i) { 85 buf.append("["); 86 buf.append(addresses[i].toString()); 87 buf.append("]"); 88 } 89 return buf.toString(); 90 } 91 } 92 | Popular Tags |