Class ApplicationProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,​java.lang.Object>

    public class ApplicationProperties
    extends java.util.Properties
    The application properties. Application properties may either be stored on disk, or created dynamically.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ApplicationProperties​(ResourceFile appPropertiesFile)
      Creates a new application properties from the given application properties file.
      ApplicationProperties​(java.lang.String name)
      Creates a new application properties with the given name.
      ApplicationProperties​(java.lang.String name, java.lang.String version)
      Creates a new application properties with the given name and version.
      ApplicationProperties​(java.util.Collection<ResourceFile> applicationRootDirs)
      Creates a new application properties from the application properties files found in the given application root directories.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ApplicationProperties fromFile​(java.lang.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.
      java.lang.String getApplicationBuildDate()
      Gets the application's build date.
      java.lang.String getApplicationName()
      Gets the application's name.
      java.lang.String getApplicationReleaseName()
      Gets the application's release name.
      java.lang.String getApplicationVersion()
      Gets the application's version.
      java.lang.String getProperty​(java.lang.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 Detail

      • PROPERTY_FILE

        public static final java.lang.String PROPERTY_FILE
        The name of the application properties file.
        See Also:
        Constant Field Values
      • APPLICATION_NAME_PROPERTY

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

        public static final java.lang.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 java.lang.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). For example, "1".
        See Also:
        Constant Field Values
      • APPLICATION_GRADLE_MIN_PROPERTY

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

        public static final java.lang.String APPLICATION_JAVA_MIN_PROPERTY
        The minimum major version of Java required to run the application. For example, "8".
        See Also:
        Constant Field Values
      • APPLICATION_JAVA_MAX_PROPERTY

        public static final java.lang.String APPLICATION_JAVA_MAX_PROPERTY
        The maximum major version of Java the application will run under. For example, "8".

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

        See Also:
        Constant Field Values
      • APPLICATION_JAVA_COMPILER_PROPERTY

        public static final java.lang.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
      • BUILD_DATE_PROPERTY

        public static final java.lang.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 java.lang.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 java.lang.String RELEASE_NAME_PROPERTY
        The application's release name. For example, "U".
        See Also:
        Constant Field Values
      • RELEASE_MARKING_PROPERTY

        public static final java.lang.String RELEASE_MARKING_PROPERTY
        The application's release marking.
        See Also:
        Constant Field Values
      • REVISION_PROPERTY_PREFIX

        public static final java.lang.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 java.lang.String TEST_RELEASE_PROPERTY
        See Also:
        Constant Field Values
      • RELEASE_SOURCE_PROPERTY

        public static final java.lang.String RELEASE_SOURCE_PROPERTY
        See Also:
        Constant Field Values
    • Constructor Detail

      • ApplicationProperties

        public ApplicationProperties​(java.lang.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​(java.lang.String name,
                                     java.lang.String version)
        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.
      • ApplicationProperties

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

        public ApplicationProperties​(java.util.Collection<ResourceFile> applicationRootDirs)
                              throws java.io.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:
        java.io.IOException - If there was a problem loading/reading a discovered properties file.
    • Method Detail

      • fromFile

        public static ApplicationProperties fromFile​(java.lang.String filename)
                                              throws java.io.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:
        java.io.IOException - if there is no properties file found in the expected location
      • getProperty

        public java.lang.String getProperty​(java.lang.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 java.util.Properties
        Parameters:
        propertyName - The property name to get.
        Returns:
        The property.
      • getApplicationName

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

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

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

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