KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > Version


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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  */

17
18 /* $Id: Version.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop;
21
22 /**
23  * This class is used to evaluate the version information contained in the Manifest of FOP's JAR.
24  * Note that this class can only find the version information if it's in the org.apache.fop package
25  * as this package equals the one specified in the manifest.
26  */

27 public final class Version {
28     
29     private Version() { }
30
31     /**
32      * Get the version of FOP
33      * @return the version string
34      */

35     public static String JavaDoc getVersion() {
36         String JavaDoc version = null;
37         Package JavaDoc jarinfo = Version.class.getPackage();
38         if (jarinfo != null) {
39             version = jarinfo.getImplementationVersion();
40         }
41         if (version == null) {
42             //Fallback if FOP is used in a development environment
43
String JavaDoc headURL
44                 = "$HeadURL: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/java/org/apache/fop/Version.java $";
45             version = headURL;
46             final String JavaDoc pathPrefix = "/xmlgraphics/fop/";
47             int pos = version.indexOf(pathPrefix);
48             if (pos >= 0) {
49                 version = version.substring(pos + pathPrefix.length() - 1, version.length() - 2);
50                 pos = version.indexOf("/src/");
51                 version = version.substring(1, pos);
52                 version = " " + version;
53             } else {
54                 version = "";
55             }
56             version = "SVN" + version;
57         }
58         return version;
59     }
60     
61 }
62
Popular Tags