# under the License.
#
user.agent=Apache Archiva/${project.version}
+archiva.version=${project.version}
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
/**
* LogEnabled and SessionAware ActionSupport
private String principal;
+ @Inject
+ @Named(value = "archivaRuntimeProperties")
+ private Properties archivaRuntimeProperties;
+
@PostConstruct
public void initialize()
{
return auditInformation;
}
+ public String getArchivaVersion()
+ {
+ return (String) archivaRuntimeProperties.get( "archiva.version" );
+ }
+
/**
* dummy information for audit events
* @since 1.4
* under the License.
*/
+import org.apache.archiva.common.ArchivaException;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.archiva.common.ArchivaException;
import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
import org.codehaus.plexus.taskqueue.Task;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.lang.reflect.Field;
+import java.util.Properties;
import java.util.concurrent.ExecutorService;
/**
repositoryTaskScheduler =
wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.class );
+ Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class );
+
tqeRepoScanning = wac.getBean( "taskQueueExecutor#repository-scanning", ThreadedTaskQueueExecutor.class );
tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );
{
securitySync.startup();
repositoryTaskScheduler.startup();
- Banner.display();
+ Banner.display( (String) archivaRuntimeProperties.get( "archiva.version" ) );
}
catch ( ArchivaException e )
{
}
// closing correctly indexer to close correctly lock and file
- for( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
+ for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
{
try
{
indexingContext.close( false );
- } catch ( Exception e )
+ }
+ catch ( Exception e )
{
contextEvent.getServletContext().log( "skip error closing indexingContext " + e.getMessage() );
}
+++ /dev/null
-package org.apache.archiva.web.startup;
-
-/*
- * 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.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-
-/**
- * ArchivaVersion
- *
- * @version $Id$
- */
-public class ArchivaVersion
-{
- private static String version = null;
-
- private ArchivaVersion()
- {
- }
-
- public static String determineVersion( )
- {
- if ( version != null )
- {
- return version;
- }
-
- InputStream is = ArchivaConfiguration.class.getResourceAsStream( "/META-INF/maven/org.apache.archiva/archiva-configuration/pom.properties" );
-
- if ( is != null )
- {
- try
- {
- Properties props = new Properties();
- props.load( is );
- String version = props.getProperty( "version" );
- if ( StringUtils.isNotBlank( version ) )
- {
- ArchivaVersion.version = version;
- return version;
- }
- }
- catch ( IOException e )
- {
- /* do nothing */
- }
- finally
- {
- IOUtils.closeQuietly( is );
- }
- }
-
- ArchivaVersion.version = "";
- return version;
- }
-
- public static String getVersion()
- {
- return version;
- }
-}
return injectVersion( decode( encodedBanner ), version );
}
- public static void display()
+ public static void display( String version )
{
- String banner = getBanner( ArchivaVersion.determineVersion() );
+ String banner = getBanner( version );
LoggerFactory.getLogger( Banner.class ).info( StringUtils.repeat( "_", 25 ) + eol + banner );
}
}
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-3.0.xsd"
default-lazy-init="true">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.web"/>
+ <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
</beans>
\ No newline at end of file
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
- <context:property-placeholder location="classpath:application.properties" />
-
+ <context:property-placeholder location="classpath:application.properties"/>
<bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
init-method="initialize"/>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<%@ page import="java.util.Calendar" %>
-<%@ page import="org.apache.archiva.web.startup.ArchivaVersion" %>
<html>
<head>
<div id="footer">
<div class="xleft">
- <a target="_blank" href="http://archiva.apache.org/">Apache Ar<c:if test="${is19Sep}">rr</c:if>chiva <%= ArchivaVersion.getVersion()%></a>
+ <a target="_blank" href="http://archiva.apache.org/">Apache Ar<c:if test="${is19Sep}">rr</c:if>chiva - <s:property value="archivaVersion"/></a>
</div>
<div class="xright">
Copyright © <%= copyrightRange%> <a target="_blank" href="http://www.apache.org/">The Apache Software Foundation</a>