You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Version.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2005 Jeremias Maerki
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop;
  18. /**
  19. * This class is used to evaluate the version information contained in the Manifest of FOP's JAR.
  20. * Note that this class can only find the version information if it's in the org.apache.fop package
  21. * as this package equals the one specified in the manifest.
  22. */
  23. public class Version {
  24. /**
  25. * Get the version of FOP
  26. * @return the version string
  27. */
  28. public static String getVersion() {
  29. String version = Version.class.getPackage().getImplementationVersion();
  30. if (version == null) {
  31. //Fallback if FOP is used in a development environment
  32. String revision = "$LastChangedRevision$";
  33. if (revision.indexOf(":") >= 0) {
  34. revision = revision.substring(1, revision.length() - 2);
  35. revision = ", revision" + revision.substring(revision.lastIndexOf(" "));
  36. } else {
  37. revision = "";
  38. }
  39. version = "SVN Trunk" + revision;
  40. }
  41. return version;
  42. }
  43. }