01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.util;
17:
18: import org.apache.xbean.finder.ResourceFinder;
19:
20: import java.util.Properties;
21: import java.io.PrintStream;
22:
23: /**
24: * @version $Rev: 602704 $ $Date: 2007-12-09 09:58:22 -0800 $
25: */
26: public class OpenEjbVersion {
27:
28: private final String copyright;//Copyright 1999-2006 (C) Apache OpenEJB Project, All Rights Reserved.
29: private final String url; //http://incubator.apache.org/openejb
30: private final String version;//${pom.version}
31: private final String date;//@DATE-REPLACED-BY-MAVEN@
32: private final String time;//@TIME-REPLACED-BY-MAVEN@
33: private static OpenEjbVersion openEjbVersion;
34:
35: private OpenEjbVersion() {
36: Properties info = new Properties();
37:
38: try {
39: ResourceFinder finder = new ResourceFinder();
40: info = finder.findProperties("openejb-version.properties");
41: } catch (java.io.IOException e) {
42: e.printStackTrace();
43: }
44:
45: copyright = info.getProperty("copyright");
46: url = info.getProperty("url");
47: version = info.getProperty("version");
48: date = info.getProperty("date");
49: time = info.getProperty("time");
50:
51: System.setProperty("openejb.version", version);
52: }
53:
54: public static OpenEjbVersion get() {
55: if (openEjbVersion == null)
56: openEjbVersion = new OpenEjbVersion();
57: return openEjbVersion;
58: }
59:
60: public String getCopyright() {
61: return copyright;
62: }
63:
64: public String getDate() {
65: return date;
66: }
67:
68: public String getTime() {
69: return time;
70: }
71:
72: public String getUrl() {
73: return url;
74: }
75:
76: public String getVersion() {
77: return version;
78: }
79:
80: public void print(PrintStream out) {
81: out.println("Apache OpenEJB " + getVersion() + " build: "
82: + getDate() + "-" + getTime());
83: out.println(getUrl());
84: }
85: }
|