]> source.dussan.org Git - archiva.git/commitdiff
[MRM-347]: Undefined ${appserver.home} and ${appserver.base}
authorJoakim Erdfelt <joakime@apache.org>
Mon, 21 May 2007 21:04:20 +0000 (21:04 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Mon, 21 May 2007 21:04:20 +0000 (21:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@540296 13f79535-47bb-0310-9956-ffa450edef68

archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/AuditLog.java

index 6ae6b8a499151eba19b1f03255c59822454cad2e..a6a50b49faf604f15c1f2fd84e780260c4d59e80 100644 (file)
@@ -20,6 +20,9 @@ package org.apache.maven.archiva.web.repository;
  */
 
 import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.evaluator.EvaluatorException;
+import org.codehaus.plexus.evaluator.ExpressionEvaluator;
+import org.codehaus.plexus.evaluator.ExpressionSource;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
 import org.codehaus.plexus.webdav.DavServerComponent;
@@ -48,13 +51,25 @@ public class AuditLog
     /**
      * @plexus.configuration default-value="${appserver.base}/logs/audit.log"
      */
-    private File logFile;
+    private String logFilename;
 
     /**
      * @plexus.configuration default-value="yyyy-MM-dd HH:mm:ss"
      */
     private String timestampFormat;
 
+    /**
+     * @plexus.requirement role-hint="default"
+     */
+    private ExpressionEvaluator expressionEvaluator;
+
+    /**
+     * @plexus.requirement role-hint="sysprops"
+     */
+    private ExpressionSource syspropExprSource;
+
+    private File logFile;
+
     private PrintWriter writer;
 
     private SimpleDateFormat timestamp;
@@ -108,6 +123,19 @@ public class AuditLog
     public void initialize()
         throws InitializationException
     {
+        String actualFilename;
+        try
+        {
+            expressionEvaluator.addExpressionSource( syspropExprSource );
+            actualFilename = expressionEvaluator.expand( this.logFilename );
+        }
+        catch ( EvaluatorException e1 )
+        {
+            actualFilename = this.logFilename;
+        }
+
+        this.logFile = new File( actualFilename );
+
         File parentDir = logFile.getParentFile();
         if ( parentDir != null )
         {