Class StarterConfig


  • public final class StarterConfig
    extends Object
    1C:Enterprise Starter config. 1C:Enterprise Starter configs are *.cfg system files with properties. Starter application uses configs to hold information about infobases references locations, template locations etc. Configs can refer to other configs with COMMON_CONFIG_LOCATION property to provide combined properties.

    Config property entries are not unique: multiple entries with same keys are allowed. Order of values with the same key is also important.

    Example of config file:

     CommonCfgLocation=\\some\server\folder1\1CESCmn.cfg
     CommonInfoBases=\\some\server\folder2\ibcommon.v8i
     ConfigurationTemplatesLocation=C:\Users\UserName\AppData\Roaming\\1C\1cv8\tmplts
     ConfigurationTemplatesLocation=D:\AnotherTemplates\
     UseHWLicenses=1
     AppAutoInstallLastVersion=1
     DefaultVersion=8.3
     

    StarterConfig contains methods to parse and write 1C:Enterprise Starter config properties. Parse methods allows to pass multiple config files as parameters, cause there may be many of them. Also contains String keys constants.

    Example of usage:

     Collection<Path> commonInfobasesFiles =
         StarterConfig.parsePathProperty(StarterConfig.COMMON_INFOBASES, Paths.get("C:\Path\To\1CEStart\1CEStart.cfg"));
    
     allInfobasesFiles.add(commonInfobasesFiles);
     parseInfobasesFiles(allInfobasesFiles);
     
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Field Detail

      • COMMON_CONFIG_LOCATION

        public static final String COMMON_CONFIG_LOCATION
        Common 1C:Enterprise Starter config location property. Value is Path to the common 1C:Enterprise Starter config location.
        See Also:
        Constant Field Values
      • COMMON_INFOBASES

        public static final String COMMON_INFOBASES
        Common infobases config location property. Value is Path to the common infobases config location.
        See Also:
        Constant Field Values
      • DEFAULT_VERSION

        public static final String DEFAULT_VERSION
        Default version mask of 1C:Enterprise to use property. Value is String mask of 1C:Enterprise version with build or versions correspondence.
        See Also:
        Constant Field Values
      • INSTALLED_LOCATION

        public static final String INSTALLED_LOCATION
        Path with 1C:Enterprise runtime installations. Value is Path to 1C:Enterprise runtime installations folder.
        See Also:
        Constant Field Values
      • DISTRIBUTIVE_LOCATION

        public static final String DISTRIBUTIVE_LOCATION
        Path to auto search 1C:Enterprise runtime distributives. Value is Path to distributives folder.
        See Also:
        Constant Field Values
      • CONFIGURATION_TEMPLATES_LOCATION

        public static final String CONFIGURATION_TEMPLATES_LOCATION
        Common infobase templates location property. Value is Path to the common infobases templates location.
        See Also:
        Constant Field Values
      • USE_HARDWARE_LICENSES

        public static final String USE_HARDWARE_LICENSES
        Flag of using hardware licenses property. Value is one of: 0 or 1.
        See Also:
        Constant Field Values
      • INTERNET_SERVICE

        public static final String INTERNET_SERVICE
        URL of web service that provides common infobases and 1C:Enterprise runtime distributives.
        See Also:
        Constant Field Values
      • WEB_COMMON_INFOBASES

        public static final String WEB_COMMON_INFOBASES
        URL of web service that provides common infobases.
        See Also:
        Constant Field Values
      • WEB_DISTRIBUTIVE_LOCATION

        public static final String WEB_DISTRIBUTIVE_LOCATION
        URL of web service that provides 1C:Enterprise runtime distributives.
        See Also:
        Constant Field Values
      • APPLCATION_AUTO_INSTALL_LAST_VERSION

        public static final String APPLCATION_AUTO_INSTALL_LAST_VERSION
        Flag of auto install last version of 1C:Enterprise property. Value is one of: 0 or 1.
        See Also:
        Constant Field Values
    • Method Detail

      • appendCommonConfigs

        public static Path[] appendCommonConfigs​(Path... configLocations)
                                          throws IOException
        Append common 1C:Enterprise Starter configs to the given configs by the COMMON_CONFIG_LOCATION property in the given configs.
        Parameters:
        configLocations - locations of 1C:Enterprise Starter configs, cannot be null
        Returns:
        configLocations with appended common 1C:Enterprise Starter configs, never null
        Throws:
        IOException - if config parse I/O error occurred
      • parseProperties

        public static Map<String,​List<String>> parseProperties​(Path... configLocations)
                                                              throws IOException
        Parse 1C:Enterprise Starter config files to the properties map. Properties of the multiple configs will be combined.Property entries are not unique.
        Parameters:
        configLocations - locations of 1C:Enterprise Starter configs, cannot be null
        Returns:
        combined properties map, never null
        Throws:
        IOException - if config parse I/O error occurred
      • parseProperty

        public static List<String> parseProperty​(String key,
                                                 Path... configLocations)
                                          throws IOException
        Parse single property from 1C:Enterprise Starter config files. Property value of the multiple configs will be combined.
        Parameters:
        key - the property key, cannot be null
        configLocations - locations of 1C:Enterprise Starter configs, cannot be null
        Returns:
        the values ordered list, never null
        Throws:
        IOException - if config parse I/O error occurred
      • parsePathProperty

        public static List<Path> parsePathProperty​(String key,
                                                   Path... configLocations)
                                            throws IOException
        Parse single Path property from 1C:Enterprise Starter config files. Property value of the multiple configs will be combined.
        Parameters:
        key - the property key, cannot be null
        configLocations - locations of 1C:Enterprise Starter configs, cannot be null
        Returns:
        the Path values ordered list, never null
        Throws:
        IOException - if config parse I/O error occurred
      • parseBooleanProperty

        public static Optional<Boolean> parseBooleanProperty​(String key,
                                                             Path... configLocations)
                                                      throws IOException
        Parse single boolean property from 1C:Enterprise Starter config files.
        Parameters:
        key - the property key, cannot be null
        configLocations - locations of 1C:Enterprise Starter configs, cannot be null
        Returns:
        the optional boolean value property
        Throws:
        IOException - if config parse I/O error occurred
      • writeProperties

        public static void writeProperties​(Map<String,​List<String>> properties,
                                           Path configLocation)
                                    throws IOException
        Write the given properties to the given 1C:Enterprise Starter config. All previous content will be overriden. Order of properties is important, LinkedHashMap usage is recommended.
        Parameters:
        properties - the properties map, cannot be null
        configLocation - the location of 1C:Enterprise Starter config to write to, cannot be null
        Throws:
        IOException - if config write I/O error occurred
      • writeProperty

        public static void writeProperty​(String key,
                                         List<String> value,
                                         Path configLocation)
                                  throws IOException
        Write single property with the given key to the given 1C:Enterprise Starter config. All other config content remains the same.
        Parameters:
        key - the property key, cannot be null
        value - all values of the properties, cannot be null, may be empty to erase property; order of values is important
        configLocation - the location of 1C:Enterprise Starter config to write to, cannot be null
        Throws:
        IOException - if config write I/O error occurred
      • writePathProperty

        public static void writePathProperty​(String key,
                                             List<Path> value,
                                             Path configLocation)
                                      throws IOException
        Write single Path property with the given key to the given 1C:Enterprise Starter config. All other config content remains the same.
        Parameters:
        key - the property key, cannot be null
        value - all values of the properties, cannot be null, may be empty to erase property; order of values is important
        configLocation - the location of 1C:Enterprise Starter config to write to, cannot be null
        Throws:
        IOException - if config write I/O error occurred
      • writeBooleanProperty

        public static void writeBooleanProperty​(String key,
                                                boolean value,
                                                Path configLocation)
                                         throws IOException
        Write single boolean property with the given key to the given 1C:Enterprise Starter config. All other config content remains the same.
        Parameters:
        key - the property key, cannot be null
        value - all values of the properties, cannot be null, may be empty to erase property; order of values is important
        configLocation - the location of 1C:Enterprise Starter config to write to, cannot be null
        Throws:
        IOException - if config write I/O error occurred