http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/jcr-mock.html ---------------------------------------------------------------------- diff --git a/documentation/development/jcr-mock.html b/documentation/development/jcr-mock.html index 2b71a8f..852080f 100644 --- a/documentation/development/jcr-mock.html +++ b/documentation/development/jcr-mock.html @@ -75,15 +75,14 @@ </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Mock implementation of selected JCR APIs for easier testing. It stores all data in-memory in a HashMap to ensure instantly creating and destroying of the JCR repository.</p> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Maven Dependency</h2> -<pre><code>#!xml -<dependency> +<h2><a href="#maven-dependency" name="maven-dependency">Maven Dependency</a></h2> +<pre><code><!-- TODO syntax marker (#!xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.jcr-mock</artifactId> </dependency> </code></pre> <p>See latest version on the <a href="/downloads.cgi">downloads page</a>.</p> -<h2>Implemented mock features</h2> +<h2><a href="#implemented-mock-features" name="implemented-mock-features">Implemented mock features</a></h2> <p>The mock implementation supports:</p> <ul> <li>Reading and writing all data (primitive values, arrays, binary data) via the JCR API</li> @@ -101,23 +100,21 @@ <li>Exporting/Importing data via document and system views not supported</li> <li>Workspace management methods not supported</li> </ul> -<h2>Usage</h2> -<h3>Getting JCR mock objects</h3> +<h2><a href="#usage" name="usage">Usage</a></h2> +<h3><a href="#getting-jcr-mock-objects" name="getting-jcr-mock-objects">Getting JCR mock objects</a></h3> <p>The factory class <code>MockJcr</code> allows to instantiate the different mock implementations.</p> <p>Example:</p> -<pre><code>#!java -// get session +<pre><code><!-- TODO syntax marker (#!java) disabled -->// get session Session session = MockJcr.newSession(); // get repository Repository repository = MockJcr.newRepository(); </code></pre> <p>The repository is empty and contains only the root node. You can use the JCR API to read or write content.</p> -<h3>Mocking queries</h3> +<h3><a href="#mocking-queries" name="mocking-queries">Mocking queries</a></h3> <p>If you want to test code that contains a JCR query you can simulate a query execution and set the result to return during setting up your unit test.</p> <p>Example:</p> -<pre><code>#!java -// prepare mocked search result +<pre><code><!-- TODO syntax marker (#!java) disabled -->// prepare mocked search result List<Node> resultNodes = ImmutableList.of(node1, node2, node3); // return this result for all queries
http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/jsr-305.html ---------------------------------------------------------------------- diff --git a/documentation/development/jsr-305.html b/documentation/development/jsr-305.html index e6e7290..cd0bef5 100644 --- a/documentation/development/jsr-305.html +++ b/documentation/development/jsr-305.html @@ -74,9 +74,9 @@ Leveraging JSR-305 null annotations to prevent NullPointerExceptions </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h1>Introduction</h1> +<h1><a href="#introduction" name="introduction">Introduction</a></h1> <p>The Sling API forces developers to sometimes check for <code>null</code> return values. Most prominently this is the case for <a href="https://sling.apache.org/apidocs/sling8/org/apache/sling/api/adapter/Adaptable.html#adaptTo-java.lang.Class-"><code>Adaptable.adaptTo</code></a> and <a href="https://sling.apache.org/apidocs/sling8/org/apache/sling/api/resource/ResourceResolver.html#getResource-java.lang.String-"><code>ResourceResolver.getResource</code></a>. This is often forgotten, which may lead to <code>NullPointerException</code>s. Sling API 2.9.0 introduced the JSR-305 annotations (<a href="https://issues.apache.org/jira/browse/SLING-4377">SLING-4377</a>) which allow tools to check automatically for missing null checks in the code.</p> -<h1>Annotations</h1> +<h1><a href="#annotations" name="annotations">Annotations</a></h1> <p>The annotations used within Sling are based on the <a href="https://jcp.org/en/jsr/detail?id=305">JSR-305</a> which is dormant since 2012. Nevertheless those annotations are understood by most of the tools and used by other Apache Projects like Apache Oak <a href="https://issues.apache.org/jira/browse/OAK-37">OAK-37</a>.</p> <p>Due to the fact that Eclipse and FindBugs are interpreting annotations differently (<a href="https://sourceforge.net/p/findbugs/bugs/1355/">Findbugs-1355</a>). Sling only uses the following two different annotations which are supported by both tools:</p> <ol> @@ -85,7 +85,7 @@ </ol> <p>Annotations which support setting the default null semantics of return values and or parameters on a package level cannot be leveraged for that reason.</p> <p>The annotations have a retention policy of <code>runtime</code>, therefore bundles using these automatically have a <code>Import-Package</code> header listing <code>javax.annotation</code>. That package is by default exported by the system bundle (as this package is also part of the <a href="https://docs.oracle.com/javase/7/docs/api/javax/annotation/package-summary.html">JRE</a>). To be able to resolve the bundle through this exported package from the system bundle you should use the <code>com.google.code.findbugs:jsr305</code> artifact in version 3.0.0 as that exports the package <code>javax.annotation</code> in no specific version. Newer versions use version directives which automatically restrict the version range for the generated <code>Import-Package</code> header to <code>[3,4)</code> <a href="https://github.com/amaembo/jsr-305/issues/31">which usually cannot be resolved at run time</a>.</p> -<h1>Use With Eclipse</h1> +<h1><a href="#use-with-eclipse" name="use-with-eclipse">Use With Eclipse</a></h1> <p>Eclipse since Juno supports <a href="http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm&anchor=null_analysis">null analysis based on any annotations</a>. Those need to be enabled in <em>Preferences->Java->Compiler->Errors/Warnings</em> via <strong>Enable annoation-based null analysis</strong>. Also the annotations need to be configured. For Sling/JSR 305 those are</p> <ul> <li><code>javax.annotation.CheckForNull</code> as <strong>'Nullable' annotation</strong> (primary annotation)</li> @@ -95,11 +95,10 @@ <p>Unfortunately Eclipse cannot infer information about fields which are for sure either null or not null (reasoning is available in <a href="https://wiki.eclipse.org/JDT_Core/Null_Analysis/Options#Risks_of_flow_analysis_for_fields">https://wiki.eclipse.org/JDT_Core/Null_Analysis/Options#Risks_of_flow_analysis_for_fields</a> and <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=247564">Eclipse Bug 247564</a>). This also affecs constants (static final fields) or enums which are known to be non null, but still Eclipse will emit a warning like <em>The expression of type 'String' needs unchecked conversion to conform to '@Nonnull String'</em>. The only known workaround is to disable the <strong>"Unchecked conversion from non-annotated type to @NonNull type"</strong> or to annotate also the field with <code>@Nonnull</code>.</p> <p>More information are available at <a href="https://wiki.eclipse.org/JDT_Core/Null_Analysis">https://wiki.eclipse.org/JDT_Core/Null_Analysis</a>.</p> <p>Since Eclipse 4.5 (Mars) <strong>external annotations</strong> are supported as well (i.e. annotations maintained outside of the source code of the libraries, e.g. for the JRE, Apache Commons Lang). There are some external annotations being mainted at <a href="http://www.lastnpe.org/">lastnpe.org</a> and <a href="https://github.com/tracecompass/tracecompass/tree/master/common/org.eclipse.tracecompass.common.core/annotations">TraceCompass</a>. There is no official repository yet though (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=449653">Eclipse Bug 449653</a>). <a href="http://www.lastnpe.org/">Lastnpe.org</a> provides also an m2e extension to ease setting up the classpaths with external annotations from within your pom.xml.</p> -<h1>Use With Maven</h1> -<h2>Leveraging Eclipse JDT Compiler (recommended)</h2> +<h1><a href="#use-with-maven" name="use-with-maven">Use With Maven</a></h1> +<h2><a href="#leveraging-eclipse-jdt-compiler-recommended-" name="leveraging-eclipse-jdt-compiler-recommended-">Leveraging Eclipse JDT Compiler (recommended)</a></h2> <p>You can use Eclipse JDT also in Maven (with null analysis enabled) for the regular compilation. That way it will give out the same warnings/errors as Eclipse and will also consider external annotations. JDT in its most recent version is provided by the <code>tycho-compiler-plugin</code> which can be hooked up with the <code>maven-compiler-plugin</code>. The full list of options for JDT is described in <a href="http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_batch_compiler.htm">here</a>. This method was presented by Michael Vorburger in his presentation <a href="https://www.slideshare.net/mikervorburger/the-end-of-the-world-as-we-know-it-aka-your-last-nullpointerexception-1b-bugs/14">The end of the world as we know it</a>.</p> -<pre><code>::xml -<plugin> +<pre><code><!-- TODO syntax marker (::xml) disabled --><plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> @@ -124,10 +123,9 @@ </dependencies> </plugin> </code></pre> -<h2>Leveraging FindBugs</h2> +<h2><a href="#leveraging-findbugs" name="leveraging-findbugs">Leveraging FindBugs</a></h2> <p>You can also let Maven automatically run FindBugs to execute those checks via the <strong>findbugs-maven-plugin</strong>. For that just add the following plugin to your <code>pom.xml</code></p> -<pre><code>::xml -<plugin> +<pre><code><!-- TODO syntax marker (::xml) disabled --><plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>3.0.0</version> @@ -145,7 +143,7 @@ </plugin> </code></pre> <p>The results are often very imprecise (<a href="http://jira.codehaus.org/browse/MFINDBUGS-208">MFINDBUGS-208</a>), especially when it comes to line numbers, therefore it is best to start the Findbugs GUI in case of errors found by this plugin via <code>mvn findbugs:gui</code>.</p> -<h1>Use With FindBugs</h1> +<h1><a href="#use-with-findbugs" name="use-with-findbugs">Use With FindBugs</a></h1> <p>FindBugs evaluates the JSR-305 annotations by default. You can restrict the rules to only the ones which check for those annotations, which are</p> <ul> <li>InconsistentAnnotations</li> @@ -155,7 +153,7 @@ </ul> <p>A complete list of visitors class names in Findbugs can be found in the <a href="https://code.google.com/p/findbugs/source/browse/#git%2Ffindbugs%2Fsrc%2Fjava%2Fedu%2Fumd%2Fcs%2Ffindbugs%2Fdetect%253Fstate%253Dclosed">sourcecode</a>. The according <a href="http://findbugs.sourceforge.net/bugDescriptions.html">bug patterns</a> have an identifier (in parenthesis) for which you can search in the according Java classes, in case you want to extend the checks.</p> <p>Findbugs is also integrated in <a href="http://docs.sonarqube.org/display/SONAR/Findbugs+Plugin">SonarQube</a> but for SonarQube you should now rather use the native Java plugin (look at <a href="#use-with-sonarqube">Use with SonarQube</a>).</p> -<h1>Use with SonarQube</h1> +<h1><a href="#use-with-sonarqube" name="use-with-sonarqube">Use with SonarQube</a></h1> <p>At least rule <a href="https://sonarqube.com/coding_rules#rule_key=squid%3AS2259">squid:S2259</a> in SonarQube supports JSR-305 annotations as well for null checks.</p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/logging.html ---------------------------------------------------------------------- diff --git a/documentation/development/logging.html b/documentation/development/logging.html index 3bf6114..574d139 100644 --- a/documentation/development/logging.html +++ b/documentation/development/logging.html @@ -78,7 +78,7 @@ This document is for the new (November 2013) 4.x release of the Sling Commons Lo </div> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Introduction</h2> +<h2><a href="#introduction" name="introduction">Introduction</a></h2> <p>Logging in Sling is supported by the <code>org.apache.sling.commons.log</code> bundle, which is one of the first bundles installed and started by the Sling Launcher. This bundle along with other bundles manages the Sling Logging and provides the following features:</p> <ul> <li>Implements the OSGi Log Service Specification and registers the <code>LogService</code> and <code>LogReader</code> services</li> @@ -90,10 +90,10 @@ This document is for the new (November 2013) 4.x release of the Sling Commons Lo <li>Configures logging through Logback which is integrated with the OSGi environment</li> <li>Allows logging to be configured both via editing Logback xml or via OSGi Configurations</li> </ul> -<h3>v5.0.0 release</h3> +<h3><a href="#v5-0-0-release" name="v5-0-0-release">v5.0.0 release</a></h3> <p>With Sling Log 5.0.0. release the webconsole support has been moved to a different bundle named Sling Commons Log WebConsole (org.apache.sling.commons.log.webconsole:1.0.0)</p> <p>Also with this release Logback 1.1.7 version is embedded and thus it requires slf4j-api:1.7.15. See <a href="https://issues.apache.org/jira/browse/SLING-6144">SLING-6144</a> for details</p> -<h2>WebConsole Plugin</h2> +<h2><a href="#webconsole-plugin" name="webconsole-plugin">WebConsole Plugin</a></h2> <p>The Web Console Plugin supports the following features:</p> <ul> <li>Display the list of loggers which have levels or appenders configured.</li> @@ -106,7 +106,7 @@ This document is for the new (November 2013) 4.x release of the Sling Commons Lo <li>Provides links to log file content allows log file content to be viewed from Web UI</li> </ul> <img src="sling-log-support.png" /> -<h2>WebTail</h2> +<h2><a href="#webtail" name="webtail">WebTail</a></h2> <p>The Web Console Plugin also supports tailing of the current active log files. It generates link to all active log files which can be used to see there content from within the browser. The url used is like</p> <p><code> http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=lucene&name=%2Flogs%2Ferror.log @@ -122,7 +122,7 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce </ul> </li> </ul> -<h2>Initial Configuration</h2> +<h2><a href="#initial-configuration" name="initial-configuration">Initial Configuration</a></h2> <p>The <code>org.apache.sling.commons.log</code> bundle gets its initial configuration from the following <code>BundleContext</code> properties:</p> <table> <thead> @@ -190,9 +190,9 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce </tr> </tbody> </table> -<h2>User Configuration - OSGi Based</h2> +<h2><a href="#user-configuration-osgi-based" name="user-configuration-osgi-based">User Configuration - OSGi Based</a></h2> <p>User Configuration after initial configuration is provided by the Configuration Admin Service. To this avail two <code>org.osgi.services.cm.ManagedServiceFactory</code> services are registered under the PIDs <code>org.apache.sling.commons.log.LogManager.factory.writer</code> and <code>org.apache.sling.commons.log.LogManager.factory.config</code> to receive configurations.</p> -<h3>Logger Configuration</h3> +<h3><a href="#logger-configuration" name="logger-configuration">Logger Configuration</a></h3> <p>Loggers (or Categories) can be configured to log to specific files at specific levels using configurable patterns. To this avail factory configuration instances with factory PID <code>org.apache.sling.commons.log.LogManager.factory.config</code> may be created and configured with the Configuration Admin Service.</p> <p>The following properties may be set:</p> <table> @@ -227,7 +227,7 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce </table> <p>| <code>org.apache.sling.commons.log.names</code> | <code>String\[\]</code> | -- | A list of logger names to which this configuration applies. | | <code>org.apache.sling.commons.log.additiv</code> | <code>Boolean</code> | false | If set to false then logs from these loggers would not be sent to any appender attached higher in the hierarchy |</p> <p>Note that multiple Logger Configurations may refer to the same Log Writer Configuration. If no Log Writer Configuration exists whose file name matches the file name set on the Logger Configuration an implicit Log Writer Configuration with default setup (daily log rotation) is internally created. While the log level configuration is case insensitive, it is suggested to always use upper case letters.</p> -<h3>Log Writer Configuration</h3> +<h3><a href="#log-writer-configuration" name="log-writer-configuration">Log Writer Configuration</a></h3> <p>Log Writer Configuration is used to setup file output and log file rotation characteristics for log writers used by the Loggers.</p> <p>The following properties may be set:</p> <table> @@ -257,10 +257,10 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce </tbody> </table> <p>See the section <em>Log File Rotation</em> below for full details on the <code>org.apache.sling.commons.log.file.size</code> and <code>org.apache.sling.commons.log.file.number</code> properties.</p> -<h4>Log File Rotation</h4> +<h4><a href="#log-file-rotation" name="log-file-rotation">Log File Rotation</a></h4> <p>Log files can grow rather quickly and fill up available disk space. To cope with this growth log files may be rotated in two ways: At specific times or when the log file reaches a configurable size. The first method is called <em>Scheduled Rotation</em> and is used by specifying a <code>SimpleDateFormat</code> pattern as the log file "size". The second method is called <em>Size Rotation</em> and is used by setting a maximum file size as the log file size.</p> <p>As of version 2.0.6 of the Sling Commons Log bundle, the default value for log file scheduling is <code>'.'yyyy-MM-dd</code> causing daily log rotation. In previous version, log rotation defaults to a 10MB file size limit.</p> -<h5>Scheduled Rotation</h5> +<h5><a href="#scheduled-rotation" name="scheduled-rotation">Scheduled Rotation</a></h5> <p>The rolling schedule is specified by setting the <code>org.apache.sling.commons.log.file.size</code> property to a <code>java.text.SimpleDateFormat</code> pattern. Literal text (such as a leading dot) to be included must be <em>enclosed</em> within a pair of single quotes. A formatted version of the date pattern is used as the suffix for the rolled file name. Internally the Log bundle configures a <code>TimeBasedRollingPolicy</code> for the appender. Refer to <a href="http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy">TimeBasedRollingPolicy</a> for more details around the pattern format</p> <p>For example, if the log file is configured as <code>/foo/bar.log</code> and the pattern set to <code>'.'yyyy-MM-dd</code>, on 2001-02-16 at midnight, the logging file <code>/foo/bar.log</code> will be renamed to <code>/foo/bar.log.2001-02-16</code> and logging for 2001-02-17 will continue in a new <code>/foo/bar.log</code> file until it rolls over the next day.</p> <p>It is possible to specify monthly, weekly, half-daily, daily, hourly, or minutely rollover schedules.</p> @@ -307,10 +307,10 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce </table> <p>Do not use the colon ":" character in anywhere in the pattern option. The text before the colon is interpreted as the protocol specification of a URL which is probably not what you want.</p> <p>Note that Scheduled Rotation ignores the <code>org.apache.sling.commons.log.file.number</code> property since the old log files are not numbered but "dated".</p> -<h5>Size Rotation</h5> +<h5><a href="#size-rotation" name="size-rotation">Size Rotation</a></h5> <p>Log file rotation by size is specified by setting the <code>org.apache.sling.commons.log.file.size</code> property to a plain number or a number plus a size multiplier. The size multiplier may be any of <code>K</code>, <code>KB</code>, <code>M</code>, <code>MB</code>, <code>G</code>, or <code>GB</code> where the case is ignored and the meaning is probably obvious.</p> <p>When using Size Rotation, the <code>org.apache.sling.commons.log.file.number</code> defines the number of old log file generations to keep. For example to keep 5 old log files indexed by 0 through 4, set the <code>org.apache.sling.commons.log.file.number</code> to <code>5</code> (which happens to be the default).</p> -<h2>Logback Integration</h2> +<h2><a href="#logback-integration" name="logback-integration">Logback Integration</a></h2> <p>Logback integration provides following features</p> <ul> <li>LogBack configuration can be provided via Logback config xml</li> @@ -321,10 +321,9 @@ http://localhost:8080/system/console/slinglog/tailer.txt?tail=1000&grep=luce <li>Exposes Logback runtime state through the Felix WebConsole Plugin</li> </ul> <p>The following sections provide more details.</p> -<h3>TurboFilters as OSGi Services</h3> +<h3><a href="#turbofilters-as-osgi-services" name="turbofilters-as-osgi-services">TurboFilters as OSGi Services</a></h3> <p><a href="http://logback.qos.ch/manual/filters.html#TurboFilter">Logback TurboFilters</a> operate globally and are invoked for every Logback call. To register an OSGi <code>TurboFilter</code>, just to register an service that implements the <code>ch.qos.logback.classic.turbo.TurboFilter</code> interface.</p> -<pre><code>:::java -import import ch.qos.logback.classic.turbo.MatchingFilter; +<pre><code>:<!-- TODO syntax marker (::java) disabled -->import import ch.qos.logback.classic.turbo.MatchingFilter; SimpleTurboFilter stf = new SimpleTurboFilter(); ServiceRegistration sr = bundleContext.registerService(TurboFilter.class.getName(), stf, null); @@ -341,10 +340,9 @@ private static class SimpleTurboFilter extends MatchingFilter { } </code></pre> <p>As these filters are invoked for every call they must execute quickly.</p> -<h3>Filters as OSGi services</h3> +<h3><a href="#filters-as-osgi-services" name="filters-as-osgi-services">Filters as OSGi services</a></h3> <p><a href="http://logback.qos.ch/manual/filters.html">Logback Filters</a> are attached to appenders and are used to determine if any LoggingEvent needs to be passed to the appender. When registering a filter the bundle needs to configure a service property <code>appenders</code> which refers to list of appender names to which the Filter must be attached</p> -<pre><code>:::java -import ch.qos.logback.core.filter.Filter; +<pre><code>:<!-- TODO syntax marker (::java) disabled -->import ch.qos.logback.core.filter.Filter; SimpleFilter stf = new SimpleFilter(); Dictionary<String, Object> props = new Hashtable<String, Object>(); @@ -363,10 +361,9 @@ private static class SimpleFilter extends Filter<ILoggingEvent> { } </code></pre> <p>If the <code>appenders</code> value is set to <code>*</code> then the filter would be registered with all the appenders (<code>Since 4.0.4</code>)</p> -<h3>Appenders as OSGi services</h3> +<h3><a href="#appenders-as-osgi-services" name="appenders-as-osgi-services">Appenders as OSGi services</a></h3> <p><a href="http://logback.qos.ch/manual/appenders.html">Logback Appenders</a> handle the logging events produced by Logback. To register an OSGi <code>Appender</code>, just register a service that implements the <code>ch.qos.logback.core.Appender</code> interface. Such a service must have a <code>loggers</code> service property, which refers to list of logger names to which the Appender must be attached.</p> -<pre><code>:::java -Dictionary<String,Object> props = new Hashtable<String, Object>(); +<pre><code>:<!-- TODO syntax marker (::java) disabled -->Dictionary<String,Object> props = new Hashtable<String, Object>(); String[] loggers = { "foo.bar:DEBUG", @@ -376,12 +373,11 @@ String[] loggers = { props.put("loggers",loggers); sr = bundleContext.registerService(Appender.class.getName(),this,props); </code></pre> -<h3>Logback Config Fragment Support</h3> +<h3><a href="#logback-config-fragment-support" name="logback-config-fragment-support">Logback Config Fragment Support</a></h3> <p>Logback supports including parts of a configuration file from another file (See <a href="http://logback.qos.ch/manual/configuration.html#fileInclusion">File Inclusion</a>). This module extends that support by allowing other bundles to provide config fragments. There are two ways to achieve that, described below.</p> -<h4>Logback config fragments as String objects</h4> +<h4><a href="#logback-config-fragments-as-string-objects" name="logback-config-fragments-as-string-objects">Logback config fragments as String objects</a></h4> <p>If you have the config as string then you can register that String instance as a service with property <code>logbackConfig</code> set to true. The Sling Logback Extension monitors such objects and passes them to logback.</p> -<pre><code>:::java -Properties props = new Properties(); +<pre><code>:<!-- TODO syntax marker (::java) disabled -->Properties props = new Properties(); props.setProperty("logbackConfig","true"); String config = "<included>\n" + @@ -401,10 +397,9 @@ String config = "<included>\n" + registration = context.registerService(String.class.getName(),config,props); </code></pre> <p>If the config needs to be updated just re-register the service so that changes are picked up.</p> -<h4>Logback config fragments as ConfigProvider instances</h4> +<h4><a href="#logback-config-fragments-as-configprovider-instances" name="logback-config-fragments-as-configprovider-instances">Logback config fragments as ConfigProvider instances</a></h4> <p>Another way to provide config fragments is with services that implement the <code>org.apache.sling.commons.log.logback.ConfigProvider</code> interface.</p> -<pre><code>:::java -@Component +<pre><code>:<!-- TODO syntax marker (::java) disabled -->@Component @Service public class ConfigProviderExample implements ConfigProvider { public InputSource getConfigSource() { @@ -413,25 +408,23 @@ public class ConfigProviderExample implements ConfigProvider { } </code></pre> <p>If the config changes then sending an OSGi event with the <code>org/apache/sling/commons/log/RESET</code> topic resets the Logback runtime.</p> -<pre><code>:::java -eventAdmin.sendEvent(new Event("org/apache/sling/commons/log/RESET",new Properties())); +<pre><code>:<!-- TODO syntax marker (::java) disabled -->eventAdmin.sendEvent(new Event("org/apache/sling/commons/log/RESET",new Properties())); </code></pre> -<h3>External Config File</h3> +<h3><a href="#external-config-file" name="external-config-file">External Config File</a></h3> <p>Logback can be configured with an external file. The file name can be specified through</p> <ol> <li>OSGi config - Look for a config with name <code>Apache Sling Logging Configuration</code> and specify the config file path.</li> <li>OSGi Framework Properties - Logback support also looks for a file named according to the OSGi framwork <code>org.apache.sling.commons.log.configurationFile</code> property.</li> </ol> <p>If you are providing an external config file then to support OSGi integration you need to add following action entry:</p> -<pre><code>:::xml -<newRule pattern="*/configuration/osgi" +<pre><code>:<!-- TODO syntax marker (::xml) disabled --><newRule pattern="*/configuration/osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAction"/> <newRule pattern="*/configuration/appender-ref-osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAppenderRefAction"/> <osgi/> </code></pre> <p>The <code>osgi</code> element enables the OSGi integration support</p> -<h3>Java Util Logging (JUL) Integration</h3> +<h3><a href="#java-util-logging-jul-integration" name="java-util-logging-jul-integration">Java Util Logging (JUL) Integration</a></h3> <p>The bundle also support <a href="http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html">SLF4JBridgeHandler</a>. The two steps listed below enable the JUL integration. This allows for routing logging messages from JUL to the Logbback appenders.</p> <ol> <li>Set the <code>org.apache.sling.commons.log.julenabled</code> framework property to true.</li> @@ -447,8 +440,7 @@ org.apache.sling.commons.log.file.number=I"7" org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4}* [{2}] {3} {5}" </code></pre> <p>The Logback appender would be named <code>logs/error.log</code>. To extend/override the config in a Logback config create an appender with the name <code>logs/error.log</code>:</p> -<pre><code>:::xml -<appender name="/logs/error.log" class="ch.qos.logback.core.FileAppender"> +<pre><code>:<!-- TODO syntax marker (::xml) disabled --><appender name="/logs/error.log" class="ch.qos.logback.core.FileAppender"> <file>${sling.home}/logs/error.log</file> <encoder> <pattern>%d %-5level %X{sling.userId:-NA} [%thread] %logger{30} %marker- %msg %n</pattern> @@ -457,13 +449,12 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} </appender> </code></pre> <p>In this case the logging module creates an appender based on the Logback config instead of the OSGi config. This can be used to move the application from OSGi based configs to Logback based configs.</p> -<h2>Using Slf4j API 1.7</h2> +<h2><a href="#using-slf4j-api-1-7" name="using-slf4j-api-1-7">Using Slf4j API 1.7</a></h2> <p>With Slf4j API 1.7 onwards its possible to use logger methods with varargs i.e. log n arguments without constructing an object array e.g. <code>log.info("This is a test {} , {}, {}, {}",1,2,3,4)</code>. Without var args you need to construct an object array <code>log.info("This is a test {} , {}, {}, {}",new Object[] {1,2,3,4})</code>. To make use of this API and still be able to use your bundle on Sling systems which package older version of the API jar, follow the below steps. (See <a href="https://issues.apache.org/jira/browse/SLING-3243">SLING-3243</a>) for more details.</p> <ol> <li> <p>Update the api version in the pom:</p> - <pre><code>:::xml -<dependencies> + <pre><code>:<!-- TODO syntax marker (::xml) disabled --><dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> @@ -476,8 +467,7 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} </li> <li> <p>Add an <code>Import-Package</code> instruction with a custom version range: </p> - <pre><code>:::xml -<build> + <pre><code>:<!-- TODO syntax marker (::xml) disabled --><build> <plugins> <plugin> <groupId>org.apache.felix</groupId> @@ -501,10 +491,10 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} </ol> <p>The Slf4j API bundle 1.7.x is binary compatible with 1.6.x.</p> <p>This setup allows your bundles to make use of the var args feature while making logging calls, but the bundles can still be deployed on older systems which provide only the 1.6.4 version of the slf4j api.</p> -<h2>Log Tracer</h2> +<h2><a href="#log-tracer" name="log-tracer">Log Tracer</a></h2> <p>Log Tracer provides support for enabling the logs for specific category at specific level and only for specific request. It provides a very fine level of control via config provided as part of HTTP request around how the logging should be performed for given category.</p> <p>Refer to <a href="/documentation/bundles/log-tracers.html">Log Tracer Doc</a> for more details</p> -<h2>Slf4j MDC</h2> +<h2><a href="#slf4j-mdc" name="slf4j-mdc">Slf4j MDC</a></h2> <p>Sling MDC Inserting Filter exposes various request details as part of <a href="http://www.slf4j.org/manual.html#mdc">MDC</a>.</p> <p>Currently it exposes following variables:</p> <ol> @@ -520,23 +510,21 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} <p>The filter also allow configuration to extract data from request cookie, header and parameters. Look for configuration with name 'Apache Sling Logging MDC Inserting Filter' for details on specifying header, cookie, param names.</p> <p><img src="/documentation/bundles/mdc-filter-config.png" alt="MDC Filter Config" /></p> <a name="mdc-pattern"> -<h3>Including MDC in Log Message</h3> +<h3><a href="#including-mdc-in-log-message" name="including-mdc-in-log-message">Including MDC in Log Message</a></h3> <p>To include the MDC value in log message you MUST use the <a href="http://logback.qos.ch/manual/layouts.html#conversionWord">Logback pattern</a> based on Logback and not the old MessageFormat based pattern. </p> <pre><code>%d{dd.MM.yyyy HH:mm:ss.SSS} *%p* [%X{req.remoteHost}] [%t] %c %msg%n </code></pre> -<h3>Installation</h3> +<h3><a href="#installation" name="installation">Installation</a></h3> <p>Download the bundle from <a href="http://sling.apache.org/downloads.cgi">here</a> or use following Maven dependency</p> -<pre><code>::xml -<dependency> +<pre><code><!-- TODO syntax marker (::xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.extensions.slf4j.mdc</artifactId> <version>1.0.0</version> </dependency> </code></pre> -<h2>Logback Groovy Fragment</h2> +<h2><a href="#logback-groovy-fragment" name="logback-groovy-fragment">Logback Groovy Fragment</a></h2> <p>This fragment is required to make use of Groovy based event evaluation support provided by Logback. This enables programatic filtering of the log messages and is useful to get desired logs without flooding the system. For example Oak logs the JCR operations being performed via a particular session. if this lo is enabled it would flood the log with messages from all the active session. However if you need logging only from session created in a particular thread then that can be done in following way</p> -<pre><code>::xml -<?xml version="1.0" encoding="UTF-8"?> +<pre><code><!-- TODO syntax marker (::xml) disabled --><?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="1 second"> <jmxConfigurator/> <newRule pattern="*/configuration/osgi" actionClass="org.apache.sling.commons.log.logback.OsgiAction"/> @@ -566,17 +554,16 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} </configuration> </code></pre> <p>Logback exposes a variable <code>e</code> which is of type <a href="http://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html">ILoggingEvent</a>. It provides access to current logging event. Above logback config would route all log messages from <code>org.apache.jackrabbit.oak.jcr.operations</code> category to <code>${sling.home}/logs/oak.log</code>. Further only those log messages would be logged where the <code>threadName</code> contains <code>JobHandler</code>. Depending on the requirement the expression can be customised.</p> -<h3>Installation</h3> +<h3><a href="#installation" name="installation">Installation</a></h3> <p>Currently the bundle is not released and has to be build from <a href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/logback-groovy-fragment/">here</a></p> -<pre><code>::xml -<dependency> +<pre><code><!-- TODO syntax marker (::xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.extensions.logback-groovy-fragment</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> </code></pre> -<h2>FAQ</h2> -<h5>Q. Can Sling Commons Log bundle be used in non Sling environments</h5> +<h2><a href="#faq" name="faq">FAQ</a></h2> +<h5><a href="#q-can-sling-commons-log-bundle-be-used-in-non-sling-environments" name="q-can-sling-commons-log-bundle-be-used-in-non-sling-environments">Q. Can Sling Commons Log bundle be used in non Sling environments</a></h5> <p>This bundle does not depend on any other Sling bundle and can be easily used in any OSGi framework. To get complete log support working you need to deploy following bundles</p> <ul> <li>Slf4j-Api - org.slf4j:slf4j-api</li> @@ -586,7 +573,7 @@ org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy HH:mm:ss.SSS} *{4} <li>Sling Commons Log - org.apache.sling:org.apache.sling.commons.log:4.0.0 or above</li> <li>Sling Log WebConsole - org.apache.sling.commons.log.webconsole:1.0.0 or above</li> </ul> -<h5>Q. How to start Sling with an external logback.xml file</h5> +<h5><a href="#q-how-to-start-sling-with-an-external-logback-xml-file" name="q-how-to-start-sling-with-an-external-logback-xml-file">Q. How to start Sling with an external logback.xml file</a></h5> <p>You need to specify the location of logback.xml via <code>org.apache.sling.commons.log.configurationFile</code></p> <pre><code> java -jar org.apache.sling.launchpad-XXX-standalone.jar -Dorg.apache.sling.commons.log.configurationFile=/path/to/logback </code></pre></section></div></div> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/maven-archetypes.html ---------------------------------------------------------------------- diff --git a/documentation/development/maven-archetypes.html b/documentation/development/maven-archetypes.html index ba0ea7b..589be57 100644 --- a/documentation/development/maven-archetypes.html +++ b/documentation/development/maven-archetypes.html @@ -73,17 +73,17 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/documentation.html">Documentation</a> » <a href="/ng/documentation/development.html">Development</a> » </div> <h1> Maven Archetypes </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Sling includes four Maven archetypes to quick start development. See <a href="http://maven.apache.org/archetype/maven-archetype-plugin/">http://maven.apache.org/archetype/maven-archetype-plugin/</a> for general information on using Maven archetypes. The Maven groupId for all Sling archetypes is <code>org.apache.sling</code>.</p> -<h3>sling-launchpad-standalone-archetype</h3> +<h3><a href="#sling-launchpad-standalone-archetype" name="sling-launchpad-standalone-archetype">sling-launchpad-standalone-archetype</a></h3> <p>This archetype generates a Maven project which will build a standalone Launchpad JAR file using the default bundle set. For demonstration purposes, the generated project includes an extra bundle list file (<code>src/main/bundles/list</code>) which includes Apache Felix FileInstall as well as a test configuration file (<code>src/test/config/sling.properties</code>).</p> -<h3>sling-launchpad-webapp-archetype</h3> +<h3><a href="#sling-launchpad-webapp-archetype" name="sling-launchpad-webapp-archetype">sling-launchpad-webapp-archetype</a></h3> <p>This archetype generates a Maven project which will build a Launchpad WAR file using the default bundle set. For demonstration purposes, the generated project includes an extra bundle list file (<code>src/main/bundles/list</code>) which includes Apache Felix FileInstall as well as a test configuration file (<code>src/test/config/sling.properties</code>).</p> -<h3>sling-intitial-content-archetype</h3> +<h3><a href="#sling-intitial-content-archetype" name="sling-intitial-content-archetype">sling-intitial-content-archetype</a></h3> <p>This archetype generates a Maven project which will build an OSGi bundle that supports JCR NodeType registration (in <code>SLING-INF/nodetypes/nodetypes.cnd</code>) and initial content loading (in <code>SLING-INF/scripts</code> and <code>SLING-INF/content</code>).</p> -<h3>sling-servlet-archetype</h3> +<h3><a href="#sling-servlet-archetype" name="sling-servlet-archetype">sling-servlet-archetype</a></h3> <p>This archetype generates a Maven project which will build an OSGi bundle containing two Servlets registered with Sling, one registered by path and one registered by resource type.</p> -<h3>sling-bundle-archetype</h3> +<h3><a href="#sling-bundle-archetype" name="sling-bundle-archetype">sling-bundle-archetype</a></h3> <p>This archetype generates a Maven project which will build a basic OSGi bundle including support for the Felix SCR Annotations. It is pre-configured to install using the Felix Web Console when the profile <code>autoInstallBundle</code> is activated.</p> -<h3>sling-jcrinstall-bundle-archetype</h3> +<h3><a href="#sling-jcrinstall-bundle-archetype" name="sling-jcrinstall-bundle-archetype">sling-jcrinstall-bundle-archetype</a></h3> <p>This archetype generates a Maven project which will build a basic OSGi bundle including support for the Felix SCR Annotations. It is pre-configured to install using a WebDAV PUT into the JCR when the profile <code>autoInstallBundle</code> is activated.</p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/maven-launchpad-plugin.html ---------------------------------------------------------------------- diff --git a/documentation/development/maven-launchpad-plugin.html b/documentation/development/maven-launchpad-plugin.html index 5de62bb..e57ee1f 100644 --- a/documentation/development/maven-launchpad-plugin.html +++ b/documentation/development/maven-launchpad-plugin.html @@ -134,7 +134,7 @@ refer to the source code and the launchpad/builder and launchpad/testing modules </tr> </tbody> </table> -<h3>General Configuration</h3> +<h3><a href="#general-configuration" name="general-configuration">General Configuration</a></h3> <p>In general, the bulk of the configuration of the Maven Launchpad Plugin is concerned with setting up the bundle list which all of the goals will use. This bundle list is created using the following steps:</p> <ol> <li>If <code>includeDefaultBundles</code> is <code>true</code> (the default), the default bundle list is loaded. By default, this is <code>org.apache.sling.launchpad:org.apache.sling.launchpad:RELEASE:xml:bundlelist</code>, but can be overridden by setting the <code>defaultBundleList</code> plugin parameter.</li> @@ -145,11 +145,11 @@ refer to the source code and the launchpad/builder and launchpad/testing modules </ol> <p>When a bundle is added to the bundle list, if a bundle with the same groupId, artifactId, type, and classifier is already in the bundle list, the version of the existing bundle is modified. However, the start level of a bundle is never changed once that bundle is added to the bundle list.</p> <p>The plugin may also contribute bundles to (or remove bundles from) the bundle list as it sees fit.</p> -<h3>Framework Configuration</h3> +<h3><a href="#framework-configuration" name="framework-configuration">Framework Configuration</a></h3> <p>For the <code>run</code> and <code>start</code> goals, the plugin will look for a file named <code>src/test/config/sling.properties</code>. If this file is present, it will be filtered using standard Maven filtering and used to populate the OSGi framework properties. This can be used, for example, to specify a <code>repository.xml</code> file to be used during development:</p> <pre><code>sling.repository.config.file.url=${basedir}/src/test/config/repository.xml </code></pre> -<h2>Bundle List Files</h2> +<h2><a href="#bundle-list-files" name="bundle-list-files">Bundle List Files</a></h2> <p>The bundle list file uses a simple XML syntax representing a list of bundles organized into start levels:</p> <pre><code><?xml version="1.0"?> <bundles> @@ -185,7 +185,7 @@ refer to the source code and the launchpad/builder and launchpad/testing modules </code></pre> <p>Within each <code>bundle</code> element, <code>type</code> and <code>classifier</code> are also supported.</p> <p>The Http Service support can not be configured using the bundle list, but only using the <code>jarWebSupport</code> parameter, since it is specific to whether the Sling Launchpad is built as a java application (in which case the Jetty-based Http Service is used) or a web application (in which case the Http Service bridge is used).</p> -<h2>Artifact Definition</h2> +<h2><a href="#artifact-definition" name="artifact-definition">Artifact Definition</a></h2> <p>The <code>defaultBundleList</code>, <code>jarWebSupport</code>, <code>additionalBundles</code>, and <code>bundleExclusions</code> parameters are configured with artifact definitions. This is done using a syntax similar to Maven dependency elements:</p> <pre><code><configuration> ... @@ -225,9 +225,9 @@ refer to the source code and the launchpad/builder and launchpad/testing modules </configuration> </code></pre> <p>By default, bundles are added to start level 0. To change, this use the <code>startLevel</code> element within each additional bundle definition.</p> -<h2>Integration Testing</h2> +<h2><a href="#integration-testing" name="integration-testing">Integration Testing</a></h2> <p>For integration testing examples, see <code>/samples/inplace-integration-test</code> and <code>launchpad/testing</code> in the Sling source tree.</p> -<h2>Bundle List Rewriting</h2> +<h2><a href="#bundle-list-rewriting" name="bundle-list-rewriting">Bundle List Rewriting</a></h2> <p>The Maven Launchpad Plugin supports the use of rules to rewrite the bundle list. These rules are executed by the <a href="http://www.jboss.org/drools">Drools</a> rule engine. Typically, this is used along with Maven profiles. For example, Sling's testing project includes a profile called <code>test-reactor-sling-bundles</code>. When activated, this profile runs a Drools rule file which scans the project list from the Maven reactor and modifies the version number for bundles which were contained within the reactor.</p> <p>In order for rules to interact with the Maven build, the following global variables are made available:</p> <ul> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/maven-usage.html ---------------------------------------------------------------------- diff --git a/documentation/development/maven-usage.html b/documentation/development/maven-usage.html index 18c8b64..6a6463b 100644 --- a/documentation/development/maven-usage.html +++ b/documentation/development/maven-usage.html @@ -73,11 +73,10 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/documentation.html">Documentation</a> » <a href="/ng/documentation/development.html">Development</a> » </div> <h1> Maven Usage </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Apache Sling uses Maven as a build tool. This page documents some of the choices that we made when using Maven.</p> -<h2>Parent POM</h2> +<h2><a href="#parent-pom" name="parent-pom">Parent POM</a></h2> <p>We separate the reactor POM from the parent POM. While the reactor POM functions as a simple aggregator, the parent POM, currently located at <a href="http://svn.apache.org/repos/asf/sling/trunk/parent/pom.xml">parent/pom.xml</a>, holds the common build configuration for all modules.</p> <p>The reference to the parent POM is usually set to a released version since we don't deploy it as a SNAPSHOT during the build process. That reference must also contain an empty parentPath element, otherwise recent version of Maven will try to find it in the local filesystem, disregarding the version if the groupId and artifactId match. An example of how to reference the parent POM is</p> -<pre><code>#!xml -<parent> +<pre><code><!-- TODO syntax marker (#!xml) disabled --><parent> <groupId>org.apache.sling</groupId> <artifactId>sling</artifactId> <version>$VERSION</version> @@ -85,14 +84,14 @@ </parent> </code></pre> <p>Where <code>$VERSION</code> is replaced by the latest parent POM version.</p> -<h2>Java version</h2> +<h2><a href="#java-version" name="java-version">Java version</a></h2> <p>The version of Java targeted by a module can be declared by setting a property in the pom.xml named <code>sling.java.version</code>. Configuration inherited from the parent POM will ensure that all the plugins will be correctly configured, including</p> <ul> <li>maven-compiler-plugin: source and target arguments to use when compiling code</li> <li>animal-sniffer-maven-plugin: signatures to use when validating compliance with a given Java version</li> <li>maven-bundle-plugin: value of the Bundle-RequiredExecutionEnvironment header</li> </ul> -<h2>Dependency management</h2> +<h2><a href="#dependency-management" name="dependency-management">Dependency management</a></h2> <p>See <a href="/documentation/development/dependency-management.html">Dependency Management</a></p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/maventipsandtricks.html ---------------------------------------------------------------------- diff --git a/documentation/development/maventipsandtricks.html b/documentation/development/maventipsandtricks.html index bb4f1f8..0e78e45 100644 --- a/documentation/development/maventipsandtricks.html +++ b/documentation/development/maventipsandtricks.html @@ -73,13 +73,13 @@ <div class="breadcrumbs"><a href="/ng/">Home</a> » <a href="/ng/documentation.html">Documentation</a> » <a href="/ng/documentation/development.html">Development</a> » </div> <h1> MavenTipsAndTricks </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Here's our collection of tips and tricks for building Sling with <a href="http://maven.apache.org">Maven</a>.</p> -<h1>Maven local repository</h1> +<h1><a href="#maven-local-repository" name="maven-local-repository">Maven local repository</a></h1> <p>The first time you run a Maven build, or when Maven needs additional build components, it downloads plugins and dependencies under its <em>local repository</em> folder on your computer. By default, this folder is named <em>.m2/repository</em> in your home directory.</p> <p>Maven uses this repository as a cache for artifacts that it might need for future builds, which means that the first Sling build usually takes much longer than usual, as Maven needs to download many tools and dependencies into its local repository while the build progresses.</p> <p>The build might fail if one of those downloads fails, in that case it might be worth retrying the build, to check if that was just a temporary connection problem, or if there's a more serious error.</p> <p>In some cases, the local Maven repository might get corrupted - if your build fails on a computer and works on another one, clearing the local repository before restarting the build might be worth trying.</p> -<h1>Maven settings</h1> -<h2>Ignore your local settings</h2> +<h1><a href="#maven-settings" name="maven-settings">Maven settings</a></h1> +<h2><a href="#ignore-your-local-settings" name="ignore-your-local-settings">Ignore your local settings</a></h2> <p>To make sure you're getting the same results as we are when building Sling, it is recommend to ignore any local settings.</p> <p>On unixish platforms, using</p> <pre><code>mvn -s /dev/null ... @@ -91,17 +91,17 @@ Does anyone have a similar command-line option that works under Windows? <h1>MAVEN_OPTS</h1> <p>The MAVEN_OPTS environment variable defines options for the JVM that executes Maven.</p> <p>Set it according to your platform, i.e. <code>export MAVEN*OPTS=...</code> on unixish systems or <code>set MAVEN*OPTS=...</code> on Windows.</p> -<h2>Increase JVM memory if needed</h2> +<h2><a href="#increase-jvm-memory-if-needed" name="increase-jvm-memory-if-needed">Increase JVM memory if needed</a></h2> <p>If getting an OutOfMemoryException when running mvn, try setting</p> <pre><code>MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=256m" </code></pre> <p>to allocate 256MB of RAM to Maven.</p> -<h2>Debugging code launched by Maven</h2> +<h2><a href="#debugging-code-launched-by-maven" name="debugging-code-launched-by-maven">Debugging code launched by Maven</a></h2> <p>To run the Sling launchpad webapp in debug mode from Maven, for example, use something like</p> <pre><code>MAVEN_OPTS="-agentlib:jdwp=transport=dt_socket,address=30303,server=y,suspend=n" </code></pre> <p>And then connect to port 30303 with a remote JVM debugger (most IDEs do this).</p> -<h2>Avoid spaces in Maven repository and workspace paths</h2> +<h2><a href="#avoid-spaces-in-maven-repository-and-workspace-paths" name="avoid-spaces-in-maven-repository-and-workspace-paths">Avoid spaces in Maven repository and workspace paths</a></h2> <p>Some Maven plugins do not like spaces in paths. It is better to avoid putting your Maven repository, or your code, under paths like <em>Documents and Settings</em>, for example.</p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/osgi-mock.html ---------------------------------------------------------------------- diff --git a/documentation/development/osgi-mock.html b/documentation/development/osgi-mock.html index dd859cc..9bc710b 100644 --- a/documentation/development/osgi-mock.html +++ b/documentation/development/osgi-mock.html @@ -75,9 +75,8 @@ </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Mock implementation of selected OSGi APIs for easier testing.</p> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Maven Dependency</h2> -<pre><code>#!xml -<dependency> +<h2><a href="#maven-dependency" name="maven-dependency">Maven Dependency</a></h2> +<pre><code><!-- TODO syntax marker (#!xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.osgi-mock</artifactId> </dependency> @@ -88,7 +87,7 @@ <li>osgi-mock 1.x: compatible with OSGi R4 and above</li> <li>osgi-mock 2.x: compatible with OSGi R6 and above</li> </ul> -<h2>Implemented mock features</h2> +<h2><a href="#implemented-mock-features" name="implemented-mock-features">Implemented mock features</a></h2> <p>The mock implementation supports:</p> <ul> <li>Instantiating OSGi <code>Bundle</code>, <code>BundleContext</code> and <code>ComponentContext</code> objects and navigate between them.</li> @@ -107,12 +106,11 @@ <ul> <li>Support OSGi R6 and Declarative Services 1.3: Field-based reference bindings and component property types</li> </ul> -<h2>Usage</h2> -<h3>OSGi Context JUnit Rule</h3> +<h2><a href="#usage" name="usage">Usage</a></h2> +<h3><a href="#osgi-context-junit-rule" name="osgi-context-junit-rule">OSGi Context JUnit Rule</a></h3> <p>The OSGi mock context can be injected into a JUnit test using a custom JUnit rule named <code>OsgiContext</code>. This rules takes care of all initialization and cleanup tasks required to make sure all unit tests can run independently (and in parallel, if required).</p> <p>Example:</p> -<pre><code>#!java -public class ExampleTest { +<pre><code><!-- TODO syntax marker (#!java) disabled -->public class ExampleTest { @Rule public final OsgiContext context = new OsgiContext(); @@ -141,11 +139,10 @@ public class ExampleTest { <ul> <li>Registering and activating OSGi services and inject dependencies</li> </ul> -<h3>Getting OSGi mock objects</h3> +<h3><a href="#getting-osgi-mock-objects" name="getting-osgi-mock-objects">Getting OSGi mock objects</a></h3> <p>The factory class <code>MockOsgi</code> allows to instantiate the different mock implementations.</p> <p>Example:</p> -<pre><code>#!java -// get bundle context +<pre><code><!-- TODO syntax marker (#!java) disabled -->// get bundle context BundleContext bundleContext = MockOsgi.newBundleContext(); // get component context with configuration @@ -153,19 +150,17 @@ BundleContext bundleContext = MockOsgi.newComponentContext(properties, "prop1", "value1"); </code></pre> <p>It is possible to simulate registering of OSGi services (backed by a simple hash map internally):</p> -<pre><code>#!java -// register service +<pre><code><!-- TODO syntax marker (#!java) disabled -->// register service bundleContext.registerService(MyClass.class, myService, properties); // get service instance ServiceReference ref = bundleContext.getServiceReference(MyClass.class.getName()); MyClass service = bundleContext.getService(ref); </code></pre> -<h3>Activation and Dependency Injection</h3> +<h3><a href="#activation-and-dependency-injection" name="activation-and-dependency-injection">Activation and Dependency Injection</a></h3> <p>It is possible to simulate OSGi service activation, deactivation and dependency injection and the mock implementation tries to to its best to execute all as expected for an OSGi environment.</p> <p>Example:</p> -<pre><code>#!java -// get bundle context +<pre><code><!-- TODO syntax marker (#!java) disabled -->// get bundle context BundleContext bundleContext = MockOsgi.newBundleContext(); // create service instance manually @@ -187,24 +182,22 @@ MockOsgi.deactivate(service); <li>You should ensure that you register you services in the correct order of their dependency chain. Only dynamic references will be handled automatically independent of registration order.</li> <li>The injectServices, activate and deactivate Methods can only work properly when the SCR XML metadata files are preset in the classpath at <code>/OSGI-INF</code>. They are generated automatically by the Maven SCR plugin, but might be missing if your clean and build the project within your IDE (e.g. Eclipse). In this case you have to compile the project again with maven and can run the tests - or use a Maven IDE Integration like m2eclipse.</li> </ul> -<h3>Provide your own configuration via ConfigAdmin</h3> +<h3><a href="#provide-your-own-configuration-via-configadmin" name="provide-your-own-configuration-via-configadmin">Provide your own configuration via ConfigAdmin</a></h3> <p>If you want to provide your own configuration to an OSGi service that you do not register and activate itself in the mock context you can provide your own custom OSGi configuration via the mock implementation of the <code>ConfigAdmin</code> service.</p> <p>Example:</p> -<pre><code>#!java - +<pre><code><!-- TODO syntax marker (#!java) disabled --> ConfigurationAdmin configAdmin = context.getService(ConfigurationAdmin.class); Configuration myServiceConfig = configAdmin.getConfiguration(MY_SERVICE_PID); Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("prop1", "value1"); myServiceConfig.update(props); </code></pre> -<h3>Context Plugins</h3> +<h3><a href="#context-plugins" name="context-plugins">Context Plugins</a></h3> <p>OSGi Mocks supports "Context Plugins" that hook into the lifecycle of each test run and can prepare test setup before or after the other setUp actions, and execute test tear down code before or after the other tearDown action.</p> <p>To define a plugin implement the <code>org.apache.sling.testing.mock.osgi.context.ContextPlugin<OsgiContextImpl></code> interface. For convenience it is recommended to extend the abstract class <code>org.apache.sling.testing.mock.osgi.context.AbstractContextPlugin<OsgiContextImpl></code>. These plugins can be used with OSGi Mock context, but also with context instances deriving from it like Sling Mocks and AEM Mocks. In most cases you would just override the <code>afterSetUp</code> method. In this method you can register additional OSGi services or do other preparation work. It is recommended to define a constant pointing to a singleton of a plugin instance for using it.</p> <p>To use a plugin in your unit test class, use the <code>OsgiContextBuilder</code> class instead of directly instantiating the <code>OsgiContext</code>class. This allows you in a fluent style to configure more options, with the <code>plugin(...)</code> method you can add one or more plugins.</p> <p>Example: </p> -<pre><code>#!java -@Rule +<pre><code><!-- TODO syntax marker (#!java) disabled -->@Rule public OsgiContext context = new OsgiContextBuilder().plugin(MY_PLUGIN).build(); </code></pre> <p>More examples:</p> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/release-management.html ---------------------------------------------------------------------- diff --git a/documentation/development/release-management.html b/documentation/development/release-management.html index 2934a7b..348853c 100644 --- a/documentation/development/release-management.html +++ b/documentation/development/release-management.html @@ -76,7 +76,7 @@ <p>Most of the hard work of preparing and deploying the release is done by Maven.</p> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Prerequisites</h2> +<h2><a href="#prerequisites" name="prerequisites">Prerequisites</a></h2> <ul> <li>To prepare or perform a release you <em>MUST BE</em> at least be an Apache Sling Committer.</li> <li>Each and every release must be signed; therefore the public key should be cross signed by other Apache committers (not required but suggested) and this public key should be added to <a href="https://people.apache.org/keys/group/sling.asc">https://people.apache.org/keys/group/sling.asc</a> and either on pool.sks-keyservers.net or pgp.mit.edu (See Appendix A)</li> @@ -105,7 +105,7 @@ <version>6</version> </parent> </code></pre> -<h2>Staging the Release Candidates</h2> +<h2><a href="#staging-the-release-candidates" name="staging-the-release-candidates">Staging the Release Candidates</a></h2> <p>First prepare your POMs for release:</p> <ol> <li>Make sure there are no snapshots in the POMs to be released. In case you rely on a release version which is not yet promoted, you have to temporarily switch that dependency version to the release version. This might break the Jenkins CI build though, as the staged version is not yet visible to Jenkins, so revert this change after you have staged the release candidate.</li> @@ -161,7 +161,7 @@ $ mvn release:prepare </ul> </li> </ol> -<h2>Starting the Vote</h2> +<h2><a href="#starting-the-vote" name="starting-the-vote">Starting the Vote</a></h2> <p>Propose a vote on the dev list with the closed issues, the issues left, and the staging repository - for example:</p> <pre><code>To: "Sling Developers List" <[email protected]> Subject: [VOTE] Release Apache Sling ABC version X.Y.Z @@ -191,7 +191,7 @@ Please vote to approve this release: This majority vote is open for at least 72 hours. </code></pre> -<h2>Wait for the Results</h2> +<h2><a href="#wait-for-the-results" name="wait-for-the-results">Wait for the Results</a></h2> <p>From <a href="http://www.apache.org/foundation/voting.html">Votes on Package Releases</a>:</p> <blockquote> <p>Votes on whether a package is ready to be released follow a format similar to majority approval -- except that the decision is officially determined solely by whether at least three +1 votes were registered. Releases may not be vetoed. Generally the community will table the vote to release if anyone identifies serious problems, but in most cases the ultimate decision, once three or more positive votes have been garnered, lies with the individual serving as release manager. The specifics of the process may vary from project to project, but the 'minimum of three +1 votes' rule is universal.</p> @@ -214,7 +214,7 @@ promote the artifacts to the central Maven repository. <p>Be sure to include all votes in the list and indicate which votes were binding. Consider -1 votes very carefully. While there is technically no veto on release votes, there may be reasons for people to vote -1. So sometimes it may be better to cancel a release when someone, especially a member of the PMC, votes -1.</p> <p>If the vote is unsuccessful, you need to fix the issues and restart the process - see <em>Canceling the Release</em>. Note that any changes to the artifacts under vote require a restart of the process, no matter how trivial. When restarting a vote version numbers must not be reused, since binaries might have already been copied around.</p> <p>If the vote is successful, you need to promote and distribute the release - see <em>Promoting the Release</em>.</p> -<h2>Canceling the Release</h2> +<h2><a href="#canceling-the-release" name="canceling-the-release">Canceling the Release</a></h2> <p>If the vote fails, or you decide to redo the release:</p> <ol> <li>Remove the release tag from Subversion (<code>svn del ...</code>)</li> @@ -228,7 +228,7 @@ promote the artifacts to the central Maven repository. </li> <li>Commit any fixes you need to make and start a vote for a new release.</li> </ol> -<h2>Promoting the Release</h2> +<h2><a href="#promoting-the-release" name="promoting-the-release">Promoting the Release</a></h2> <p>If the vote passes:</p> <ol> <li>Push the release to <a href="https://dist.apache.org/repos/dist/release/sling/">https://dist.apache.org/repos/dist/release/sling/</a>. This is only possible for PMC members (for a reasoning look at <a href="http://www.apache.org/dev/release.html#upload-ci">http://www.apache.org/dev/release.html#upload-ci</a>). If you are not a PMC member, please ask one to do the upload for you. @@ -251,12 +251,12 @@ promote the artifacts to the central Maven repository. <li>Update the download page on the website at <a href="/downloads.cgi">downloads</a> to point to the new release.</li> </ol> <p>For the last two tasks, it's better to give the mirrors some time to distribute the uploaded artifacts (one day should be fine). This ensures that once the website (news and download page) is updated, people can actually download the artifacts.</p> -<h2>Update JIRA</h2> +<h2><a href="#update-jira" name="update-jira">Update JIRA</a></h2> <p>Go to <a href="https://issues.apache.org/jira/plugins/servlet/project-config/SLING/versions">Manage Versions</a> section on the SLING JIRA and mark the X.Y.Z version as released setting the release date to the date the vote has been closed.</p> <p>Also create a new version X.Y.Z+2, if that hasn't already been done.</p> <p>And keep the versions sorted, so when adding a new version moved it down to just above the previous versions.</p> <p>Close all issues associated with the released version.</p> -<h2>Create an Announcement</h2> +<h2><a href="#create-an-announcement" name="create-an-announcement">Create an Announcement</a></h2> <p>We usually do such announcements only for "important" releases, as opposed to small individual module releases which are just announced on our <a href="/news.html">news</a> page.</p> <pre><code>To: "Sling Developers List" <[email protected]>, "Apache Announcements" <[email protected]> Subject: [ANN] Apache Sling ABC version X.Y.Z Released @@ -289,12 +289,12 @@ Enjoy! -The Sling team </code></pre> <p><em>Important</em>: Add the release to the Software section of the next board report below <a href="https://cwiki.apache.org/confluence/display/SLING/Reports">Reports</a>.</p> -<h2>Related Links</h2> +<h2><a href="#related-links" name="related-links">Related Links</a></h2> <ol> <li><a href="http://www.apache.org/dev/release-signing.html">http://www.apache.org/dev/release-signing.html</a></li> <li><a href="http://wiki.apache.org/incubator/SigningReleases">http://wiki.apache.org/incubator/SigningReleases</a></li> </ol> -<h2>Releasing the Sling IDE Tooling</h2> +<h2><a href="#releasing-the-sling-ide-tooling" name="releasing-the-sling-ide-tooling">Releasing the Sling IDE Tooling</a></h2> <p>While the Sling IDE tooling is built using Maven, the toolchain that it is based around does not cooperate well with the maven-release-plugin. As such, the release preparation and execution are slightly different. The whole process is outlined below, assuming that we start with a development version of 1.0.1-SNAPSHOT.</p> <ol> <li>set the fix version as released: <code>mvn tycho-versions:set-version -DnewVersion=1.0.2</code></li> @@ -419,7 +419,7 @@ ssb 2048R/226BCE00 2016-01-21 </ol> </li> </ol> -<h2>Appendix B: Maven and SCM credentials</h2> +<h2><a href="#appendix-b-maven-and-scm-credentials" name="appendix-b-maven-and-scm-credentials">Appendix B: Maven and SCM credentials</a></h2> <p>For running the <code>mvn release:prepare</code> command without giving credentials on command line add <code>svn.apache.org</code> to your <code>settings.xml</code>:</p> <pre><code><server> <id>svn.apache.org</id> @@ -427,7 +427,7 @@ ssb 2048R/226BCE00 2016-01-21 <password>ENCRYPTED_PASSWORD</password> </server> </code></pre> -<h2>Appendix C: Deploy bundles on the Sling OBR (obsolete)</h2> +<h2><a href="#appendix-c-deploy-bundles-on-the-sling-obr-obsolete-" name="appendix-c-deploy-bundles-on-the-sling-obr-obsolete-">Appendix C: Deploy bundles on the Sling OBR (obsolete)</a></h2> <p><em>Update November 2016: We do now longer maintain the Sling OBR for new releases.</em></p> <p>We are mainting an OSGi Bundle Repository providing all release of the Sling Bundles. This repository is maintained as part of the Apache Sling site and is available at <a href="http://sling.apache.org/obr/sling.xml">http://sling.apache.org/obr/sling.xml</a>. The source for this page is maintained in the SVN repository below the <em>site</em>, that is at <a href="http://svn.apache.org/repos/asf/sling/site/">http://svn.apache.org/repos/asf/sling/site/</a>. To update the Sling OBR repository you must be an Apache Sling Committer since this requires SVN write access.</p> <p>To update the OBR you may use the Apache Felix Maven Bundle Plugin which prepares the bundle descriptor to be added to the OBR file. Follow these steps to update the OBR:</p> @@ -476,7 +476,7 @@ $ rm the_module-version.jar the_module-version.pom <p>Wait for the buildbot to update the staging area with your site update (see dev list for an email). Then go to the CMS at <a href="https://cms.apache.org/redirect?uri=http://sling.apache.org/obr">https://cms.apache.org/redirect?uri=http://sling.apache.org/obr</a> , update your checkout and then publish the site.</p> </li> </ol> -<h2>Appendix D: Deploy Maven plugin documentation (if applicable)</h2> +<h2><a href="#appendix-d-deploy-maven-plugin-documentation-if-applicable-" name="appendix-d-deploy-maven-plugin-documentation-if-applicable-">Appendix D: Deploy Maven plugin documentation (if applicable)</a></h2> <p>When releasing a Maven plugin, the Maven-generated documentation published under <a href="http://sling.apache.org/components/">http://sling.apache.org/components/</a> needs to be updated.</p> <p>This is currently supported for:</p> <ul> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/repository-based-development.html ---------------------------------------------------------------------- diff --git a/documentation/development/repository-based-development.html b/documentation/development/repository-based-development.html index 0a347b2..06b5c12 100644 --- a/documentation/development/repository-based-development.html +++ b/documentation/development/repository-based-development.html @@ -74,16 +74,16 @@ Repository Based Development </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h1>WebDAV Support</h1> +<h1><a href="#webdav-support" name="webdav-support">WebDAV Support</a></h1> <p>WebDAV support in Sling is based on the <a href="http://jackrabbit.apache.org/jcr/components/jackrabbit-jcr-server.html#Simple_Webdav_Server">Simple WebDAV</a> implementation of Apache Jackrabbit which is integrated in the <code>jcr/webdav</code> project. This bundle provides WebDAV access to Sling's repository in two flavours: </p> <ol> <li>Access to all workspaces of the repository on a separate URI space -- by default rooted at <code>/dav</code> in the Sling context -- and</li> <li>access to the workspace used by Sling itself at the root of the Sling context.</li> </ol> -<h2>Example</h2> +<h2><a href="#example" name="example">Example</a></h2> <p>Consider Sling be installed on a Servlet container in the <code>/sling</code> context on <code>some.host.net:8080</code>. Here you would access the Sling workspace by directing your WebDAV client to the URL <code>http://some.host.net:8080/sling</code>. To access the <code>sample</code> workspace, which is not used by Sling itself, you would direct your WebDAV client to the URL <code>http://some.host.net:8080/sling/dav/sample</code>.</p> <p>Please note that accessing the repository in the separate URI space is actually faster, since requests do not pass the Sling resource and script resolution framework but instead hit the Jackrabbit Simple WebDAV Servlet directly.</p> -<h2>Separate URI Space WebDAV</h2> +<h2><a href="#separate-uri-space-webdav" name="separate-uri-space-webdav">Separate URI Space WebDAV</a></h2> <p>When accessing the repository through WebDAV in its separate URI Space, the URLs have the following generic structure:</p> <pre><code><slingroot>/<prefix>/<workspace>/<item> </code></pre> @@ -94,7 +94,7 @@ <li><code>item</code> is the path to the JCR Item to access.</li> </ul> <p>If you access the WebDAV server at the prefix path -- e.g. <code>http://localhost:8080/dav</code> -- you will be redirected to the default workspace with a temporary redirect status 302. Some clients, such as the Linux <em>davfs</em>, do not like this redirection and must be configured to explicitly address the default workspace.</p> -<h2>Configuration</h2> +<h2><a href="#configuration" name="configuration">Configuration</a></h2> <p>The Jackrabbit Simple WebDAV support in Sling has the following configuration options:</p> <table> <thead> @@ -128,19 +128,19 @@ </tbody> </table> <p>Filter Node Types | -- | Nodetype names to be used to filter child nodes. A child node can be filtered if the declaring nodetype of its definition is one of the nodetype names specified in the nodetypes Element. E.g. defining rep:root as filtered nodetype would result in <code>jcr:system</code> being hidden but no other child node of the root node, since those are defined by the nodetype nt:unstructered. The default is empty. Do not modify this setting unless you know exactly what you are doing. Filter URIs | -- | A list of namespace URIs indicating JCR items filtered from being reported as collection members or properties. The default list is empty. Do not modify this setting unless you know exactly what you are doing. Collection Primary Type | <code>sling:Folder</code> | The JCR Primary Node Type to assign to nodes created to reflect WebDAV collections. You may name any primary node type here, provided it allows the creation of nodex of this type and the defined Non-Collection Primary Type below it. Non-Collection Primary Type | <code>nt:file</code> | The JCR Primary Node Type to assign to nodes created to reflect WebDAV non-collection resources. You may name any primary node type here, provided the node type is allowed to be created below nodes of the type defined for the Collection Primary Type and that a child node with the name <code>jcr:content</code> may be created below the non-collection resource whose type is defined by the Content Primary Type. Content Primary Type | <code>nt:resource</code> | The JCR Primary Node Type to assign to the jcr:content child node of a WebDAV non-collection resource. You may name any primary node type here, provided the node type is allowed to be created as the jcr:content child node of the node type defined by the Non-Collection Primary Type. In addition the node type must allow at least the following properties: jcr:data (binary), jcr:lastModified (date), and jcr:mimeType (string).</p> -<h2>Advanced Technical Details</h2> +<h2><a href="#advanced-technical-details" name="advanced-technical-details">Advanced Technical Details</a></h2> <p>Since the Jackrabbit Simple WebDAV Servlet is originally configured using an XML configuration file, which provides a great deal of flexibility, the integration into Sling had to assume some simplifications, of which some of the above parameters are part:</p> -<h3>IOManager</h3> +<h3><a href="#iomanager" name="iomanager">IOManager</a></h3> <p>This implementation uses the standard <code>org.apache.jackrabbit.server.io.IOManagerImpl</code> class and adds the <code>org.apache.jackrabbit.server.io.DirListingExportHandler</code> and <code>org.apache.jackrabbit.server.io.DefaultHandler</code> IO handlers as its only handlers. The <code>DefaultHandler</code> is configured from the three node types listed as configuration parameters above (collection, non-collection, and content primary node types).</p> -<h3>PropertyManager</h3> +<h3><a href="#propertymanager" name="propertymanager">PropertyManager</a></h3> <p>This implementation uses the standard <code>org.apache.jackrabbit.server.io.PropertyManagerImpl</code> and adds the same <code>DirListingExportHandler</code> and <code>DefaultHanlder</code> instances as its own handlers as are used by the IO Manager.</p> -<h3>ItemFilter</h3> +<h3><a href="#itemfilter" name="itemfilter">ItemFilter</a></h3> <p>This implementation uses the standard <code>org.apache.jackrabbit.webdav.simple.DefaultItemFilter</code> implementation as its item filter and configures the filter with the namespace prefixes and URIs as well as the node types configured as parameters.</p> -<h3>Collection Node Types</h3> +<h3><a href="#collection-node-types" name="collection-node-types">Collection Node Types</a></h3> <p>This implementation only supports listing node types which are considered representing non-collection resources. All nodes which are instances of any of the configured node types are considered non-collection resources. All other nodes are considere collection resources.</p> -<h1>DavEx Support</h1> +<h1><a href="#davex-support" name="davex-support">DavEx Support</a></h1> <p><a href="https://wiki.apache.org/jackrabbit/RemoteAccess">DavEx</a> (WebDAV with JCR Extensions) allows to remotely access a JCR repository. Sling provides support based on the <a href="http://jackrabbit.apache.org/jcr/components/jackrabbit-jcr-server.html#JCR_Webdav_Server">JCR WebDAV Server</a> implementation of Apache Jackrabbit which is integrated in the <code>jcr/davex</code> project. By default the server listens on request urls starting with <code>/server</code>.</p> -<h1>Eclipse plugin for JCR</h1> +<h1><a href="#eclipse-plugin-for-jcr" name="eclipse-plugin-for-jcr">Eclipse plugin for JCR</a></h1> <p>see <a href="/documentation/development/ide-tooling.html">Sling IDE Tooling</a></p></section></div></div> <div class="footer"> <div class="trademarkFooter"> http://git-wip-us.apache.org/repos/asf/sling-site/blob/f542b22e/documentation/development/resourceresolver-mock.html ---------------------------------------------------------------------- diff --git a/documentation/development/resourceresolver-mock.html b/documentation/development/resourceresolver-mock.html index 4614a8f..ca5bca0 100644 --- a/documentation/development/resourceresolver-mock.html +++ b/documentation/development/resourceresolver-mock.html @@ -75,15 +75,14 @@ </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>Mock for the resource resolver / factory for easier testing. It uses an in-memory map for storing the resource data, and supports reading, writing and a certain level of transaction and eventing support.</p> <p><!-- TODO reactivate TOC once JBake moves to flexmark-java --> </p> -<h2>Maven Dependency</h2> -<pre><code>#!xml -<dependency> +<h2><a href="#maven-dependency" name="maven-dependency">Maven Dependency</a></h2> +<pre><code><!-- TODO syntax marker (#!xml) disabled --><dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.resourceresolver-mock</artifactId> </dependency> </code></pre> <p>See latest version on the <a href="/downloads.cgi">downloads page</a>.</p> -<h2>Implemented mock features</h2> +<h2><a href="#implemented-mock-features" name="implemented-mock-features">Implemented mock features</a></h2> <p>The mock implementation supports:</p> <ul> <li>All read and write operations of the Sling Resource API</li> @@ -98,10 +97,9 @@ <li>Sling Mapping is not supported</li> <li>Resolving resource super types</li> </ul> -<h2>Usage</h2> +<h2><a href="#usage" name="usage">Usage</a></h2> <p>To create a mocked resource resolver:</p> -<pre><code>#!java -MockResourceResolverFactory factory = new MockResourceResolverFactory(); +<pre><code><!-- TODO syntax marker (#!java) disabled -->MockResourceResolverFactory factory = new MockResourceResolverFactory(); ResourceResolver resolver = factory.getResourceResolver(null); </code></pre> <p>With the resolver you can use all Sling Resource features including reading and writing data using the Sling API.</p>
