perfsonar-dev - perfsonar: r3857 - in trunk/perfsonar_base/src/main/java/org/perfsonar: base/auxiliary service/base/container/listeners
Subject: perfsonar development work
List archive
perfsonar: r3857 - in trunk/perfsonar_base/src/main/java/org/perfsonar: base/auxiliary service/base/container/listeners
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3857 - in trunk/perfsonar_base/src/main/java/org/perfsonar: base/auxiliary service/base/container/listeners
- Date: Tue, 20 May 2008 08:45:28 -0400
Author: michael.bischoff
Date: 2008-05-20 08:45:28 -0400 (Tue, 20 May 2008)
New Revision: 3857
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
Log:
Added temp directory lookup for storing temp files
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
2008-05-20 12:35:17 UTC (rev 3856)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/base/auxiliary/AuxiliaryComponentManager.java
2008-05-20 12:45:28 UTC (rev 3857)
@@ -47,6 +47,8 @@
private ConcurrentMap<String,AuxiliaryComponent> components = new
ConcurrentHashMap<String,AuxiliaryComponent>();
private String webInfLocation;
+
+ private File tempDirectory;
// ------------------------------------------------------------
Constructor
/**
@@ -185,6 +187,15 @@
}
+ /**
+ * Should be set and thus this shouldn't return null
+ * @return temp directory that exist can be read and written to or null
+ * if this
{@link
AuxiliaryComponentManager} was incorrectly configured
+ */
+ public File getTempDirectory() {
+ return tempDirectory;
+ }
+
// --------------------------------------------------------- static
methods
/**
* Method creates Auxiliary Component Manager and load all components.
@@ -258,6 +269,10 @@
return (file.exists()) ? file : null;
}
+ /**
+ * Set the WebInf Location, a application doesn't necessarily need to do
this.
+ * @param location
+ */
public static void setWebInfLocation(String location) {
logger.fine("WEB-INF location set to: " +location);
// normalise
@@ -271,6 +286,17 @@
}
}
+ /**
+ * Sets the temp directory of the application this needs to be set.
+ * @param directory
+ */
+ public static void setTempDirectory(File directory) {
+ if(!directory.exists()) throw new IllegalArgumentException("Temp
directory doesn't exist.");
+ if(!directory.canRead()) throw new IllegalArgumentException("Temp
directory can't be read");
+ if(!directory.canWrite()) throw new IllegalArgumentException("Temp
directory can't be written to.");
+ componentManager.tempDirectory = directory;
+ }
+
private static String slashify(String path) {
String p = path;
if (File.separatorChar != '/')
@@ -279,5 +305,5 @@
p = "/" + p;
return p;
}
-
+
} //AuxiliaryComponentManager
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
2008-05-20 12:35:17 UTC (rev 3856)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/container/listeners/StartupInitializer.java
2008-05-20 12:45:28 UTC (rev 3857)
@@ -3,6 +3,7 @@
package org.perfsonar.service.base.container.listeners;
+import java.io.File;
import java.util.Iterator;
import java.util.Map;
@@ -31,6 +32,9 @@
String location = sce.getServletContext().getRealPath("/WEB-INF/");
AuxiliaryComponentManager.setWebInfLocation(location);
+ File tempDirectory = (File)
sce.getServletContext().getAttribute("javax.servlet.context.tempdir");
+ AuxiliaryComponentManager.setTempDirectory(tempDirectory);
+
try {
AuxiliaryComponentManager.getInstance();
} catch (Exception e) {
- perfsonar: r3857 - in trunk/perfsonar_base/src/main/java/org/perfsonar: base/auxiliary service/base/container/listeners, svnlog, 05/20/2008
Archive powered by MHonArc 2.6.16.