1 23 24 package com.sun.enterprise.appclient.jws; 25 26 import java.io.BufferedReader ; 27 import java.io.IOException ; 28 import java.io.InputStream ; 29 import java.io.InputStreamReader ; 30 import java.util.HashMap ; 31 import java.util.Map ; 32 33 39 public class TemplateCache { 40 41 42 private static final String TEMPLATES_PATH_PREFIX = "templates/"; 43 44 45 private Map <String ,String > templateCache; 46 47 48 49 public TemplateCache() { 50 templateCache = new HashMap <String ,String >(); 51 } 52 53 59 public String getTemplate(String templateName) throws IOException { 60 61 65 String template = templateCache.get(templateName); 66 if (template == null) { 67 template = Util.loadResource(this.getClass(), TEMPLATES_PATH_PREFIX + templateName); 68 templateCache.put(templateName, template); 69 } 70 71 74 return template; 75 } 76 } | Popular Tags |