Class Metadata

java.lang.Object
com.perforce.p4java.Metadata

public class Metadata extends Object
Defines public version, date, etc., metadata about the P4Java API.

The version strings are mostly intended for support, debugging, and logging purposes, meaning the format and semantics of much of the data here is intentionally opaque.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The value returned by the getP4JDateString method if it can not determine the correct date from the associated JAR manifest.
    static final int
    The default minimum Perforce server level supported by the entire P4Java API.
    static final String
    The value returned by the getP4JVersionString method if it can not determine the correct version from the associated JAR manifest.
    static final String
    The Java properties key prefix use to pick up P4Java properties from the passed-in properties, etc.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Manifest
    Get the JAR Manifest associated with this P4Java instance, if it exists.
    static String
    Return the P4Java date string associated with this instance as contained in the enclosing JAR file's manifest Build-Date attribute.
    static String
    Return the P4Java version string associated with this instance as contained in the enclosing JAR file's manifest IMPLEMENTATION_TITLE attribute.
    static void
    main(String[] args)
    Public main method, used solely for allowing customers to print version and other metadata information from the enclosing JAR file's manifest.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • P4JAVA_PROPS_KEY_PREFIX

      public static final String P4JAVA_PROPS_KEY_PREFIX
      The Java properties key prefix use to pick up P4Java properties from the passed-in properties, etc.
      See Also:
    • DEFAULT_MINIMUM_SUPPORTED_SERVER_VERSION

      public static final int DEFAULT_MINIMUM_SUPPORTED_SERVER_VERSION
      The default minimum Perforce server level supported by the entire P4Java API. Specific implementations may override this.
      See Also:
    • DEFAULT_VERSION_STRING

      public static final String DEFAULT_VERSION_STRING
      The value returned by the getP4JVersionString method if it can not determine the correct version from the associated JAR manifest.
      See Also:
    • DEFAULT_DATE_STRING

      public static final String DEFAULT_DATE_STRING
      The value returned by the getP4JDateString method if it can not determine the correct date from the associated JAR manifest.
      See Also:
  • Constructor Details

    • Metadata

      public Metadata()
  • Method Details

    • getP4JVersionString

      public static String getP4JVersionString()
      Return the P4Java version string associated with this instance as contained in the enclosing JAR file's manifest IMPLEMENTATION_TITLE attribute. If this information is not available, DEFAULT_VERSION_STRING is returned.

      The format and semantics of this string are not specified here.

      Returns:
      non-null version string
    • getP4JDateString

      public static String getP4JDateString()
      Return the P4Java date string associated with this instance as contained in the enclosing JAR file's manifest Build-Date attribute. If this information is not available, DEFAULT_DATE_STRING is returned.

      The format and semantics of this string are not specified here.

      Returns:
      non-null date string
    • main

      public static void main(String[] args)
      Public main method, used solely for allowing customers to print version and other metadata information from the enclosing JAR file's manifest. This information is printed to stdout; errors are printed to stderr.
      Parameters:
      args - not used.
      Since:
      2011.1
    • getManifest

      public static Manifest getManifest() throws Exception
      Get the JAR Manifest associated with this P4Java instance, if it exists. The interpretation of the attributes in this manifest is not defined here and will depend on how the jar was built; for a full list of normal Perforce release build attributes, contact support, but in general, most of the normal Maven build attributes will probably exist, as will Name.IMPLEMENTATION_TITLE and Name.IMPLEMENTATION_VERSION (but this is not guaranteed).
      Returns:
      non-null Manifest object if it exists and is retrievable.
      Throws:
      Exception - if the manifest can't be found or retrieved for any reason.
      Since:
      2011.1