1 19 package gcc.rmi.iiop; 20 21 public abstract class Protocol 22 { 23 public static final int IIOP = 1; 24 public static final int IIOPS = 2; 25 public static final int HTTP = 3; 26 public static final int HTTPS = 4; 27 28 public static String getName(int protocol) 29 { 30 switch (protocol) 31 { 32 case IIOP: return "iiop"; 33 case IIOPS: return "iiop"; 34 case HTTP: return "http"; 35 case HTTPS: return "https"; 36 default: throw new IllegalArgumentException("protocol = " + protocol); 37 } 38 } 39 40 public static String getScheme(int protocol) 41 { 42 switch (protocol) 43 { 44 case IIOP: return "iiop:"; 45 case IIOPS: return "iiop:"; 46 case HTTP: return "http:"; 47 case HTTPS: return "https:"; 48 default: throw new IllegalArgumentException("protocol = " + protocol); 49 } 50 } 51 52 public static int getNumber(String protocol) 53 { 54 if (protocol.equals("iiop")) 55 { 56 return IIOP; 57 } 58 else if (protocol.equals("iiops")) 59 { 60 return IIOPS; 61 } 62 else if (protocol.equals("http")) 63 { 64 return HTTP; 65 } 66 else if (protocol.equals("https")) 67 { 68 return HTTPS; 69 } 70 else 71 { 72 throw new IllegalArgumentException("protocol = " + protocol); 73 } 74 } 75 } 76 | Popular Tags |