com.perforce.p4java
Class Metadata

java.lang.Object
  extended by 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
static 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 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 String P4JAVA_PROPS_KEY_PREFIX
          The Java properties key prefix use to pick up P4Java properties from the passed-in properties, etc.
 
Constructor Summary
Metadata()
           
 
Method Summary
static Manifest getManifest()
          Get the JAR Manifest associated with this P4Java instance, if it exists.
static String getP4JDateString()
          Return the P4Java date string associated with this instance as contained in the enclosing JAR file's manifest Build-Date attribute.
static 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(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 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 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 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 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


Copyright © 2015 Perforce Software. All Rights Reserved.