Prints the names of the protocols, from the bottom to top. If include_properties is true, the properties for each protocol will also be printed.
(boolean include_properties)
| 285 | * the properties for each protocol will also be printed. |
| 286 | */ |
| 287 | public String printProtocolSpec(boolean include_properties) { |
| 288 | StringBuilder sb=new StringBuilder(); |
| 289 | List<Protocol> protocols=getProtocols(); |
| 290 | |
| 291 | if(protocols == null || protocols.isEmpty()) return null; |
| 292 | boolean first_colon_printed=false; |
| 293 | |
| 294 | Collections.reverse(protocols); |
| 295 | for(Protocol prot: protocols) { |
| 296 | String prot_name=prot.getClass().getName(); |
| 297 | int index=prot_name.indexOf(Global.PREFIX); |
| 298 | if(index >= 0) |
| 299 | prot_name=prot_name.substring(Global.PREFIX.length()); |
| 300 | if(first_colon_printed) |
| 301 | sb.append(":"); |
| 302 | else |
| 303 | first_colon_printed=true; |
| 304 | |
| 305 | sb.append(prot_name); |
| 306 | if(include_properties) { |
| 307 | Map<String,String> tmp=getProps(prot); |
| 308 | if(!tmp.isEmpty()) { |
| 309 | boolean printed=false; |
| 310 | sb.append("("); |
| 311 | for(Map.Entry<String,String> entry: tmp.entrySet()) { |
| 312 | if(printed) |
| 313 | sb.append(";"); |
| 314 | else |
| 315 | printed=true; |
| 316 | sb.append(entry.getKey()).append("=").append(entry.getValue()); |
| 317 | } |
| 318 | sb.append(")\n"); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | return sb.toString(); |
| 323 | } |
| 324 | |
| 325 | public String printProtocolSpecAsXML() { |
| 326 | StringBuilder sb=new StringBuilder(); |