[MRM-347]: Undefined ${appserver.home} and ${appserver.base}

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@540296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joakim Erdfelt 2007-05-21 21:04:20 +00:00
parent 7c755eb54e
commit da40ada2d2
1 changed files with 29 additions and 1 deletions

View 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 )
{