1 17 package org.apache.forrest.conf; 18 19 import org.apache.commons.lang.SystemUtils; 20 21 49 public class ForrestConfUtils 50 { 51 public final static String defaultHome = "context:/"; 52 53 private final static String getSystemProperty(String propertyName) { 54 55 String propertyValue = System.getProperty(propertyName, defaultHome); 57 return propertyValue; 58 } 59 60 public static String getForrestHome() throws Exception { 61 62 return getSystemProperty("forrest.home"); 69 } 70 71 public static String getProjectHome() throws Exception { 72 String projectHome = getSystemProperty("project.home"); 73 if (projectHome.equals(defaultHome)) { 74 projectHome = defaultHome + SystemUtils.FILE_SEPARATOR + "/project"; 75 } 76 return projectHome; 77 } 78 79 public static String getContextHome() throws Exception { 80 String forrestHome = getForrestHome(); 81 String contextHome; 82 if (forrestHome.equals(defaultHome)) { 83 contextHome = defaultHome; 84 } else { 85 contextHome = forrestHome + SystemUtils.FILE_SEPARATOR + "main/webapp"; 88 } 89 return contextHome; 90 } 91 92 98 public static void aliasSkinProperties(AntProperties props) { 99 String skinName = props.getProperty("project.skin"); 100 if (skinName.equals("crust")) { 101 setSkinToUse(props, "krysalis-site"); 102 } else if (skinName.equals("avalon-tigris") 103 || skinName.equals("tigris-style")) { 104 setSkinToUse(props, "tigris"); 105 } else if (skinName.equals("forrest-css")) { 106 setSkinToUse(props, "pelt"); 107 } 108 } 109 110 116 private static void setSkinToUse(AntProperties props, String skinStoUse) { 117 props.remove("project.skin"); 119 props.setProperty("project.skin", skinStoUse); 120 } 121 122 } 123 | Popular Tags |