1 17 package org.apache.geronimo.kernel.config; 18 19 import java.util.LinkedHashSet ; 20 import java.util.LinkedHashMap ; 21 import java.util.Set ; 22 import java.util.Map ; 23 import java.util.Collections ; 24 import java.util.Iterator ; 25 import java.io.Serializable ; 26 27 import org.apache.geronimo.kernel.repository.Artifact; 28 29 33 public class LifecycleResults implements Serializable { 34 private static final long serialVersionUID = 4660197333193740244L; 35 private final Set loaded = new LinkedHashSet (); 36 private final Set unloaded = new LinkedHashSet (); 37 private final Set started = new LinkedHashSet (); 38 private final Set stopped = new LinkedHashSet (); 39 private final Map failed = new LinkedHashMap (); 40 41 49 public boolean wasLoaded(Artifact configurationId) { 50 return loaded.contains(configurationId); 51 } 52 53 57 public Set getLoaded() { 58 return Collections.unmodifiableSet(loaded); 59 } 60 61 65 public void addLoaded(Artifact configurationId) { 66 loaded.add(configurationId); 67 } 68 69 73 public void setLoaded(Set loaded) { 74 this.loaded.clear(); 75 this.loaded.addAll(loaded); 76 } 77 78 86 public boolean wasUnloaded(Artifact configurationId) { 87 return unloaded.contains(configurationId); 88 } 89 90 94 public Set getUnloaded() { 95 return Collections.unmodifiableSet(unloaded); 96 } 97 98 102 public void addUnloaded(Artifact configurationId) { 103 unloaded.add(configurationId); 104 } 105 106 110 public void setUnloaded(Set unloaded) { 111 this.unloaded.clear(); 112 this.unloaded.addAll(unloaded); 113 } 114 115 123 public boolean wasStarted(Artifact configurationId) { 124 return started.contains(configurationId); 125 } 126 127 131 public Set getStarted() { 132 return Collections.unmodifiableSet(started); 133 } 134 135 139 public void addStarted(Artifact configurationId) { 140 started.add(configurationId); 141 } 142 143 147 public void setStarted(Set started) { 148 this.started.clear(); 149 this.started.addAll(started); 150 } 151 152 160 public boolean wasStopped(Artifact configurationId) { 161 return stopped.contains(configurationId); 162 } 163 164 168 public Set getStopped() { 169 return Collections.unmodifiableSet(stopped); 170 } 171 172 176 public void addStopped(Artifact configurationId) { 177 stopped.add(configurationId); 178 } 179 180 184 public void setStopped(Set stopped) { 185 this.stopped.clear(); 186 this.stopped.addAll(stopped); 187 } 188 189 201 public boolean wasFailed(Artifact configurationId) { 202 for (Iterator it = failed.keySet().iterator(); it.hasNext();) { 203 Artifact failID = (Artifact) it.next(); 204 if(configurationId.matches(failID)) { 205 return true; 206 } 207 } 208 return false; 209 } 210 211 215 public Throwable getFailedCause(Artifact configurationId) { 216 return (Throwable ) failed.get(configurationId); 217 } 218 219 223 public Map getFailed() { 224 return Collections.unmodifiableMap(failed); 225 } 226 227 232 public void addFailed(Artifact configurationId, Throwable cause) { 233 failed.put(configurationId, cause); 234 } 235 236 240 public void setFailed(Map failed) { 241 this.failed.clear(); 242 this.failed.putAll(failed); 243 } 244 } 245 | Popular Tags |