1 14 15 package org.quickserver.util.xmlreader; 16 17 import java.util.*; 18 19 42 public class Secure implements java.io.Serializable { 43 private boolean enable = false; 44 private boolean load = false; 45 private int port = -1; private String protocol = "TLS"; 47 private boolean clientAuthEnable = false; 48 private SecureStore secureStore = new SecureStore(); 49 50 58 public void setEnable(boolean enable) { 59 this.enable = enable; 60 if(enable==true) { 61 setLoad(true); 62 } 63 } 64 68 public boolean getEnable() { 69 return enable; 70 } 71 74 public boolean isEnable() { 75 return enable; 76 } 77 78 79 86 public void setLoad(boolean load) { 87 this.load = load; 88 } 89 93 public boolean getLoad() { 94 return load; 95 } 96 99 public boolean isLoad() { 100 return load; 101 } 102 103 110 public void setPort(int port) { 111 if(port>=0) 112 this.port = port; 113 } 114 118 public int getPort() { 119 return port; 120 } 121 122 123 130 public void setProtocol(String protocol) { 131 if(protocol!=null && protocol.trim().length()!=0) 132 this.protocol = protocol; 133 } 134 138 public String getProtocol() { 139 return protocol; 140 } 141 142 150 public void setClientAuthEnable(boolean enable) { 151 this.clientAuthEnable = enable; 152 } 153 158 public boolean getClientAuthEnable() { 159 return clientAuthEnable; 160 } 161 165 public boolean isClientAuthEnable() { 166 return clientAuthEnable; 167 } 168 169 175 public void setSecureStore(SecureStore secureStore) { 176 if(secureStore!=null) 177 this.secureStore = secureStore; 178 } 179 183 public SecureStore getSecureStore() { 184 return secureStore; 185 } 186 187 190 public String toXML(String pad) { 191 if(pad==null) pad=""; 192 StringBuffer sb = new StringBuffer (); 193 sb.append(pad+"<secure>\n"); 194 sb.append(pad+"\t<enable>"+getEnable()+"</enable>\n"); 195 sb.append(pad+"\t<load>"+getLoad()+"</load>\n"); 196 if(getPort()!=-1) 197 sb.append(pad+"\t<port>"+getPort()+"</port>\n"); 198 sb.append(pad+"\t<protocol>"+getProtocol()+"</protocol>\n"); 199 sb.append(pad+"\t<client-auth-enable>"+ 200 getClientAuthEnable()+"</client-auth-enable>\n"); 201 if(getSecureStore()!=null) { 202 sb.append(getSecureStore().toXML(pad+"\t")); 203 } 204 sb.append(pad+"</secure>\n"); 205 return sb.toString(); 206 } 207 } 208 | Popular Tags |