commit | ab5c17354c4db062452d145524176bc1627c9eef | [log] [tgz] |
---|---|---|
author | justinedelson <justin@apache.org> | Thu Jun 21 16:43:37 2018 -0400 |
committer | GitHub <noreply@github.com> | Thu Jun 21 16:43:37 2018 -0400 |
tree | f2b9d728a77118a3114750e426cf13fa9366e57d | |
parent | 3c821b5bc2c9d30ae29e76992ceb65e0e0309107 [diff] |
don't use class names as example namespaces
The servlet provided by this module allows for creating Capabilities HTTP endpoints on a Sling instance: Resources that provide information on which services are available, version levels etc.
For now, a single type of endpoint is provided: all Resources which have the sling/capabilities
resource type will return the same set of Capabilities, generated by aggregating the output of all active CapabilitiesSource
services.
This can be easily expanded to multiple sets of Capabilities if needed later on, by changing the code to use service properties to group or tag the CapabilitiesSource
services.
These capabilities are not the same as OSGi capabilities: they can be application-related, indicate the availability of external services, etc.
The tests provide simple CapabilitiesSource
examples, that API is as follows:
@ProviderType public interface CapabilitiesSource { /** @return the namespace to use to group our capabilities. * That name must be unique in a given Sling instance. */ String getNamespace(); /** @return zero to N capabilities, each being represented by * a key/value pair. * @throws Exception if the capabilities could not be computed. */ Map<String, Object> getCapabilities() throws Exception; }
The CapabilitiesServlet
produces output as in the example below, where two CapabilitiesSource
services are available:
$ curl -s -u admin:admin http://localhost:8080/tmp/cap.json | jq . { "org.apache.sling.capabilities": { "org.apache.sling.capabilities.osgi": { "framework.bundle.symbolic.name": "org.apache.felix.framework", "framework.bundle.version": "5.6.10" }, "org.apache.sling.capabilities.jvm": { "java.specification.version": "1.8", "java.vm.version": "25.171-b11", "java.vm.vendor": "Oracle Corporation" } } }