Interface PropertyFileService

All Known Implementing Classes:
PropertyFileServiceImpl

@Contract public interface PropertyFileService
This service will read a java property file and add its contents to the HK2 configuration hub.

The property file can have structured keys. If the property key has a dot in it (.) then the string before the dot is considered to be the name of the type. If there are two dots then the name of the instance is the string following the first dot and before the second dot. Anything after the second dot is the name of the property.

A specific type name can be given. If a specific type name is provided then the name prior to the first dot is considered the name of the instance, and everything after the first dot is the name of the property

A default name for instances of the type can be given. Any instance name provided in the property file will override the default instance name. The default default instance name is "DEFAULT"

  • Field Details

    • DEFAULT_INSTANCE_NAME

      static final String DEFAULT_INSTANCE_NAME
      The default name for an instance if the instance name cannot be determined
      See Also:
    • DEFAULT_TYPE_NAME

      static final String DEFAULT_TYPE_NAME
      The default name for a type if the type name cannot be determined
      See Also:
  • Method Details

    • createPropertyHandleOfSpecificType

      PropertyFileHandle createPropertyHandleOfSpecificType(String specificTypeName, String defaultInstanceName)
      Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name. This is generally used for property files that provide a specific set of instances for a single type. The default instance name will be set to the defaultInstanceName given
      Parameters:
      specificTypeName - The non-null, non-empty string specific type name. All instances created or modified with this PropertyFileHandle will be in this type
      defaultInstanceName - The default name to give to instances of this type if the instance name cannot be determined. If null or the empty string then the default default instance of DEFAULT will be used
      Returns:
      A non-null PropertyFileHandle that can be used to read the property file
    • createPropertyHandleOfSpecificType

      PropertyFileHandle createPropertyHandleOfSpecificType(String specificTypeName)
      Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name. This is generally used for property files that provide a specific set of instances for a single type
      Parameters:
      specificTypeName - The non-null, non-empty string specific type name. All instances created or modified with this PropertyFileHandle will be in this type
      Returns:
      A non-null PropertyFileHandle that can be used to read the property file
    • createPropertyHandleOfAnyType

      PropertyFileHandle createPropertyHandleOfAnyType(String defaultTypeName, String defaultInstanceName)
      Creates a PropertyFileHandle for reading an HK2 property file. This is used for property files that provide instances of multiple types within the same property file
      Parameters:
      defaultTypeName - The default type name that will be used if a type name could not be determined. If null or empty the default type name of DEFAULT_TYPE will be used
      defaultInstanceName - The default name to give to instances of this type if the instance name cannot be determined. If null or the empty string then the default default instance of DEFAULT will be used
      Returns:
      A non-null PropertyFileHandle that can be used to read the property file
    • createPropertyHandleOfAnyType

      PropertyFileHandle createPropertyHandleOfAnyType()
      Creates a PropertyFileHandle for reading an HK2 property file. This is used for property files that provide instances of multiple types within the same property file. Will use the default type name of DEFAULT_TYPE for types that cannot be determined and the default instance name of DEFAULT for instance names that cannot be determined
      Returns:
      A non-null PropertyFileHandle that can be used to read the property file
    • addPropertyFileBean

      void addPropertyFileBean(PropertyFileBean propertyFileBean)
      This is a utility method that will add the given PropertyFileBean to the Hub for use in configuring this service
      Parameters:
      propertyFileBean - The non-null property file bean that should either be added to the Hub or be used to modify the existing bean in the hub
    • removePropertyFileBean

      void removePropertyFileBean()
      This is a utility method that will remove the PropertyFileBean from the Hub if it is present