This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-site.git
commit 94a48c911057cd35a80a9abcdc1f6a3c72ee168e Author: Thomas Wolfart <[email protected]> AuthorDate: Tue Jul 17 21:15:24 2018 +0200 fix markup for code highlighting --- .../content/documentation/bundles/log-tracers.md | 2 +- .../jbake/content/documentation/bundles/metrics.md | 8 ++++---- .../sling-settings-org-apache-sling-settings.md | 2 +- .../content/documentation/development/logging.md | 20 ++++++++++---------- .../the-sling-engine/service-authentication.md | 2 +- .../documentation/the-sling-engine/servlets.md | 8 ++++---- .../the-sling-engine/wrap-or-decorate-resources.md | 4 ++-- .../how-to-manage-events-in-sling.md | 20 ++++++++++---------- .../tutorials-how-tos/jackrabbit-persistence.md | 6 +++--- .../old-stuff/run-modes-org-apache-sling-runmode.md | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/main/jbake/content/documentation/bundles/log-tracers.md b/src/main/jbake/content/documentation/bundles/log-tracers.md index d8e8682..70fdf70 100644 --- a/src/main/jbake/content/documentation/bundles/log-tracers.md +++ b/src/main/jbake/content/documentation/bundles/log-tracers.md @@ -204,7 +204,7 @@ Recording features works as explained below Below is a json output for GET request - :::javascript + ::javascript { "method": "GET", "time": 15140, diff --git a/src/main/jbake/content/documentation/bundles/metrics.md b/src/main/jbake/content/documentation/bundles/metrics.md index 9c1a0f0..22c5a95 100644 --- a/src/main/jbake/content/documentation/bundles/metrics.md +++ b/src/main/jbake/content/documentation/bundles/metrics.md @@ -17,7 +17,7 @@ application. ## Basic Usage - :::java + ::java import org.apache.sling.metrics.Counter; import org.apache.sling.metrics.MetricsService; @@ -88,13 +88,13 @@ The instance registered has a service property `name` set to `sling` (so as allo from any other registered `MetricRegistry` instance). It can be used to get direct access to Dropwizard Metric API if required. - :::java + ::java @Reference(target = "(name=sling)") private MetricRegistry registry; Also the wrapper Metric instance can be converted to actual instance via `adaptTo` calls. - :::java + ::java import org.apache.sling.commons.metrics.Counter Counter counter = metricService.counter("login"); @@ -117,7 +117,7 @@ use of same name in different registry instances. Add following Maven dependency to your pom.xml: - :::xml + ::xml <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.commons.metrics</artifactId> diff --git a/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md b/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md index f44d1f1..914d291 100644 --- a/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md +++ b/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md @@ -69,7 +69,7 @@ Remember to look at the `RunModeImplTest` mentioned above for details, and feel The `SlingSettings` service provides the Run Modes of the running Sling instance as in this example: - :::java + ::java SlingSettings settings = ...get from BundleContext... Set<String> currentRunModes = settings.getRunModes(); diff --git a/src/main/jbake/content/documentation/development/logging.md b/src/main/jbake/content/documentation/development/logging.md index 129e480..1608401 100644 --- a/src/main/jbake/content/documentation/development/logging.md +++ b/src/main/jbake/content/documentation/development/logging.md @@ -201,7 +201,7 @@ The following sections provide more details. [Logback TurboFilters][3] operate globally and are invoked for every Logback call. To register an OSGi `TurboFilter`, just to register an service that implements the `ch.qos.logback.classic.turbo.TurboFilter` interface. - :::java + ::java import import ch.qos.logback.classic.turbo.MatchingFilter; SimpleTurboFilter stf = new SimpleTurboFilter(); @@ -227,7 +227,7 @@ be passed to the appender. When registering a filter the bundle needs to configu `appenders` which refers to list of appender names to which the Filter must be attached - :::java + ::java import ch.qos.logback.core.filter.Filter; SimpleFilter stf = new SimpleFilter(); @@ -254,7 +254,7 @@ If the `appenders` value is set to `*` then the filter would be registered with just register a service that implements the `ch.qos.logback.core.Appender` interface. Such a service must have a `loggers` service property, which refers to list of logger names to which the Appender must be attached. - :::java + ::java Dictionary<String,Object> props = new Hashtable<String, Object>(); String[] loggers = { @@ -277,7 +277,7 @@ If you have the config as string then you can register that String instance as a set to true. The Sling Logback Extension monitors such objects and passes them to logback. - :::java + ::java Properties props = new Properties(); props.setProperty("logbackConfig","true"); @@ -305,7 +305,7 @@ If the config needs to be updated just re-register the service so that changes a Another way to provide config fragments is with services that implement the `org.apache.sling.commons.log.logback.ConfigProvider` interface. - :::java + ::java @Component @Service public class ConfigProviderExample implements ConfigProvider { @@ -317,7 +317,7 @@ Another way to provide config fragments is with services that implement the If the config changes then sending an OSGi event with the `org/apache/sling/commons/log/RESET` topic resets the Logback runtime. - :::java + ::java eventAdmin.sendEvent(new Event("org/apache/sling/commons/log/RESET",new Properties())); ### External Config File @@ -330,7 +330,7 @@ Logback can be configured with an external file. The file name can be specified If you are providing an external config file then to support OSGi integration you need to add following action entry: - :::xml + ::xml <newRule pattern="*/configuration/osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAction"/> <newRule pattern="*/configuration/appender-ref-osgi" @@ -367,7 +367,7 @@ For example, for the following OSGi config The Logback appender would be named `logs/error.log`. To extend/override the config in a Logback config create an appender with the name `logs/error.log`: - :::xml + ::xml <appender name="/logs/error.log" class="ch.qos.logback.core.FileAppender"> <file>${sling.home}/logs/error.log</file> <encoder> @@ -389,7 +389,7 @@ of the API jar, follow the below steps. (See [SLING-3243][SLING-3243]) for more 1. Update the api version in the pom: - :::xml + ::xml <dependencies> <dependency> <groupId>org.slf4j</groupId> @@ -402,7 +402,7 @@ of the API jar, follow the below steps. (See [SLING-3243][SLING-3243]) for more 2. Add an `Import-Package` instruction with a custom version range: - :::xml + ::xml <build> <plugins> <plugin> diff --git a/src/main/jbake/content/documentation/the-sling-engine/service-authentication.md b/src/main/jbake/content/documentation/the-sling-engine/service-authentication.md index 3aff61f..ae547b6 100644 --- a/src/main/jbake/content/documentation/the-sling-engine/service-authentication.md +++ b/src/main/jbake/content/documentation/the-sling-engine/service-authentication.md @@ -168,7 +168,7 @@ The according user must exist at the point in time where `ResourceResolverFactor Example OSGi DS Component - :::java + ::java @Component( reference = { // this waits with the activation of this component until a service user mapping with the service name = current bundle's id and the sub service name 'my-subservice-name' is available. diff --git a/src/main/jbake/content/documentation/the-sling-engine/servlets.md b/src/main/jbake/content/documentation/the-sling-engine/servlets.md index 18540ac..e45651c 100644 --- a/src/main/jbake/content/documentation/the-sling-engine/servlets.md +++ b/src/main/jbake/content/documentation/the-sling-engine/servlets.md @@ -53,7 +53,7 @@ The following examples show example code how you can register Servlets with Slin 1. OSGi DS 1.4 (R7) component property type annotations for Sling Servlets (recommended) - :::java + ::java @Component( service = { Servlet.class }, @SlingServletResourceTypes( @@ -71,7 +71,7 @@ The following examples show example code how you can register Servlets with Slin This is only supported though with if you use `bnd-maven-plugin` and use Sling which is at least compliant with OSGi R6 (DS 1.3). There is no actual run-time dependency to OSGi R7! The configuration for the `bnd-maven-plugin` should look like this in your `pom.xml` - :::xml + ::xml <build> ... <plugins> @@ -107,7 +107,7 @@ The following examples show example code how you can register Servlets with Slin 1. Simple OSGi DS 1.2 annotations (use only if you cannot use approach 1.) - :::java + ::java @Component( service = { Servlet.class }, property = { @@ -127,7 +127,7 @@ The following examples show example code how you can register Servlets with Slin 2. The `@SlingServlet` annotation (evaluated by maven-scr-plugin, use only if you can neither use 1. nor 2.) - :::java + ::java @SlingServlet( resourceTypes = "/apps/my/type", selectors = "hello", diff --git a/src/main/jbake/content/documentation/the-sling-engine/wrap-or-decorate-resources.md b/src/main/jbake/content/documentation/the-sling-engine/wrap-or-decorate-resources.md index faa6adf..e948451 100644 --- a/src/main/jbake/content/documentation/the-sling-engine/wrap-or-decorate-resources.md +++ b/src/main/jbake/content/documentation/the-sling-engine/wrap-or-decorate-resources.md @@ -14,7 +14,7 @@ The Sling API provides an easy way to wrap or decorate a resource before returni To add a resource decorator just register one or more services which implement the interface `ResourceDecorator` - :::java + ::java interface ResourceDecorator { /** Optionally decorate the supplied Resource */ Resource decorate(Resource) @@ -32,7 +32,7 @@ If the service does not want to decorate the resource, it should return the orig Starting with version 2.1.0 of the JCR Resource bundle, the two-argument `decorate` method is not called anymore. Implementors of this interface targeting both newer and older versions of this bundle are advised to implement this method as: - :::java + ::java public Resource decorate(Resource resource, HttpServletRequest request) { return this.decorate(resource); } diff --git a/src/main/jbake/content/documentation/tutorials-how-tos/how-to-manage-events-in-sling.md b/src/main/jbake/content/documentation/tutorials-how-tos/how-to-manage-events-in-sling.md index 235ca85..5462fe1 100644 --- a/src/main/jbake/content/documentation/tutorials-how-tos/how-to-manage-events-in-sling.md +++ b/src/main/jbake/content/documentation/tutorials-how-tos/how-to-manage-events-in-sling.md @@ -40,7 +40,7 @@ an **event.topics** property that describes which event topics the handler is in To listen to a Sling **resource added** events, for example, you'll set the *event.topics* property to **org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED** in the class annotations: - :::java + ::java @Property(name=org.osgi.service.event.EventConstants.EVENT_TOPIC, value=org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED) @@ -52,7 +52,7 @@ class lists and explains the available event topics available in Sling. To start a job, the *JobManager* service can be used. It needs a job topic and a payload. In our case we define our dropbox job topic and give the resource path as the payload: - :::java + ::java final String resourcePath = ...; // path to the resource to handle final Map<String, Object> payload = new HashMap<String, Object>(); payload.put("resourcePath", resourcePath); @@ -61,7 +61,7 @@ To start a job, the *JobManager* service can be used. It needs a job topic and a To receive the resource event, the service needs to implement the **org.osgi.service.event.EventHandler** interface and register it as an EventHandler service: - :::java + ::java @Component(immediate=true) // immediate should only be used in rare cases (see below) @Service(value=EventHandler.class) public class DropBoxService implements EventHandler { @@ -72,14 +72,14 @@ Usually a service should be lazy and therefore not declare itself to be immediat To start the job we need a reference to the JobManager: - :::java + ::java @Reference private JobManager jobManager; The job topic for dropbox job events needs to be defined: - :::java + ::java /** The job topic for dropbox job events. */ public static final String JOB_TOPIC = "com/sling/eventing/dropbox/job"; @@ -96,7 +96,7 @@ Its logic is as follows: For example: - :::java + ::java public void handleEvent(final Event event) { // get the resource event information final String propPath = (String) event.getProperty(SlingConstants.PROPERTY_PATH); @@ -121,14 +121,14 @@ Now that you have implemented a service that starts a job when a file is uploade To process to the job that have been defined before the property **job.topics** needs to be set to **DropBoxService.JOB_TOPIC** in the class annotations: - :::java + ::java @Property(name="job.topics", value=DropBoxService.JOB_TOPIC) In addition the service needs to implement the **org.apache.sling.event.jobs.consumer.JobConsumer** interface: - :::java + ::java public class DropBoxEventHandler implements JobConsumer { @@ -140,7 +140,7 @@ Some class fields need to be defined: For example: - :::java + ::java /** Default log. */ protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -165,7 +165,7 @@ Its logic is as follows: or in Java Code: - :::java + ::java public JobResult process(final Job job) { ResourceResolver adminResolver = null; try { diff --git a/src/main/jbake/content/documentation/tutorials-how-tos/jackrabbit-persistence.md b/src/main/jbake/content/documentation/tutorials-how-tos/jackrabbit-persistence.md index 7a2bd04..599afcd 100644 --- a/src/main/jbake/content/documentation/tutorials-how-tos/jackrabbit-persistence.md +++ b/src/main/jbake/content/documentation/tutorials-how-tos/jackrabbit-persistence.md @@ -35,14 +35,14 @@ Another option is to create the bundle on your own using Peter Kriens' [bnd Tool 1. Get the JDBC driver for your database from the driver provider 1. Wrap the JDBC driver library into an OSGi bundle: - :::sh + ::sh # Example for PostgreSQL JDBC 3 driver 8.4-701 $ java -jar bnd.jar wrap postgresql-8.4-701.jdbc3.jar $ mv postgresql-8.4-701.jdbc3.bar postgresql-8.4-701.jdbc3-bnd.jar 1. Deploy the driver to your local Maven 2 Repository (Required if adding the JDBC driver to a Maven build, e.g. using the Sling Launchpad Plugin) - :::sh + ::sh $ mvn install:install-file \ -DgroupId=postgresql -DartifactId=postgresql -Dversion=8.4.701.jdbc3 \ -Dpackaging=jar -Dfile=postgresql-8.4-701.jdbc3-bnd.jar @@ -74,7 +74,7 @@ If the file already exists, you can modifiy this existing file and there is no n For example to use PostgreSQL instead of Derby modify the `<PersistenceManager>` elements as follows: - :::xml + ::xml <Repository> ... <Workspace name="${wsp.name}"> diff --git a/src/main/jbake/content/old-stuff/run-modes-org-apache-sling-runmode.md b/src/main/jbake/content/old-stuff/run-modes-org-apache-sling-runmode.md index 32556e2..5ad8931 100644 --- a/src/main/jbake/content/old-stuff/run-modes-org-apache-sling-runmode.md +++ b/src/main/jbake/content/old-stuff/run-modes-org-apache-sling-runmode.md @@ -35,7 +35,7 @@ This command-line parameter takes precedence over a similar definition (*sling.r The [RunMode service]({{ refs.http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/main/java/org/apache/sling/runmode/RunMode.java.path }}) provides the current list of run modes, examples: - :::java + ::java RunMode r = ...get from BundleContext... String [] currentRunModes = r.getCurrentRunModes();
