diff options
author | Olivier Lamy <olamy@apache.org> | 2012-01-09 12:44:45 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-01-09 12:44:45 +0000 |
commit | fcf76e1730e2b4228009797dee0edcdae87a5d0f (patch) | |
tree | e828fee01cb4b600b7d3bd4a76c883e679d27fa0 /archiva-modules/archiva-web/archiva-webapp | |
parent | bb2c903c416f09a3d7df86bf6358e851133635e9 (diff) | |
download | archiva-fcf76e1730e2b4228009797dee0edcdae87a5d0f.tar.gz archiva-fcf76e1730e2b4228009797dee0edcdae87a5d0f.zip |
add a bean with archiva runtime information
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1229120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp')
2 files changed, 12 insertions, 11 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java index 814f7ff1e..b9ebec9b0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/AbstractActionSupport.java @@ -27,8 +27,8 @@ import org.apache.archiva.audit.AuditListener; import org.apache.archiva.audit.Auditable; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.security.ArchivaXworkUser; +import org.apache.archiva.web.runtime.ArchivaRuntimeInfo; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; import org.apache.struts2.ServletActionContext; import org.apache.struts2.interceptor.SessionAware; import org.codehaus.plexus.redback.users.User; @@ -47,7 +47,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; /** * LogEnabled and SessionAware ActionSupport @@ -73,9 +72,12 @@ public abstract class AbstractActionSupport private String principal; + //@Inject + //@Named( value = "archivaRuntimeProperties" ) + //private Properties archivaRuntimeProperties; + @Inject - @Named( value = "archivaRuntimeProperties" ) - private Properties archivaRuntimeProperties; + private ArchivaRuntimeInfo archivaRuntimeInfo; @PostConstruct public void initialize() @@ -200,24 +202,25 @@ public abstract class AbstractActionSupport public String getArchivaVersion() { - return (String) archivaRuntimeProperties.get( "archiva.version" ); + return archivaRuntimeInfo.getVersion(); //(String) archivaRuntimeProperties.get( "archiva.version" ); } public String getArchivaBuildNumber() { - return (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); + return archivaRuntimeInfo.getBuildNumber();// (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); } public String getArchivaBuildTimestamp() { - return (String) archivaRuntimeProperties.get( "archiva.timestamp" ); + return Long.toString( + archivaRuntimeInfo.getTimestamp() ); //(String) archivaRuntimeProperties.get( "archiva.timestamp" ); } public String getArchivaBuildTimestampDateStr() { SimpleDateFormat sfd = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssz", getLocale() ); - return sfd.format( - new Date( NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) ) ) ); + return sfd.format( new Date( archivaRuntimeInfo.getTimestamp() ) ); + //new Date( NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) ) ) ); } /** diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml index fb14d761a..d79ebcb5e 100755 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml @@ -33,8 +33,6 @@ <context:annotation-config/> <context:component-scan base-package="org.apache.archiva.web"/> - <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" /> - <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true"> <constructor-arg ref="jcr-config"/> </bean> |