dblevins 2005/07/09 01:53:21
Modified: modules/core/src/java/org/openejb/util ClasspathUtils.java
FileUtils.java Logger.java
Log:
Yanking getBase(props) and getHome(props) calls and replacing with a one-time
call to:
FileUtils.init(props)
Which will reset the home and base instances.
Revision Changes Path
1.13 +3 -3
openejb1/modules/core/src/java/org/openejb/util/ClasspathUtils.java
Index: ClasspathUtils.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/util/ClasspathUtils.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ClasspathUtils.java 6 Jul 2005 23:42:08 -0000 1.12
+++ ClasspathUtils.java 9 Jul 2005 05:53:21 -0000 1.13
@@ -106,11 +106,11 @@
}
public static void addJarsToPath(String dir, String loaderName,
Hashtable env) throws Exception {
- File dirAtBase = FileUtils.getBase(env).getDirectory(dir);
+ File dirAtBase = FileUtils.getBase().getDirectory(dir);
if (dirAtBase != null && dirAtBase.exists()) {
addJarsToPath(dirAtBase, loaderName);
}
- File dirAtHome = FileUtils.getHome(env).getDirectory(dir);
+ File dirAtHome = FileUtils.getHome().getDirectory(dir);
if (! dirAtHome.equals(dirAtBase)) {
addJarsToPath(dirAtHome, loaderName);
}
1.6 +12 -15
openejb1/modules/core/src/java/org/openejb/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/util/FileUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FileUtils.java 16 Jun 2005 22:29:53 -0000 1.5
+++ FileUtils.java 9 Jul 2005 05:53:21 -0000 1.6
@@ -63,6 +63,11 @@
private static FileUtils openejbHomeUtils = new
FileUtils("openejb.home", "user.dir");
private static FileUtils openejbBaseUtils = new
FileUtils("openejb.base", "openejb.home");
+ public static void init(Properties properties){
+ openejbHomeUtils = new FileUtils("openejb.home", "user.dir",
properties);
+ openejbBaseUtils = new FileUtils("openejb.base", "openejb.home",
properties);
+ }
+
private File home;
private FileUtils(String homeDir, String defaultDir) {
@@ -97,18 +102,10 @@
return openejbBaseUtils;
}
- public static FileUtils getBase(Hashtable env) {
- return new FileUtils("openejb.base", "openejb.home", env);
- }
-
public static FileUtils getHome() {
return openejbHomeUtils;
}
- public static FileUtils getHome(Hashtable env) {
- return new FileUtils("openejb.home", "user.dir", env);
- }
-
/**
* @see #getDirectory(String, boolean)
*/
@@ -264,7 +261,7 @@
}
}
- public static String getAbsolutePath(String path, String secondaryPath,
Properties props, boolean create)
+ public static String getAbsolutePath(String path, String secondaryPath,
boolean create)
throws OpenEJBException {
File file = null;
@@ -282,7 +279,7 @@
* [2] Try finding the file relative to the openejb.base
directory
*/
try {
- file = FileUtils.getBase(props).getFile(path);
+ file = FileUtils.getBase().getFile(path);
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
@@ -294,7 +291,7 @@
* [3] Try finding the file relative to the openejb.home
directory
*/
try {
- file = FileUtils.getHome(props).getFile(path);
+ file = FileUtils.getHome().getFile(path);
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
@@ -310,7 +307,7 @@
* openejb.base directory
*/
try {
- file = FileUtils.getBase(props).getFile(secondaryPath);
+ file = FileUtils.getBase().getFile(secondaryPath);
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
@@ -322,7 +319,7 @@
* openejb.home directory
*/
try {
- file = FileUtils.getHome(props).getFile(secondaryPath);
+ file = FileUtils.getHome().getFile(secondaryPath);
if (file != null && file.exists() && file.isFile()) {
return file.getAbsolutePath();
}
@@ -336,7 +333,7 @@
// We should log this.
if (create)
{
- File confDir = FileUtils.getBase(props).getDirectory("conf",
true);
+ File confDir = FileUtils.getBase().getDirectory("conf",
true);
file = createConfig(new File(confDir, secondaryPath));
}
1.9 +5 -5
openejb1/modules/core/src/java/org/openejb/util/Logger.java
Index: Logger.java
===================================================================
RCS file:
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/util/Logger.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Logger.java 19 Jun 2005 22:40:33 -0000 1.8
+++ Logger.java 9 Jul 2005 05:53:21 -0000 1.9
@@ -1611,7 +1611,7 @@
}
try{
// resolve the config file location
- config = FileUtils.getAbsolutePath(config,
"conf/default.logging.conf", props, false);
+ config = FileUtils.getAbsolutePath(config,
"conf/default.logging.conf", false);
// load the config
Properties log4jProps = loadProperties(config);
@@ -1649,9 +1649,9 @@
if (name.endsWith(".File")) {
String path = log4jProps.getProperty(name);
try {
- File file = FileUtils.getBase(props).getFile(path,
false);
+ File file = FileUtils.getBase().getFile(path, false);
if (!file.getParentFile().exists()) {
- file = FileUtils.getHome(props).getFile(path,
false);
+ file = FileUtils.getHome().getFile(path, false);
}
path = file.getPath();
} catch (IOException ignored) {