Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

The purpose of the plugin is to allow to set up a specific configuration for a Wedia portal application, by overriding a basic configuration provided by the product.

The base of the configuration is a JSON file. Any element of this JSON can be overriden in a folder, through a tree of files and folders that correspond to the tree of the base JSON. Multiple folders can be added to redefine the configuration redefined by the previous folders.

Mappings

A configuration is thus defined by a series of files that will redefine the basic configuration successively, in order to obtain a final configuration, the fusion of the whole.

This series of folder constitutes a path designated by a unique identifier. A client application will retrieve its final configuration via this ID. Mappings define the correspondence between IDs and paths. The configuration of mappings is done in the plugin settings.

Adaptation to the context

...

  • a list of possible values, at least one, but preferably several (for a single value, you might as well use a static file).

  • a function to convert the invocation context into a value that must be one of the possible values

Plugin settings

Mappings

Mappings associate configuration identifiers with paths defining a configuration.

...

  • _portal

  • _portal@config

  • _portal@config@picker

The path _portal@$config@picker designates a configuration defined in 3 folders whose relative paths are successively :

...

You can implement your own header-dependent post processor by implementing the fr.wedia.confres.core.model.processor.AbstractHeaderPostProcessor abstraction and its String getValue(String,Collection<fr.wedia.confres.api.util.Headers>) method. See others methods getValueFoNoHeaders and getValueForNull to return a value respectively for no headers or null headers. See the javadoc for more information

Parameter processor

Abstraction

fr.wedia.confres.core.model.processor.AbstractParameterPostProcessor is a base for processors whose value depends on parameters.

Customizings postprocessors

...

  • as it is a folder name, there must not be any forbidden characters in the file names (slash (/), backslash(\), column(:), pipe (|), chevrons (< and >), question mark (?), double-quotes (")...)

  • do not use arobase (@), this character being used as a name separator in configuration folder names, to avoid possible conflicts. Avoid also other separators, like dot (.), whitespaces…

  • generally avoid characters other than letters (without accent), numbers, underscore and dash (avoid dash if possible, this character can cause problems within URLs

  • the initial dollar character ($) is always considered as a cutting order

  • values should be considered case insensitive, but use lower case (as folders can be deployed by nar)

  • the blank values are always ignored (skip the processor value in the final path). For example, if a path is defined by x@:processor@y, and the corresponding postprocessor returns a blank string, the path will be x@y.

Since 2023.2

A processor can return a value

  • composed of several paths (thus containing @, for example x@y)

  • referring to another processor (for example the returned value is x@:otherproc@y
    beware however of an infinite recursion, there is no test. In general, limit the depth of recursion to limit computing time.

  • in addition we can escape a character with the backslash

Set-up

You can configure a custom postprocessor via its declaration in the plugin configuration.

...

  • json, string or file, (at least one is mandatory), that contains JSon (or XJSon), multiple values allowed (JSon lenient parsing is not supported)

  • xjson, boolean, optional (default is false). If true, if the jsons passed in parameter must be considered as xjson, false, otherwise (not to be confused with the xjson option which controls how the response json is formed)

  • lenient, boolean, optional (default is false). If true, the xjsons passed in parameter must be processed as lenient

  • explain, boolean optional (default is false). If true, the result is an explain, if false, the result is a merge. (works only with end point /test)

  • locations, optional
    This parameter allows to give location names to each JSon. Indeed, as there is no corresponding physical location (no files or folders), a virtual location is generated with just an incremental index (from 1 to n, and Root for root). This parameter allows to name the layers.

    • either by a JSon array (example: locations=[_base,_base@test])

    • or by strings (example ...&locations=_base&locations=_base%40test&...)

  • pathFilter (see get configuration and explain configuration)

  • pathFilterMode (see get configuration and explain configuration)

  • nodesWithPaths (see get configuration and explain configuration)

  • options (see get configuration and explain configuration)

  • verbosity, only if explain (see get configuration and explain configuration)

processors list

Gets processors list (variable names)

...

Put an exclusive access lock (if not already owned).

Response

Http status

200

The lock has been obtained or extended

403

Unable to obtain a lock (already owned, or error)

503

Locks are unavailable

500

Other errors

unlock

DELETE /fs/lock(operation ID: lockDelete)

Delete the owned lock.

Response

Http status

200

Lock deleted

202

No lock

403

Lock not owned

500

Other errors

get lock

GET /fs/lock(operation ID: lockGet)

Test if lock is owned (and extend it)

Http status

200

Lock is owned and extended

202

Lock not owned (free)

403

Lock is owned by some body else (other surfer or other session)

503

Locks are unavailable

500

Errors

Auto locking

Any service that creates, modifies or deletes configuration files automatically creates a lock (enableable/disableable by plugin configuration).

...

This service allows to modify (patch or replace) the configuration in a layer, or in a subfolder of a layer

Parameters

  • layer, (see Basic file operatirons/Parameters for details), mandatory
    denotes the configuration layer

  • path, (see Basic file operatirons/Parameters for details), optional, can be single or multiple, depending on the presence of content
    specifies the relative xjsonpath (to the configuration layer) where to write

  • content, string or file(multipart/formdata), optional
    The XJSON (lenient) to write. If this parameter is not specified, multiple paths can be specified. If this parameter is specified, only one path or none can be specified (in this case, we write directly to the layer)

  • wip, boolean, optional(default is false)⛔
    True to write to wip data

  • delete, boolean, optional(default is false)⛔
    True to write delete overrides. In this mode, the primitive values in the xjson (if present) are ignored.

  • options, JSON with the following properties

    • merge, boolean, optional (true by default)
      True to keep the other properties already existing in the namespace we are writing. If false, All other properties in the written namespace will be removed

      For example, the name space is currently

      Code Block
      /a
          /b
              /c
                c1.json = "c1"
                c2.json = "c2"
          /d
              d1.json = "d1"

      We write this XJSON:

      Code Block
      languagejson
      {
        "a": 
          "b": {
            "c": {
                "c2": "c2>modified",
                "c3": "new"
            }
          }
        }
      }

      With merge=true, the result is

      Code Block
      /a
          /b
              /c
                c1.json = "c1"
                c2.json = "c2>modified"
                c3.json = "new"
          /d
              d1.json = d1

      With merge=false, the result is

      Code Block
      /a
          /b
              /c
                c2.json = "c2>modified"
                c3.json = "new"    
    • mkLayers, boolean, optional(false by default)
      True to create layer if it doesn’t exists

    • keepFormat, boolean, optional(false by default)
      By default, only JSon is written to files (or empty content for .delete files). If keepFormat is true, and the JSon value is string, and the target file is already existing, the original format (from the suffix) is kept.
      Example
      Here the current file system:

      Code Block
      languagejson
      /a
          /b
              /c
                c1.json = "c1"
                c2.txt= c2
          /d
              d1.json = "d1"

      XJSON to write:

      Code Block
      languagejson
      {
        "a": 
          "b": {
            "c": {
                "c1": "c1>modified",
                "c2": "c2>modified"
            }
          }
        }
      }

      Result with keepFormat=false

      Code Block
      languagejson
      /a
          /b
              /c
                c1.json = "c1>modified"
                c2.json = "c2>modified"
          /d
              d1.json = "d1"

      Result with keepFormat=true

      Code Block
      /a
          /b
              /c
                c1.json = "c1>modified"
                c2.txt= c2>modified
          /d
              d1.json = "d1"
    • keepDelete, boolean (optional, true by default)
      when a property is written, the files concerning this same property are deleted (the writing constitutes a replacement). This option indicates how the file with the delete extension is to be considered during this replacement: by default, it is not deleted (keepDelete=true). You can force the deletion by setting keepDelete to false.

    • keepProperty, boolean (optional, true by default)
      when you write .delete files in path mode, the files concerning the same property aren’t deleted. You can force deletion by setting keepProperty to false.

...

Command name: fs/config/delete

  • layer, (see Basic file operatirons/Parameters for details), mandatory
    denotes the configuration layer

  • path, (see Basic file operatirons/Parameters for details), optional, can be single or multiple, depending on the presence of content
    specifies the relative xjsonpath (to the configuration layer) where to write

  • content, string or file(multipart/formdata), optional
    The XJSON to write. If this parameter is not specified, multiple paths can be specified. If this parameter is specified, only one path or none can be specified (in this case, we write directly to the layer).
    This XJSON is not lenient. Arrays are used to specify the operation (see details in the paragraph Delete configuration (write delete files and/or remove files) with a XJSON):

    • DELETE

    • REMOVE

  • wip, boolean, optional(default is false)⛔
    True to write to wip data

  • options, JSON with the following properties

    • deleteNotEmpty, boolean (optional, true by default)
      if false, REMOVE option is not applyed on not empty directories

    • mkLayers, boolean (optional, false by default)

...

Some errors are not raised in error if there are several layer names. In this case, see the state property in the response.

HTTP status

When

State when several layers

400 - Bad request

no layer name (missing mandatory parameter)

400 - Bad request

a layer name is a base

BASE

400 - Bad request

a layer name contains forbidden char (slash, backslash, dollars, or file forbidden chars)

INVALID

500 - Internal Server error

An error occurred while creating the layer

ERROR

Example

Code Block
curl --request POST \
  --url 'http://<host>/api/portalconfig/fs/layer?layer=_portal%40testcreate&layer=_portal%40testcreate1&layer=_portal%40testcreate2'

...

View file
nameInsomnia_2022-07-07_test_wxm_config_resolver.json

test doc

...

test 1

...

test 2

...

test 3

...

item 1
text

  • sub item 1

  • sub item 2

...