Class Metadata


  • public class Metadata
    extends java.lang.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 java.lang.String DEFAULT_DATE_STRING
      The value returned by the getP4JDateString method if it can not determine the correct date from the associated JAR manifest.
      static int DEFAULT_MINIMUM_SUPPORTED_SERVER_VERSION
      The default minimum Perforce server level supported by the entire P4Java API.
      static java.lang.String DEFAULT_VERSION_STRING
      The value returned by the getP4JVersionString method if it can not determine the correct version from the associated JAR manifest.
      static java.lang.String P4JAVA_PROPS_KEY_PREFIX
      The Java properties key prefix use to pick up P4Java properties from the passed-in properties, etc.
    • Constructor Summary

      Constructors 
      Constructor Description
      Metadata()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.jar.Manifest getManifest()
      Get the JAR Manifest associated with this P4Java instance, if it exists.
      static java.lang.String getP4JDateString()
      Return the P4Java date string associated with this instance as contained in the enclosing JAR file's manifest Build-Date attribute.
      static java.lang.String getP4JVersionString()
      Return the P4Java version string associated with this instance as contained in the enclosing JAR file's manifest IMPLEMENTATION_TITLE attribute.
      static void main​(java.lang.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 Detail

      • P4JAVA_PROPS_KEY_PREFIX

        public static final java.lang.String P4JAVA_PROPS_KEY_PREFIX
        The Java properties key prefix use to pick up P4Java properties from the passed-in properties, etc.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • DEFAULT_VERSION_STRING

        public static final java.lang.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:
        Constant Field Values
      • DEFAULT_DATE_STRING

        public static final java.lang.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:
        Constant Field Values
    • Constructor Detail

      • Metadata

        public Metadata()
    • Method Detail

      • getP4JVersionString

        public static java.lang.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 java.lang.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​(java.lang.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 java.util.jar.Manifest getManifest()
                                                  throws java.lang.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:
        java.lang.Exception - if the manifest can't be found or retrieved for any reason.
        Since:
        2011.1