Package ghidra.framework

# Class ApplicationProperties

java.lang.Object
java.util.Dictionary<Object,Object>
java.util.Hashtable<Object,Object>
java.util.Properties
ghidra.framework.ApplicationProperties

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Map<Object,Object>`

public class ApplicationProperties extends Properties
The application properties. Application properties may either be stored on disk, or created dynamically.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `APPLICATION_GRADLE_MAX_PROPERTY`
  The earliest version of gradle after `APPLICATION_GRADLE_MIN_PROPERTY` that is unsupported.
  `static final String`
  `APPLICATION_GRADLE_MIN_PROPERTY`
  The minimum version of gradle required to build the application.
  `static final String`
  `APPLICATION_JAVA_COMPILER_PROPERTY`
  The Java compiler compliance level that was used to build the application.
  `static final String`
  `APPLICATION_JAVA_MAX_PROPERTY`
  The maximum major version of Java the application will run under.
  `static final String`
  `APPLICATION_JAVA_MIN_PROPERTY`
  The minimum major version of Java required to run the application.
  `static final String`
  `APPLICATION_LAYOUT_VERSION_PROPERTY`
  The application's layout version.
  `static final String`
  `APPLICATION_NAME_PROPERTY`
  The application name.
  `static final String`
  `APPLICATION_PYTHON_SUPPORTED_PROPERTY`
  A comma-delimted priority-ordred list of versions of Python supported by the application.
  `static final String`
  `APPLICATION_VERSION_PROPERTY`
  The application version.
  `static final String`
  `BUILD_DATE_PROPERTY`
  The date the application was built on, in a long format.
  `static final String`
  `BUILD_DATE_SHORT_PROPERTY`
  The date the application was built on, it a short format.
  `static final String`
  `PROPERTY_FILE`
  The name of the application properties file.
  `static final String`
  `RELEASE_MARKING_PROPERTY`
  The application's release marking.
  `static final String`
  `RELEASE_NAME_PROPERTY`
  The application's release name.
  `static final String`
  `RELEASE_SOURCE_PROPERTY`
  `static final String`
  `REVISION_PROPERTY_PREFIX`
  Property prefix for dynamically generated version control revision number properties.
  `static final String`
  `TEST_RELEASE_PROPERTY`

  ### Fields inherited from class java.util.Properties

  `defaults`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ApplicationProperties(ResourceFile appPropertiesFile)`
  Creates a new application properties from the given application properties file.
  `ApplicationProperties(String name)`
  Creates a new application properties with the given name.
  `ApplicationProperties(String name, String version, String releaseName)`
  Creates a new application properties with the given name and version.
  `ApplicationProperties(Collection<ResourceFile> applicationRootDirs)`
  Creates a new application properties from the application properties files found in the given application root directories.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static ApplicationProperties`
  `fromFile(String filename)`
  Attempts to create an instance of this class by looking for the a properties file with the give name in the current working directory.
  `String`
  `getApplicationBuildDate()`
  Gets the application's build date.
  `String`
  `getApplicationName()`
  Gets the application's name.
  `String`
  `getApplicationReleaseName()`
  Gets the application's release name.
  `String`
  `getApplicationVersion()`
  Gets the application's version.
  `String`
  `getProperty(String propertyName)`
  Gets the given application property.

  ### Methods inherited from class java.util.Properties

  `clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### PROPERTY_FILE

    public static final String PROPERTY_FILE
    The name of the application properties file.
    See Also:
      - Constant Field Values

  - ### APPLICATION_NAME_PROPERTY

    public static final String APPLICATION_NAME_PROPERTY
    The application name. For example, "Ghidra".
    See Also:
      - Constant Field Values

  - ### APPLICATION_VERSION_PROPERTY

    public static final String APPLICATION_VERSION_PROPERTY
    The application version. For example, "7.4.2".
    See Also:
      - `ApplicationVersion`
      - Constant Field Values

  - ### APPLICATION_LAYOUT_VERSION_PROPERTY

    public static final String APPLICATION_LAYOUT_VERSION_PROPERTY
    The application's layout version. The layout version should get incremented any time something changes about the application that could affect external tools that need to navigate the application in some way (such as the Eclipse GhidraDev plugin).

    Current application versions are:

    - 1: Layout used by Ghidra < 11.1
    - 2: Introduced with Ghidra 11.1. Default user settings/cache/temp directories changed, and XDG environment variables are supported.
    - 3: Introduced with Ghidra 11.2. Ghidra no longer finds external modules by examining the initial classpath. Instead, the "ghidra.external.modules" system property is used (see `GhidraApplicationLayout`).
    See Also:
      - Constant Field Values

  - ### APPLICATION_GRADLE_MIN_PROPERTY

    public static final String APPLICATION_GRADLE_MIN_PROPERTY
    The minimum version of gradle required to build the application.
    See Also:
      - Constant Field Values

  - ### APPLICATION_GRADLE_MAX_PROPERTY

    public static final String APPLICATION_GRADLE_MAX_PROPERTY
    The earliest version of gradle after `APPLICATION_GRADLE_MIN_PROPERTY` that is unsupported.

    If all versions of Gradle greater than or equal to `APPLICATION_GRADLE_MIN_PROPERTY` are supported, this property should not be set.

    See Also:
      - Constant Field Values

  - ### APPLICATION_JAVA_MIN_PROPERTY

    public static final String APPLICATION_JAVA_MIN_PROPERTY
    The minimum major version of Java required to run the application.
    See Also:
      - Constant Field Values

  - ### APPLICATION_JAVA_MAX_PROPERTY

    public static final String APPLICATION_JAVA_MAX_PROPERTY
    The maximum major version of Java the application will run under.

    If all versions of Java greater than or equal to `APPLICATION_JAVA_MIN_PROPERTY` are supported, this property should not be set.

    See Also:
      - Constant Field Values

  - ### APPLICATION_JAVA_COMPILER_PROPERTY

    public static final String APPLICATION_JAVA_COMPILER_PROPERTY
    The Java compiler compliance level that was used to build the application. For example, "1.8".
    See Also:
      - Constant Field Values

  - ### APPLICATION_PYTHON_SUPPORTED_PROPERTY

    public static final String APPLICATION_PYTHON_SUPPORTED_PROPERTY
    A comma-delimted priority-ordred list of versions of Python supported by the application.
    See Also:
      - Constant Field Values

  - ### BUILD_DATE_PROPERTY

    public static final String BUILD_DATE_PROPERTY
    The date the application was built on, in a long format. For example, "2018-Jan-11 1346 EST".
    See Also:
      - Constant Field Values

  - ### BUILD_DATE_SHORT_PROPERTY

    public static final String BUILD_DATE_SHORT_PROPERTY
    The date the application was built on, it a short format. For example, "20180111".
    See Also:
      - Constant Field Values

  - ### RELEASE_NAME_PROPERTY

    public static final String RELEASE_NAME_PROPERTY
    The application's release name. For example, "U".
    See Also:
      - Constant Field Values

  - ### RELEASE_MARKING_PROPERTY

    public static final String RELEASE_MARKING_PROPERTY
    The application's release marking.
    See Also:
      - Constant Field Values

  - ### REVISION_PROPERTY_PREFIX

    public static final String REVISION_PROPERTY_PREFIX
    Property prefix for dynamically generated version control revision number properties.
    See Also:
      - Constant Field Values

  - ### TEST_RELEASE_PROPERTY

    public static final String TEST_RELEASE_PROPERTY
    See Also:
      - Constant Field Values

  - ### RELEASE_SOURCE_PROPERTY

    public static final String RELEASE_SOURCE_PROPERTY
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ApplicationProperties

    public ApplicationProperties(String name)
    Creates a new application properties with the given name. Additional properties may be set with `Properties.setProperty(java.lang.String, java.lang.String)`.
    Parameters:
      `name` - The application's name.

  - ### ApplicationProperties

    public ApplicationProperties(String name, String version, String releaseName)
    Creates a new application properties with the given name and version. Additional properties may be set with `Properties.setProperty(java.lang.String, java.lang.String)`.
    Parameters:
      `name` - The application's name.
      `version` - The application's version.
      `releaseName` - The application's release name.

  - ### ApplicationProperties

    public ApplicationProperties(ResourceFile appPropertiesFile) throws IOException
    Creates a new application properties from the given application properties file.
    Parameters:
      `appPropertiesFile` - The application properties file.
    Throws:
      `IOException` - If there was a problem loading/reading a discovered properties file.

  - ### ApplicationProperties

    public ApplicationProperties(Collection<ResourceFile> applicationRootDirs) throws IOException
    Creates a new application properties from the application properties files found in the given application root directories. If multiple application properties files are found, the properties from the files will be combined. If duplicate keys exist, the newest key encountered will overwrite the existing key.
    Parameters:
      `applicationRootDirs` - The application root directories to look for the properties files in.
    Throws:
      `IOException` - If there was a problem loading/reading a discovered properties file.

- ## Method Details

  - ### fromFile

    public static ApplicationProperties fromFile(String filename) throws IOException
    Attempts to create an instance of this class by looking for the a properties file with the give name in the current working directory.
    Parameters:
      `filename` - the name of the properties file to load
    Returns:
      the new instance of this class created from the properties file on disk
    Throws:
      `IOException` - if there is no properties file found in the expected location

  - ### getProperty

    public String getProperty(String propertyName)
    Gets the given application property. Note that if the specified property is defined as a system property, the system property will be given precedence and returned.
    Overrides:
      `getProperty` in class `Properties`
    Parameters:
      `propertyName` - The property name to get.
    Returns:
      The property.

  - ### getApplicationName

    public String getApplicationName()
    Gets the application's name.
    Returns:
      The application's name (empty string if undefined).

  - ### getApplicationVersion

    public String getApplicationVersion()
    Gets the application's version.
    Returns:
      The application's version (empty string if undefined).

  - ### getApplicationReleaseName

    public String getApplicationReleaseName()
    Gets the application's release name.
    Returns:
      The application's release name (empty string if undefined).

  - ### getApplicationBuildDate

    public String getApplicationBuildDate()
    Gets the application's build date.
    Returns:
      The application's build date.