1 14 package org.wings.externalizer; 15 16 import java.util.Collections ; 17 import java.util.HashMap ; 18 import java.util.Map ; 19 20 31 32 public class SystemExternalizeManager extends AbstractExternalizeManager { 33 36 private static final SystemExternalizeManager sharedInstance = new SystemExternalizeManager(); 37 38 private final String MY_PREFIX_TIMESLICE_STRING = "-" + PREFIX_TIMESLICE_STRING; 39 40 protected final Map externalized; 41 42 43 private SystemExternalizeManager() { 44 externalized = Collections.synchronizedMap(new HashMap ()); 45 } 46 47 52 public static SystemExternalizeManager getSharedInstance() { 53 return sharedInstance; 54 } 55 56 57 protected String getPrefix() { 58 return MY_PREFIX_TIMESLICE_STRING; 59 } 60 61 protected void storeExternalizedResource(String identifier, 62 ExternalizedResource extInfo) { 63 if (log.isDebugEnabled()) { 64 log.debug("store identifier " + identifier + " " + extInfo.getObject().getClass()); 65 log.debug("flags " + extInfo.getFlags()); 66 } 67 68 externalized.put(identifier, extInfo); 69 } 70 71 public ExternalizedResource getExternalizedResource(String identifier) { 72 if (identifier == null || identifier.length() < 1) 73 return null; 74 75 log.debug("system externalizer: " + identifier); 76 77 int pos = identifier.indexOf("."); 78 if (pos > -1) { 79 identifier = identifier.substring(0, pos); 80 } 81 82 log.debug("system externalizer " + identifier); 83 return (ExternalizedResource) externalized.get(identifier); 84 } 85 86 public final void removeExternalizedResource(String identifier) { 87 externalized.remove(identifier); 88 } 89 } 90 91 92 93 | Popular Tags |