1 26 27 package org.objectweb.jonas_web.deployment.api; 28 29 import java.util.ArrayList ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 33 39 public class TransportGuaranteeDesc { 40 41 44 public static final String CONFIDENTIAL_TRANSPORT = "CONFIDENTIAL"; 45 46 49 public static final String INTEGRAL_TRANSPORT = "INTEGRAL"; 50 51 54 public static final String NONE_TRANSPORT = "NONE"; 55 56 59 private List transports = null; 60 61 64 public TransportGuaranteeDesc() { 65 transports = new ArrayList (); 66 } 67 68 69 75 public void addTransportValue(String name) { 76 if (name == null) { 77 name = NONE_TRANSPORT; 78 } 79 String upperCasename = name.toUpperCase(); 80 if (!transports.contains(upperCasename)) { 81 transports.add(upperCasename); 82 } 83 } 84 85 89 public boolean isIntegral() { 90 return transports.contains(INTEGRAL_TRANSPORT); 91 } 92 93 97 public boolean isConfidential() { 98 return transports.contains(CONFIDENTIAL_TRANSPORT); 99 } 100 101 105 public boolean hasNone() { 106 return transports.contains(NONE_TRANSPORT); 107 } 108 109 110 114 public int getNumber() { 115 return transports.size(); 116 } 117 118 119 123 public String toString() { 124 StringBuffer sb = new StringBuffer (); 125 sb.append("TransportGuarantee[values="); 126 for (Iterator it = transports.iterator(); it.hasNext();) { 127 String value = (String ) it.next(); 128 sb.append("("); 129 sb.append(value); 130 sb.append(")"); 131 } 132 sb.append("]"); 133 return sb.toString(); 134 } 135 136 } 137 | Popular Tags |