Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate type correctness of OSGi config properties #32

Open
jwadolowski opened this issue Nov 17, 2016 · 0 comments
Open

Validate type correctness of OSGi config properties #32

jwadolowski opened this issue Nov 17, 2016 · 0 comments

Comments

@jwadolowski
Copy link
Owner

In most cases properties property of cq_osgi_config simply accepts string values, but there are other options too. Please take a look at an example below:

{
  "pid": "org.apache.sling.commons.log.LogManager.factory.config.10b157ad-1812-4fbe-b4fd-4967ac9e3363",
  "title": "Apache Sling Logging Logger Configuration",
  "description": "Configure Loggers with levels, pattern and destination. See http://sling.apache.org/site/logging.html for more detailed documentation and description.",
  "properties": {
    "org.apache.sling.commons.log.level": {
      "name": "Log Level",
      "optional": false,
      "is_set": true,
      "type": {
        "labels": [
          "Trace",
          "Debug",
          "Information",
          "Warnings",
          "Error"
        ],
        "values": [
          "trace",
          "debug",
          "info",
          "warn",
          "error"
        ]
      },
      "value": "info",
      "description": "Root Logger log level setting. (org.apache.sling.commons.log.level)"
    },
    "org.apache.sling.commons.log.file": {
      "name": "Log File",
      "optional": false,
      "is_set": true,
      "type": 1,
      "value": "logs/access.log",
      "description": "The name and path of the log file. If this is empty, logging goes to standard output (the console). If this path is relative it is resolved below ${sling.home}. (org.apache.sling.commons.log.file)"
    },
    "org.apache.sling.commons.log.pattern": {
      "name": "Message Pattern",
      "optional": false,
      "is_set": true,
      "type": 1,
      "value": "{5}",
      "description": "Message Pattern for formatting the log messages. For complete details refer to http://logback.qos.ch/manual/layouts.html#ClassicPatternLayout (org.apache.sling.commons.log.pattern)"
    },
    "org.apache.sling.commons.log.names": {
      "name": "Logger",
      "optional": false,
      "is_set": true,
      "type": 1,
      "values": [
        "log.access"
      ],
      "description": "The logger names applicable for this logger configuration. Each logger name applies for any child category unless configured otherwise. E.g. a logger name of org.apache.sling applies to logger org.apache.sling.commons unless there is a different configuration for org.apache.sling.commons. (org.apache.sling.commons.log.names)"
    },
    "org.apache.sling.commons.log.additiv": {
      "name": "Additivity",
      "optional": false,
      "is_set": false,
      "type": 11,
      "value": "",
      "description": "If set to false then logs from these loggers would not be sent to any appender attached higher in the hierarchy (org.apache.sling.commons.log.additiv)"
    }
  },
  "factoryPid": "org.apache.sling.commons.log.LogManager.factory.config",
  "bundleLocation": "Apache Sling SLF4J Implementation (Logback) (org.apache.sling.commons.log), Version 4.0.6",
  "bundle_location": "slinginstall:org.apache.sling.commons.log-4.0.6.jar",
  "service_location": ""
}

type element specifies what kind of property it is. Config presented above contains the following types:

  • checkbox (org.apache.sling.commons.log.level)
  • dropdown (org.apache.sling.commons.log.level)
  • string (for example org.apache.sling.commons.log.pattern)

cq_osgi_config should validate that and warn user (or stop processing) if there's a mismatch between config definition and user input (i.e. incorrect value from dropdown, string assigned to checkbox, etc)

@jwadolowski jwadolowski modified the milestone: 1.1.0 Dec 7, 2016
@jwadolowski jwadolowski removed this from the 1.1.0 milestone Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant