1 17 18 19 package org.apache.catalina.util; 20 21 22 import java.util.Collection ; 23 import java.util.HashSet ; 24 25 26 36 37 public final class ResourceSet extends HashSet { 38 39 40 42 43 47 public ResourceSet() { 48 49 super(); 50 51 } 52 53 54 60 public ResourceSet(int initialCapacity) { 61 62 super(initialCapacity); 63 64 } 65 66 67 74 public ResourceSet(int initialCapacity, float loadFactor) { 75 76 super(initialCapacity, loadFactor); 77 78 } 79 80 81 86 public ResourceSet(Collection coll) { 87 88 super(coll); 89 90 } 91 92 93 95 96 99 private boolean locked = false; 100 101 102 105 public boolean isLocked() { 106 107 return (this.locked); 108 109 } 110 111 112 117 public void setLocked(boolean locked) { 118 119 this.locked = locked; 120 121 } 122 123 124 127 private static final StringManager sm = 128 StringManager.getManager("org.apache.catalina.util"); 129 130 131 133 134 142 public boolean add(Object o) { 143 144 if (locked) 145 throw new IllegalStateException 146 (sm.getString("resourceSet.locked")); 147 return (super.add(o)); 148 149 } 150 151 152 157 public void clear() { 158 159 if (locked) 160 throw new IllegalStateException 161 (sm.getString("resourceSet.locked")); 162 super.clear(); 163 164 } 165 166 167 175 public boolean remove(Object o) { 176 177 if (locked) 178 throw new IllegalStateException 179 (sm.getString("resourceSet.locked")); 180 return (super.remove(o)); 181 182 } 183 184 185 } 186 | Popular Tags |