sgala 01/07/26 13:50:39
Modified: src/java/org/apache/jetspeed/services/psmlmanager
CastorPsmlManagerService.java
Log:
Test for File.isAbsolute() gave wrong results in Unix. Changed by File.exists()
Revision Changes Path
1.7 +18 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
Index: CastorPsmlManagerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CastorPsmlManagerService.java 2001/07/23 21:21:01 1.6
+++ CastorPsmlManagerService.java 2001/07/26 20:50:39 1.7
@@ -103,7 +103,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
- * @version $Id: CastorPsmlManagerService.java,v 1.6 2001/07/23 21:21:01 raphael
Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
+ * @version $Id: CastorPsmlManagerService.java,v 1.7 2001/07/26 20:50:39 sgala Exp $
*/
public class CastorPsmlManagerService extends TurbineBaseService
implements PsmlManagerService
@@ -115,7 +116,7 @@
private static final String PATH_ANON = "anon";
// configuration keys
- private final static String CONFIG_ROOT = ".root";
+ private final static String CONFIG_ROOT = "root";
// default configuration values
public final static String DEFAULT_ROOT = "/WEB-INF/psml";
@@ -146,6 +147,12 @@
*/
public void init( ServletConfig conf ) throws InitializationException
{
+
+ if(getInit())
+ {
+ return;
+ }
+
// get configuration parameters from Jetspeed Resources
ResourceService serviceConf =
((TurbineServices)TurbineServices.getInstance())
.getResources(PsmlManagerService.SERVICE_NAME);
@@ -153,10 +160,12 @@
this.root = serviceConf.getString( CONFIG_ROOT, DEFAULT_ROOT );
this.rootDir = new File(root);
- if (!rootDir.isAbsolute())
+ //If the rootDir does not exist, treat it as context relative
+ if ( !rootDir.exists() )
{
this.rootDir = new File(conf.getServletContext().getRealPath(root));
}
+ //If it is still missing, try to create it
if (!rootDir.exists())
{
rootDir.mkdirs();
@@ -219,6 +228,8 @@
throw new IllegalArgumentException( message );
}
+ Log.debug( "PSMLManager: asked for " + name );
+
PSMLDocument doc = null;
WeakReference ref = null;
@@ -261,7 +272,7 @@
}
File base = this.rootDir;
String path = mapLocatorToFile(locator);
- //Log.note("PSML-Man: calculated resource:" + path);
+ Log.note("PSML-Man: calculated resource:" + path + ". Base: " + base);
File file = new File(base, path);
String name = file.getAbsolutePath();
@@ -282,7 +293,10 @@
{
doc = loadDocument(name);
if (null == doc)
+ {
+ Log.note( "CastorPsmlManager: about to return null doc: " );
return null;
+ }
synchronized (documents)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]