Class 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:
  • Field Details

    • PROPERTY_FILE

      public static final String PROPERTY_FILE
      The name of the application properties file.
      See Also:
    • APPLICATION_NAME_PROPERTY

      public static final String APPLICATION_NAME_PROPERTY
      The application name. For example, "Ghidra".
      See Also:
    • APPLICATION_VERSION_PROPERTY

      public static final String APPLICATION_VERSION_PROPERTY
      The application version. For example, "7.4.2".
      See Also:
    • 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.
      See Also:
    • APPLICATION_GRADLE_MIN_PROPERTY

      public static final String APPLICATION_GRADLE_MIN_PROPERTY
      The minimum version of gradle required to build the application.
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • RELEASE_NAME_PROPERTY

      public static final String RELEASE_NAME_PROPERTY
      The application's release name. For example, "U".
      See Also:
    • RELEASE_MARKING_PROPERTY

      public static final String RELEASE_MARKING_PROPERTY
      The application's release marking.
      See Also:
    • REVISION_PROPERTY_PREFIX

      public static final String REVISION_PROPERTY_PREFIX
      Property prefix for dynamically generated version control revision number properties.
      See Also:
    • TEST_RELEASE_PROPERTY

      public static final String TEST_RELEASE_PROPERTY
      See Also:
    • RELEASE_SOURCE_PROPERTY

      public static final String RELEASE_SOURCE_PROPERTY
      See Also:
  • 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.