Interface EnvironmentInfo


  • public interface EnvironmentInfo
    A Framework service which gives access to the command line used to start this running framework as well as information about the environment such as the current operating system, machine architecture, locale and windowing system.

    This interface is not intended to be implemented by clients.

    Since:
    3.0
    Restriction:
    This interface is not intended to be implemented by clients.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String[] getCommandLineArgs()
      Returns all command line arguments specified when the running framework was started.
      String[] getFrameworkArgs()
      Returns the arguments consumed by the framework implementation itself.
      String getNL()
      Returns the string name of the current locale for use in finding files whose path starts with $nl$.
      String[] getNonFrameworkArgs()
      Returns the arguments not consumed by the framework implementation itself.
      String getOS()
      Returns the string name of the current operating system for use in finding files whose path starts with $os$.
      String getOSArch()
      Returns the string name of the current system architecture.
      String getProperty​(String key)
      Returns the value for the specified property.
      String getWS()
      Returns the string name of the current window system for use in finding files whose path starts with $ws$.
      boolean inDebugMode()
      Returns true if the framework is in debug mode and false otherwise.
      boolean inDevelopmentMode()
      Returns true if the framework is in development mode and false otherwise.
      String setProperty​(String key, String value)
      Sets the value for the specified property.
    • Method Detail

      • getCommandLineArgs

        String[] getCommandLineArgs()
        Returns all command line arguments specified when the running framework was started.
        Returns:
        the array of command line arguments.
      • getFrameworkArgs

        String[] getFrameworkArgs()
        Returns the arguments consumed by the framework implementation itself. Which arguments are consumed is implementation specific.
        Returns:
        the array of command line arguments consumed by the framework.
      • getNonFrameworkArgs

        String[] getNonFrameworkArgs()
        Returns the arguments not consumed by the framework implementation itself. Which arguments are consumed is implementation specific.
        Returns:
        the array of command line arguments not consumed by the framework.
      • getOSArch

        String getOSArch()
        Returns the string name of the current system architecture. The value is a user-defined string if the architecture is specified on the command line, otherwise it is the value returned by java.lang.System.getProperty("os.arch").
        Returns:
        the string name of the current system architecture
      • getNL

        String getNL()
        Returns the string name of the current locale for use in finding files whose path starts with $nl$.
        Returns:
        the string name of the current locale
      • getOS

        String getOS()
        Returns the string name of the current operating system for use in finding files whose path starts with $os$. Return Constants.OS_UNKNOWN if the operating system cannot be determined.

        The value may indicate one of the operating systems known to the platform (as specified in org.eclipse.core.runtime.Platform#knownOSValues) or a user-defined string if the operating system name is specified on the command line.

        Returns:
        the string name of the current operating system
      • getWS

        String getWS()
        Returns the string name of the current window system for use in finding files whose path starts with $ws$. Return null if the window system cannot be determined.
        Returns:
        the string name of the current window system or null
      • inDebugMode

        boolean inDebugMode()
        Returns true if the framework is in debug mode and false otherwise.
        Returns:
        whether or not the framework is in debug mode
      • inDevelopmentMode

        boolean inDevelopmentMode()
        Returns true if the framework is in development mode and false otherwise.
        Returns:
        whether or not the framework is in development mode
      • getProperty

        String getProperty​(String key)
        Returns the value for the specified property. Environment Properties are backed by the Java system properties. When the option osgi.framework.useSystemProperties is used then the environment properties are specific for each instance of the framework.

        This method should be used instead of the System.getProperty(String) method to avoid the global nature of system properties.

        Parameters:
        key - the property key
        Returns:
        the value of the property, or null
        Since:
        3.4
      • setProperty

        String setProperty​(String key,
                           String value)
        Sets the value for the specified property. Environment Properties are backed by the Java system properties. When the option osgi.framework.useSystemProperties is used then the environment properties are specific for each instance of the framework.

        This method should be used instead of the System.setProperty(String, String) method to avoid the global nature of system properties.

        Parameters:
        key - the property key
        value - the value of the property
        Returns:
        the old value of the property, or null
        Since:
        3.4