1 45 package org.openejb.client; 46 47 import java.io.Externalizable ; 48 import java.io.IOException ; 49 import java.io.ObjectInput ; 50 import java.io.ObjectOutput ; 51 import java.net.InetAddress ; 52 import java.net.UnknownHostException ; 53 import java.net.URI ; 54 import java.net.URISyntaxException ; 55 56 57 58 63 public class ServerMetaData implements Externalizable { 64 65 private transient URI location; 66 67 public ServerMetaData(){ 68 } 69 70 public ServerMetaData(URI location) { 71 this.location = location; 72 } 73 74 public int getPort(){ 75 return location.getPort(); 76 } 77 78 public String getHost() { 79 return location.getHost(); 80 } 81 82 83 public URI getLocation() { 84 return location; 85 } 86 87 public void readExternal(ObjectInput in) throws IOException ,ClassNotFoundException { 88 String uri = (String ) in.readObject(); 89 try{ 90 location = new URI (uri); 91 } catch (URISyntaxException e) { 92 throw (IOException )new IOException ("cannot create uri from '"+uri+"'").initCause(e); 93 } 94 } 95 96 public void writeExternal(ObjectOutput out) throws IOException { 97 out.writeObject(location.toString()); 98 } 99 100 } 101 102 | Popular Tags |