1 37 38 package org.jahia.blogs.actions; 39 40 import org.jahia.params.ParamBean; 41 42 import java.io.FileInputStream ; 43 import java.io.IOException ; 44 import java.io.File ; 45 46 import java.util.Properties ; 47 48 import org.apache.log4j.Logger; 49 50 116 public class BlogDefinitionNames { 117 118 static Logger log = Logger.getLogger(BlogDefinitionNames.class); 120 121 public static final String RELATIVE_PATH = "/WEB-INF/etc/config/blogs.properties"; 122 123 public static final String BLOG_POSTS_LIST_NAME = "postContainerList"; 124 public static final String POST_TITLE = "postTitle"; 125 public static final String POST_BODY = "postBody"; 126 public static final String POST_DATE = "postDate"; 127 public static final String POST_AUTHOR = "postAuthor"; 128 public static final String POST_EXCERPT = "postExcerpt"; 129 public static final String POST_KEYWORDS= "postKeyWords"; 130 131 public static final String BLOG_TB_PING_LIST = "tbPings"; 132 public static final String TB_PING_URL = "tbPingURL"; 133 134 public static final String BLOG_TB_LIST = "postTB_Pings"; 135 public static final String TB_URL = "trackBackUrl"; 136 public static final String TB_TITLE = "trackBackTitle"; 137 public static final String TB_BLOG_NAME = "trackBackBlogName"; 138 public static final String TB_EXCERPT = "trackBackExcerpt"; 139 public static final String TB_PING_IP = "pingIP"; 140 141 private Properties names; 142 private ParamBean jParams; 143 144 145 public BlogDefinitionNames(ParamBean jParams) { 146 try { 147 this.jParams = jParams; 148 names = new Properties (); 149 load(); 150 151 } catch (IOException e) { 152 e.printStackTrace(); 153 } 154 } 155 156 159 private void load() throws IOException { 160 161 FileInputStream fis = new FileInputStream (getFile()); 162 names.load(fis); 163 fis.close(); 164 165 } 184 185 188 public String getValue(String name) { 189 return names.getProperty(name); 190 } 191 192 195 private File getFile() throws IOException { 196 return new File (jParams.settings().getPathResolver(). 197 resolvePath(RELATIVE_PATH)); 198 } 199 } 200 | Popular Tags |