1 5 package org.exoplatform.container.configuration; 6 7 import java.io.File ; 8 import java.net.URL ; 9 import javax.servlet.ServletContext ; 10 16 public class MockConfigurationManagerImpl extends ConfigurationManagerImpl { 17 private String confDir_ ; 18 19 public MockConfigurationManagerImpl(ServletContext context) throws Exception { 20 super(context) ; 21 File currentDir = new File ("") ; 22 String path = currentDir.getAbsolutePath() ; 23 int idx = path.indexOf("exoplatform") ; 24 if(idx < 0) { 25 path = System.getProperty("maven.exoplatform.dir") + "/" ; 26 confDir_ = path + "/web/portal/src/webapp/WEB-INF" ; 27 } else { 28 path = path.substring(0, idx) ; 29 path = path.replace('\\', '/') ; 30 confDir_ = path + "exoplatform/web/portal/src/webapp/WEB-INF" ; 31 } 32 } 33 34 protected URL getURL(String uri) throws Exception { 35 if(uri.startsWith("jar:")) { 36 String path = removePrefix("jar:/", uri) ; 37 ClassLoader cl = Thread.currentThread().getContextClassLoader() ; 38 return cl.getResource(path) ; 39 } else if(uri.startsWith("war:")) { 40 String path = removePrefix("war:", uri) ; 41 URL url = new URL ("file:" + confDir_ + path) ; 42 return url ; 43 } else if(uri.startsWith("file:")) { 44 return new URL (uri) ; 45 } 46 return null ; 47 } 48 } | Popular Tags |