1 package org.apache.archiva.web.runtime;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.commons.lang.math.NumberUtils;
22 import org.springframework.stereotype.Service;
24 import javax.inject.Inject;
25 import javax.inject.Named;
26 import java.util.Properties;
29 * @author Olivier Lamy
32 @Service( "archivaRuntimeInfo" )
33 public class ArchivaRuntimeInfo
36 private String version;
38 private String buildNumber;
40 private long timestamp;
42 private boolean devMode;
46 public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties )
48 this.version = (String) archivaRuntimeProperties.get( "archiva.version" );
49 this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
50 this.timestamp = NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) );
51 this.devMode = Boolean.getBoolean( "archiva.devMode" );
54 public String getVersion()
59 public void setVersion( String version )
61 this.version = version;
64 public String getBuildNumber()
69 public void setBuildNumber( String buildNumber )
71 this.buildNumber = buildNumber;
74 public long getTimestamp()
79 public void setTimestamp( long timestamp )
81 this.timestamp = timestamp;
84 public boolean isDevMode()
89 public void setDevMode( boolean devMode )
91 this.devMode = devMode;
95 public String toString()
97 final StringBuilder sb = new StringBuilder();
98 sb.append( "ArchivaRuntimeInfo" );
99 sb.append( "{version='" ).append( version ).append( '\'' );
100 sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
101 sb.append( ", timestamp=" ).append( timestamp );
102 sb.append( ", devMode=" ).append( devMode );
104 return sb.toString();