Class Ini

java.lang.Object
org.compiere.util.Ini
All Implemented Interfaces:
Serializable

public final class Ini extends Object implements Serializable
Load and Save INI Settings from property file (idempiere.properties).
Initiated in Adempiere.startup.
Version:
$Id$
Author:
Jorg Janke, Teo Sarca, www.arhipac.ro
  • FR [ 1658127 ] Select charset encoding on import
  • FR [ 2406123 ] Ini.saveProperties fails if target directory does not exist
  • See Also:
    • Field Details

    • Constructor Details

      • Ini

        public Ini()
    • Method Details

      • saveProperties

        public static void saveProperties(boolean tryUserHome)
        Save INI parameters to disk
        Parameters:
        tryUserHome - true to try user home first
      • loadProperties

        public static void loadProperties(boolean reload)
        Load INI parameters from disk
        Parameters:
        reload - reload
      • loadProperties

        public static boolean loadProperties(String filename)
        Load INI parameters from filename. Logger is on default level (INFO)
        Parameters:
        filename - to load
        Returns:
        true if first time
      • deletePropertyFile

        public static void deletePropertyFile()
        Delete Property file
      • getFileName

        public static String getFileName(boolean tryUserHome)
        Return File Name of INI file
          Examples:
                    C:\WinNT\Profiles\jjanke\idempiere.properties
              D:\idempiere\idempiere.properties
              idempiere.properties
          
        Can be overwritten by -DPropertyFile=myFile allowing multiple configurations / property files.
        Parameters:
        tryUserHome - true to try user home first, ignore for server
        Returns:
        file name
      • setProperty

        public static void setProperty(String key, String value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • setProperty

        public static void setProperty(String key, boolean value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • setProperty

        public static void setProperty(String key, int value)
        Set Property
        Parameters:
        key - Key
        value - Value
      • getProperty

        public static String getProperty(String key)
        Get Property
        Parameters:
        key - Key
        Returns:
        Value
      • isPropertyBool

        public static boolean isPropertyBool(String key)
        Get Property as Boolean
        Parameters:
        key - Key
        Returns:
        Value
      • isCacheWindow

        public static boolean isCacheWindow()
        Cache Windows
        Returns:
        true if windows are cached
      • getProperties

        public static Properties getProperties()
        Get Properties
        Returns:
        Ini properties
      • getAsString

        public static String getAsString()
        toString
        Returns:
        String representation
      • isClient

        public static boolean isClient()
        Are we in Client Mode ?
        Returns:
        true if client
      • setClient

        public static void setClient(boolean client)
        Set Client Mode
        Parameters:
        client - client
      • setShowLicenseDialog

        public static void setShowLicenseDialog(boolean b)
        Set show license dialog for new setup
        Parameters:
        b -
      • isShowLicenseDialog

        public static boolean isShowLicenseDialog()
        Is show license dialog for new setup
        Returns:
        boolean
      • isLoaded

        public static boolean isLoaded()
        Are the properties loaded?
        Returns:
        true if properties loaded.
      • getAdempiereHome

        public static String getAdempiereHome()
        Get iDempiere Home from Environment
        Returns:
        idempiereHome or null
      • setAdempiereHome

        public static void setAdempiereHome(String idempiereHome)
        Set iDempiere Home
        Parameters:
        idempiereHome - IDEMPIERE_HOME
      • findAdempiereHome

        public static String findAdempiereHome()
        Find iDempiere Home
        Returns:
        idempiere home or null
      • getWindowDimension

        @Deprecated public static Dimension getWindowDimension(int AD_Window_ID)
        Deprecated.
        Get Window Dimension
        Parameters:
        AD_Window_ID - window no
        Returns:
        dimension or null
      • setWindowDimension

        @Deprecated public static void setWindowDimension(int AD_Window_ID, Dimension windowDimension)
        Deprecated.
        Set Window Dimension
        Parameters:
        AD_Window_ID - window
        windowDimension - dimension - null to remove
      • getWindowLocation

        @Deprecated public static Point getWindowLocation(int AD_Window_ID)
        Deprecated.
        Get Window Location
        Parameters:
        AD_Window_ID - window id
        Returns:
        location or null
      • setWindowLocation

        @Deprecated public static void setWindowLocation(int AD_Window_ID, Point windowLocation)
        Deprecated.
        Set Window Location
        Parameters:
        AD_Window_ID - window
        windowLocation - location - null to remove
      • getDividerLocation

        @Deprecated public static int getDividerLocation()
        Deprecated.
        Get Divider Location
        Returns:
        location
      • setDividerLocation

        @Deprecated public static void setDividerLocation(int dividerLocation)
        Deprecated.
        Set Divider Location
        Parameters:
        dividerLocation - location
      • getAvailableCharsets

        public static Charset[] getAvailableCharsets()
        Get Available Encoding Charsets
        Returns:
        array of available encoding charsets
        Since:
        3.1.4
      • getCharset

        public static Charset getCharset()
        Get current charset
        Returns:
        current charset
        Since:
        3.1.4
      • getPropertyFileName

        public static String getPropertyFileName()
        Get property file name
        Returns:
        property file name
      • getVar

        public static String getVar(String secretVar)
        Get value of a secret variable
        Parameters:
        secretVar - secret variable name
        Returns:
        value of secret variable
      • setVar

        public static void setVar(String secretVar, String secretValue)
        Set value of secret variable
        Parameters:
        secretVar -
        secretValue -
      • runCommand

        public static String runCommand(String[] command)
        Run shell command
        Parameters:
        command -
        Returns:
        command output