Class ExtendedPropertyConfigurator

java.lang.Object
org.exoplatform.container.PropertyConfigurator
org.exoplatform.container.ExtendedPropertyConfigurator
All Implemented Interfaces:
Startable

public class ExtendedPropertyConfigurator extends PropertyConfigurator implements Startable
Allow set system properties.
Example of configuration:
 
 <component>
   <key>ExtendedPropertyConfigurator</key>
   <type>org.exoplatform.container.ExtendedPropertyConfigurator</type>
   <init-params>
     <properties-param>
      <name>MyPropertySet1</name>
      <property name="myproperty" value="myvalue" />
     </properties-param>
     <properties-param profile="myProfile">
      <name>MyPropertySet1</name>
      <property name="myproperty" value="myvalue2" />
     </properties-param>
     <properties-param>
      <name>MyPropertySet1</name>
      <property name="myproperty2" value="myothervalue" />
     </properties-param>
     <values-param>
       <name>properties.urls</name>
       <value>cloud.properties</value>
       <value>cluster.properties</value>
     </values-param>
   </init-params>
 </component>
 
 

Note that properties-param entries and properties.url optional and can be omitted. Note that if a path in properties.url doesn't exist it will be skipped with an info message
A property value of the form secret-file:/path/to/file in a file of properties.urls is replaced by the content of that file (trailing line breaks removed), which allows to use Docker secrets, e.g. exo.email.smtp.password=secret-file:/run/secrets/smtp_password. By default a missing or unreadable file is logged and the entry is ignored: the property keeps any value set earlier (by a previous file of properties.urls), or its default. When the property exo.properties.secretFile.strict is true, it fails instead the creation of this component, so that the container doesn't start with a missing secret. That property is read before each file of properties.urls, so it applies to the files that follow the one that sets it. Set it with a -D option or in a file listed before the one holding the secrets (ex: docker.properties): in a bundle that declares this component for the root and for the portal containers, the root container is then not built and the startup stops. Do not set it in the file holding the secrets: the root instance ignores the entry, then the portal container fails, Tomcat starts and the portal answers 503. Only files listed in properties.urls are resolved: values of the file given by the properties.url init param or the exo.properties.url system property are used as is.
  • Field Details

    • SECRET_FILE_PREFIX

      public static final String SECRET_FILE_PREFIX
      Prefix of a property value referencing a file (ex: a Docker secret) holding the real value.
      See Also:
    • SECRET_FILE_STRICT_PROPERTY

      public static final String SECRET_FILE_STRICT_PROPERTY
      Name of the property that makes an unreadable secret file fail the startup instead of being ignored.
      See Also:
  • Constructor Details

    • ExtendedPropertyConfigurator

      public ExtendedPropertyConfigurator(InitParams params, ConfigurationManager confManager)
      Constructor used by ExoContainer.
      Parameters:
      params -
      confManager -
  • Method Details

    • start

      public void start()
      Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
      Specified by:
      start in interface Startable
      Overrides:
      start in class PropertyConfigurator
    • stop

      public void stop()
      Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement Disposable if you need a single call at the definite end of the lifecycle.
      Specified by:
      stop in interface Startable
      Overrides:
      stop in class PropertyConfigurator