diff --git a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml index a4a5840c8..377b188cd 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml @@ -523,10 +523,6 @@ src/main/resources - - src/main/filtered-resources - true - diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties deleted file mode 100644 index 12806aa73..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/filtered-resources/application.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -user.agent=Apache Archiva/${project.version} -archiva.version=${project.version} -archiva.buildNumber=${buildNumber} -archiva.timestamp=${timestamp} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java index c4562fb74..cd58ddacd 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java @@ -18,9 +18,12 @@ package org.apache.archiva.webapp.ui.services.api; * under the License. */ +import org.apache.archiva.web.runtime.ArchivaRuntimeInfo; import org.apache.archiva.webapp.ui.services.model.ApplicationRuntimeInfo; import org.springframework.stereotype.Service; +import javax.inject.Inject; + /** * @author Olivier Lamy */ @@ -28,9 +31,22 @@ import org.springframework.stereotype.Service; public class DefaultRuntimeInfoService implements RuntimeInfoService { - public ApplicationRuntimeInfo archivaRuntimeInfo() + + private ArchivaRuntimeInfo archivaRuntimeInfo; + + @Inject + public DefaultRuntimeInfoService( ArchivaRuntimeInfo archivaRuntimeInfo ) { - ApplicationRuntimeInfo archivaRuntimeInfo = new ApplicationRuntimeInfo(); - return archivaRuntimeInfo; + this.archivaRuntimeInfo = archivaRuntimeInfo; + } + + @Inject + public ApplicationRuntimeInfo getApplicationRuntimeInfo() + { + ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo(); + applicationRuntimeInfo.setBuildNumber( this.archivaRuntimeInfo.getBuildNumber() ); + applicationRuntimeInfo.setTimestamp( this.archivaRuntimeInfo.getTimestamp() ); + applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() ); + return applicationRuntimeInfo; } } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java index 43e82dd59..43f609e7a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java @@ -37,5 +37,5 @@ public interface RuntimeInfoService @GET @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @RedbackAuthorization( noRestriction = true ) - ApplicationRuntimeInfo archivaRuntimeInfo(); + ApplicationRuntimeInfo getApplicationRuntimeInfo(); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java index 3759d9a3e..fb438a8c2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java @@ -19,6 +19,7 @@ package org.apache.archiva.webapp.ui.services.model; */ import javax.xml.bind.annotation.XmlRootElement; +import java.util.Calendar; /** * @author Olivier Lamy @@ -31,11 +32,22 @@ public class ApplicationRuntimeInfo private boolean javascriptLog = false; + private String version; + + private String buildNumber; + + private long timestamp; + + private String copyrightRange; + + public ApplicationRuntimeInfo() { this.devMode = Boolean.getBoolean( "archiva.devMode" ); this.javascriptLog = Boolean.getBoolean( "archiva.javascriptLog" ); + + this.copyrightRange = "2005 - " + Calendar.getInstance().get( Calendar.YEAR ); } public boolean isDevMode() @@ -58,6 +70,46 @@ public class ApplicationRuntimeInfo this.javascriptLog = javascriptLog; } + public String getVersion() + { + return version; + } + + public void setVersion( String version ) + { + this.version = version; + } + + public String getBuildNumber() + { + return buildNumber; + } + + public void setBuildNumber( String buildNumber ) + { + this.buildNumber = buildNumber; + } + + public long getTimestamp() + { + return timestamp; + } + + public void setTimestamp( long timestamp ) + { + this.timestamp = timestamp; + } + + public String getCopyrightRange() + { + return copyrightRange; + } + + public void setCopyrightRange( String copyrightRange ) + { + this.copyrightRange = copyrightRange; + } + @Override public String toString() { @@ -65,6 +117,10 @@ public class ApplicationRuntimeInfo sb.append( "ApplicationRuntimeInfo" ); sb.append( "{devMode=" ).append( devMode ); sb.append( ", javascriptLog=" ).append( javascriptLog ); + sb.append( ", version='" ).append( version ).append( '\'' ); + sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' ); + sb.append( ", timestamp=" ).append( timestamp ); + sb.append( ", copyrightRange='" ).append( copyrightRange ).append( '\'' ); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 1d06f8be3..7581bfdd9 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -53,6 +53,7 @@ $.ajax( success:function(data){ window.archivaDevMode=data.applicationRuntimeInfo.devMode; window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog; + window.archivaRuntimeInfo=data.applicationRuntimeInfo; require.config({ baseUrl: "js/" }); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index 8f92bb64b..9df607d1c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -172,7 +172,7 @@ $(function() { hideElementWithKarma(); checkSecurityLinks(); checkCreateAdminLink(); - $('#footer-content').html($('#footer-tmpl').tmpl()); + $('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo)); } startArchivaApplication(); })