1 16 17 package org.apache.jetspeed.services.registry; 18 19 import org.apache.jetspeed.services.Registry; 20 import org.apache.jetspeed.om.registry.RegistryEntry; 21 import java.util.Vector ; 22 import java.util.Hashtable ; 23 import java.util.Iterator ; 24 25 32 public class RegistryFragment extends Hashtable implements java.io.Serializable 33 { 34 35 38 private transient boolean dirty = false; 39 40 43 private transient boolean changed = false; 44 45 47 public boolean isDirty() 48 { 49 return this.dirty; 50 } 51 52 57 public void setDirty(boolean value) 58 { 59 this.dirty = value; 60 } 61 62 64 public boolean hasChanged() 65 { 66 return this.changed; 67 } 68 69 74 public void setChanged(boolean value) 75 { 76 this.changed = value; 77 } 78 79 84 public Vector getEntries(String name) 85 { 86 87 if (name != null) 88 { 89 Vector registry = (Vector )get(name); 90 91 if (registry != null) 92 { 93 return registry; 94 } 95 } 96 97 return new Vector (); 98 } 99 100 105 public void addEntry(String name, RegistryEntry entry) 106 { 107 if ( (name != null) && (entry != null) ) 108 { 109 Vector registry = (Vector )get(name); 110 111 if (registry != null) 112 { 113 registry.add(entry); 114 } 115 } 116 } 117 118 122 public void removeEntry(String name, String entryName) 123 { 124 if ( (name != null) && (entryName != null) ) 125 { 126 Vector registry = (Vector )get(name); 127 if (registry != null) 128 { 129 Iterator i = registry.iterator(); 130 while(i.hasNext()) 131 { 132 RegistryEntry regEntry = (RegistryEntry)i.next(); 133 if (entryName.equals(regEntry.getName())) 134 { 135 i.remove(); 136 } 137 } 138 } 139 } 140 } 141 142 146 public void setEntry(String name, RegistryEntry entry) 147 { 148 if (entry!=null) 149 { 150 removeEntry(name,entry.getName()); 151 addEntry(name,entry); 152 } 153 } 154 155 157 public Vector getPortlets() 158 { 159 return (Vector )get(Registry.PORTLET); 160 } 161 162 public void setPortlets(Vector portlets) 163 { 164 if (portlets!=null) 165 { 166 put(Registry.PORTLET,portlets); 167 } 168 } 169 170 public Vector getControls() 171 { 172 return (Vector )get(Registry.PORTLET_CONTROL); 173 } 174 175 public void setControls(Vector controls) 176 { 177 if (controls!=null) 178 { 179 put(Registry.PORTLET_CONTROL,controls); 180 } 181 } 182 183 public Vector getControllers() 184 { 185 return (Vector )get(Registry.PORTLET_CONTROLLER); 186 } 187 188 public void setControllers(Vector controllers) 189 { 190 if (controllers!=null) 191 { 192 put(Registry.PORTLET_CONTROLLER,controllers); 193 } 194 } 195 196 public Vector getMedias() 197 { 198 return (Vector )get(Registry.MEDIA_TYPE); 199 } 200 201 public void setMedias(Vector medias) 202 { 203 if (medias!=null) 204 { 205 put(Registry.MEDIA_TYPE,medias); 206 } 207 } 208 209 public Vector getSkins() 210 { 211 return (Vector )get(Registry.SKIN); 212 } 213 214 public void setSkins(Vector skins) 215 { 216 if (skins!=null) 217 { 218 put(Registry.SKIN,skins); 219 } 220 } 221 222 public Vector getSecurityEntries() 223 { 224 return (Vector )get(Registry.SECURITY); 225 } 226 227 public void setSecurityEntries(Vector securityEntries) 228 { 229 if (securityEntries!=null) 230 { 231 put(Registry.SECURITY, securityEntries); 232 } 233 } 234 235 public Vector getClients() 236 { 237 return (Vector )get(Registry.CLIENT); 238 } 239 240 public void setClients(Vector clients) 241 { 242 if (clients!=null) 243 { 244 put(Registry.CLIENT, clients); 245 } 246 } 247 } 248 | Popular Tags |