This is an automated email from the ASF dual-hosted git repository. davidb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-io.git
The following commit(s) were added to refs/heads/master by this push: new fc897c9 Add some documentation to the sample feature model file. fc897c9 is described below commit fc897c907b4a91e3d35de5369f4dceeb3677c802 Author: David Bosschaert <bossc...@adobe.com> AuthorDate: Tue Jan 8 15:21:55 2019 +0000 Add some documentation to the sample feature model file. Additionally validate the file against the schema during build. --- design/feature-model.json | 44 +++++++++++++++++++++++++++++--------------- pom.xml | 25 +++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 15 deletions(-) diff --git a/design/feature-model.json b/design/feature-model.json index 08152e2..a8db57e 100644 --- a/design/feature-model.json +++ b/design/feature-model.json @@ -1,26 +1,32 @@ { "#": "A key that starts with a hash is a comment", + "id": "org.apache.sling:my.app:slingosgifeature:my-classifier:1.0", - "id": "org.apache.sling:my.app:feature:optional:1.0", - - "# variables": "used in configuration and framework properties are substitityped at launch time.", + "# variables": "used in configuration and framework properties are substituted at launch time.", "variables": { "cfgvar": "somedefault", - "xyz-ver": "1.2.3", + "org.abc.xyz": "1.2.3", "#": "When converting to provisioning model, if you need a special name", "provisioning.model.name": ":boot" }, + "# A prototype is another feature that is used as a prototype for this one ": + "# Bundles, configurations and framework properties can be removed from the ", + "# prototype. Bundles with the same artifact ID defined in the feature override ": + "# bundles with this artifact ID in the Prototype", "prototype": { - "id": "org.apache.sling:sling:9", + "id": "org.apache.sling:some-other-feature:1.2.3", "removals": { "configurations": [], "bundles": [], "framework-properties": [] } }, + + "# Requirements over and above the requirements in the bundles referenced by ": + "# feature.", "requirements": [ { "namespace": "osgi.contract", @@ -29,6 +35,9 @@ } } ], + + "# Capabilities over and above the capabilities provided by the bundles referenced ": + "# by the feature.", "capabilities": [ { "namespace": "osgi.implementation", @@ -51,12 +60,17 @@ } ], + "# Framework properties to be provided to the running OSGi Framework":"", "framework-properties": { "foo": 1, "org.osgi.framework.storage": "${tempdir}", "org.apache.felix.scr.directory": "launchpad/scr" }, + "# The bundles that are part of the feature. Bundles are referenced using Maven ": + "# coordinates and can have additional metadata associated with them. Bundles can ", + "# specified as either a simple string (the Maven coordinates of the bundle) or ": + "# as an object with 'id' and additional metadata.", "bundles": [ { "id": "org.apache.sling:security-server:2.2.0", @@ -74,28 +88,28 @@ "#": "OSGi start level is also supported", "start-level": 20, - "run-modes": ["oak-tar"], - - "configurations": { - "#": "This configuration only gets applied when this bundle is resolved", - "org.apache.sling.somepid": { - "dbuser": "${dbuser}", - "dbpass": "${dbpass}" - } - } + "run-modes": ["oak-tar"] }, - "org.apache.sling:foo-xyz:${xyz-ver}" + "org.apache.sling:foo-xyz:1.2.3" ], + "# The configurations are specified following the format defined by the OSGi Configurator ": + "# specification: https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html ", + "# Variables declared in the variables section can be used for late binding of variables, ": + "# they can be specified with the Launcher, or the default from the variables section is used.", + "# Factory configurations can be specified using the named factory syntax, which separates ": + "# The factory PID and the name with a tilde '~'", "configurations": { "my.pid": { "foo": 5, + "something-enabled": false, "bar": "${cfgvar}", "# The tempdir variable is not specified at the variables section.": "# It needs to be provided at launch, otherwise the launch will stop.", "tempdir": "${tempdir}", + "number:Integer": 7 }, "my.factory.pid~name": { diff --git a/pom.xml b/pom.xml index 5722885..0161651 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,31 @@ </excludes> </configuration> </plugin> + <plugin> + <!-- Validate the example feature file against the schema --> + <artifactId>json-schema-validator</artifactId> + <groupId>com.groupon.maven.plugin.json</groupId> + <version>1.2.0</version> + <executions> + <execution> + <phase>verify</phase> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + <configuration> + <validations> + <validation> + <directory>${basedir}/design</directory> + <jsonSchema>${basedir}/src/main/resources/META-INF/feature/Feature-1.0.0.schema.json</jsonSchema> + <includes> + <include>**/*.json</include> + </includes> + </validation> + </validations> + </configuration> + </plugin> </plugins> </build>