This project has retired. For details please refer to its
Attic page.
ArchivaRuntimeInfo xref
1 package org.apache.archiva.web.runtime;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.commons.lang3.math.NumberUtils;
22 import org.springframework.stereotype.Service;
23
24 import javax.inject.Inject;
25 import javax.inject.Named;
26 import java.util.Date;
27 import java.util.Properties;
28
29
30
31
32
33 @Service( "archivaRuntimeInfo" )
34 public class ArchivaRuntimeInfo
35 {
36
37 private String version;
38
39 private String buildNumber;
40
41 private long timestamp;
42
43 private boolean devMode;
44
45
46 @Inject
47 public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties )
48 {
49 this.version = (String) archivaRuntimeProperties.get( "archiva.version" );
50 this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
51 String archivaTimeStamp = (String) archivaRuntimeProperties.get( "archiva.timestamp" );
52 if ( NumberUtils.isNumber( archivaTimeStamp ) )
53 {
54 this.timestamp = NumberUtils.createLong( archivaTimeStamp );
55 }
56 else
57 {
58 this.timestamp = new Date().getTime();
59 }
60 this.devMode = Boolean.getBoolean( "archiva.devMode" );
61 }
62
63 public String getVersion()
64 {
65 return version;
66 }
67
68 public void setVersion( String version )
69 {
70 this.version = version;
71 }
72
73 public String getBuildNumber()
74 {
75 return buildNumber;
76 }
77
78 public void setBuildNumber( String buildNumber )
79 {
80 this.buildNumber = buildNumber;
81 }
82
83 public long getTimestamp()
84 {
85 return timestamp;
86 }
87
88 public void setTimestamp( long timestamp )
89 {
90 this.timestamp = timestamp;
91 }
92
93 public boolean isDevMode()
94 {
95 return devMode;
96 }
97
98 public void setDevMode( boolean devMode )
99 {
100 this.devMode = devMode;
101 }
102
103 @Override
104 public String toString()
105 {
106 final StringBuilder sb = new StringBuilder();
107 sb.append( "ArchivaRuntimeInfo" );
108 sb.append( "{version='" ).append( version ).append( '\'' );
109 sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
110 sb.append( ", timestamp=" ).append( timestamp );
111 sb.append( ", devMode=" ).append( devMode );
112 sb.append( '}' );
113 return sb.toString();
114 }
115 }