1 48 49 package org.jpublish.template; 50 51 import java.io.IOException ; 52 53 import com.anthonyeden.lib.config.Configuration; 54 import com.anthonyeden.lib.config.ConfigurationException; 55 import org.jpublish.ManagerBase; 56 57 63 64 public abstract class AbstractTemplateManager extends ManagerBase 65 implements TemplateManager { 66 67 protected String name = null; 68 protected boolean writeAllowed = false; 69 70 79 80 public String get(String path) 81 throws IOException , TemplateNotFoundException { 82 return getTemplate(path).getText(); 83 } 84 85 90 91 public String getName() { 92 return name; 93 } 94 95 100 101 public void setName(String name) { 102 this.name = name; 103 } 104 105 110 111 public boolean isWriteAllowed() { 112 return writeAllowed; 113 } 114 115 120 121 public void setWriteAllowed(boolean writeAllowed) { 122 this.writeAllowed = writeAllowed; 123 } 124 125 130 131 public void setWriteAllowed(String writeAllowed) { 132 if (writeAllowed != null) { 133 setWriteAllowed("true".equals(writeAllowed)); 134 } 135 } 136 137 143 144 public void loadConfiguration(Configuration configuration) 145 throws ConfigurationException { 146 super.loadConfiguration(configuration); 147 setName(configuration.getAttribute("name")); 148 setWriteAllowed(configuration.getChildValue("write-allowed")); 149 } 150 151 } 152 | Popular Tags |