[Yanel-commits] rev 23853 -
public/yanel/trunk/src/core/java/org/wyona/yanel/core/map
josias at wyona.com
josias at wyona.com
Wed Apr 18 22:00:33 CEST 2007
Author: josias
Date: 2007-04-18 22:00:31 +0200 (Wed, 18 Apr 2007)
New Revision: 23853
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
Log:
refactoring: read root-dir config in configure() method
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java 2007-04-18 19:35:45 UTC (rev 23852)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java 2007-04-18 20:00:31 UTC (rev 23853)
@@ -52,6 +52,7 @@
private PolicyManager policyManager;
private IdentityManager identityManager;
private File configFile;
+ private File rootDir;
private String proxyHostName;
private String proxyPort;
@@ -121,13 +122,19 @@
setIdentityManager(identityManager);
}
- repoConfigElement = config.getChild("default-language", false);
- if (repoConfigElement != null) {
- setDefaultLanguage(repoConfigElement.getValue());
+ Configuration configElement = config.getChild("default-language", false);
+ if (configElement != null) {
+ setDefaultLanguage(configElement.getValue());
} else {
//Maintain backwards compatibility with realms
setDefaultLanguage("en");
}
+
+ Configuration rootDirConfig = config.getChild("root-dir", false);
+ if (rootDirConfig != null) {
+ setRootDir(FileUtil.resolve(getConfigFile(), new File(rootDirConfig.getValue())));
+ }
+
}
/**
@@ -255,23 +262,12 @@
* Please note that the root-dir element is optional
*/
public File getRootDir() {
- try {
- Configuration realmConfig = new DefaultConfigurationBuilder().buildFromFile(getConfigFile());
- Configuration rootDirConfig = realmConfig.getChild("root-dir", false);
- if (rootDirConfig != null) {
- File rootDirFile = new File(rootDirConfig.getValue());
- if (!rootDirFile.isAbsolute()) {
- return new File(org.apache.commons.io.FilenameUtils.concat(getConfigFile().getParent(), rootDirFile.toString()));
- //return new File(org.wyona.commons.io.FileUtil.concat(getConfigFile().getParent(), rootDirFile.toString()));
- } else {
- return rootDirFile;
- }
- }
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- return null;
+ return this.rootDir;
}
+
+ public void setRootDir(File rootDir) {
+ this.rootDir = rootDir;
+ }
/**
* Please note that the menu element is optional
More information about the Yanel-commits
mailing list