svn commit: r1644350 - in /sling/trunk/contrib/extensions/distribution: api/src/main/java/org/apache/sling/distribution/queue/ core/src/main/java/org/apache/sling/distribution/monitor/ core/src/main/j
Author: tommaso Date: Wed Dec 10 08:41:42 2014 New Revision: 1644350 URL: http://svn.apache.org/r1644350 Log: SLING-4153 - improved queue's javadoc Modified: sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/monitor/DistributionQueueHealthCheck.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/queue/impl/ErrorAwareQueueDispatchingStrategy.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/queue/impl/PriorityPathQueueDispatchingStrategy.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/queue/impl/SingleQueueDispatchingStrategy.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/queue/impl/jobhandling/JobHandlingDistributionQueue.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/queue/impl/simple/SimpleDistributionQueue.java sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/servlet/DistributionAgentQueueServlet.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/monitor/DistributionQueueHealthCheckTest.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/queue/impl/ErrorAwareQueueDistributionStrategyTest.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/queue/impl/PriorityPathQueueDistributionStrategyTest.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/queue/impl/SingleQueueDistributionStrategyTest.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/queue/impl/jobhandling/JobHandlingDistributionQueueTest.java sling/trunk/contrib/extensions/distribution/core/src/test/java/org/apache/sling/distribution/queue/impl/simple/SimpleDistributionQueueTest.java Modified: sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java?rev=1644350r1=1644349r2=1644350view=diff == --- sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java (original) +++ sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/queue/DistributionQueue.java Wed Dec 10 08:41:42 2014 @@ -22,11 +22,17 @@ import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import aQute.bnd.annotation.ConsumerType; import aQute.bnd.annotation.ProviderType; /** - * a queue for handling {@link org.apache.sling.distribution.agent.DistributionAgent}s' requests + * A queue is responsible for collecting the {@link org.apache.sling.distribution.packaging.DistributionPackage}s + * exported by a {@link org.apache.sling.distribution.agent.DistributionAgent} in + * order to be able to process them also when there are multiple (concurrent) + * {@link org.apache.sling.distribution.communication.DistributionRequest}s executed + * on that same agent. + * p/ + * The items (packages) in the queue can then get processed according to a FIFO + * strategy or in parallel, or some other way, via {@link org.apache.sling.distribution.queue.DistributionQueueProcessor}s. */ @ProviderType public interface DistributionQueue { @@ -42,25 +48,26 @@ public interface DistributionQueue { /** * add a distribution item to this queue * - * @param item a distribution item representing the package to distribute + * @param item a distribution item representing a {@link org.apache.sling.distribution.packaging.DistributionPackage} + * to distribute * @return {@code true} if the distribution item was added correctly to the queue, * {@code false} otherwise */ boolean add(@Nonnull DistributionQueueItem item); /** - * get the status of a certain item in the queue + * get the state of a certain item in the queue * * @param item the distribution item to get the status for * @return the item status in the queue * @throws DistributionQueueException if any error occurs while getting the status */ @Nonnull -DistributionQueueItemState getStatus(@Nonnull DistributionQueueItem item) +DistributionQueueItemState getState(@Nonnull DistributionQueueItem item) throws
svn commit: r1644369 - /sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java
Author: fmeschbe Date: Wed Dec 10 10:41:53 2014 New Revision: 1644369 URL: http://svn.apache.org/r1644369 Log: SLING-4232 Don't try to access a name which obviously cannot be a Java Class name. (Applying patch by Radu Cotescu; Thanks a lot) Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java Modified: sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java?rev=1644369r1=1644368r2=1644369view=diff == --- sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java (original) +++ sling/trunk/contrib/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/PojoUseProvider.java Wed Dec 10 10:41:53 2014 @@ -19,6 +19,8 @@ package org.apache.sling.scripting.sightly.impl.engine.extension.use; +import java.util.regex.Pattern; + import javax.script.Bindings; import org.apache.felix.scr.annotations.Component; @@ -64,11 +66,18 @@ public class PojoUseProvider implements private final Logger LOG = LoggerFactory.getLogger(PojoUseProvider.class); +private static final Pattern javaPattern = Pattern.compile(([[\\p{L}[^\\p{Lu}]]_$][\\p{L}\\p{N}_$]*\\.)*[\\p{Lu}_$][\\p{L}\\p{N}_$]*); + @Reference private SightlyJavaCompilerService sightlyJavaCompilerService = null; @Override public ProviderOutcome provide(String identifier, RenderContext renderContext, Bindings arguments) { +if (!javaPattern.matcher(identifier).matches()) { +LOG.debug(Identifier {} does not match a Java class name pattern., identifier); +return ProviderOutcome.failure(); +} + Bindings globalBindings = renderContext.getBindings(); Bindings bindings = UseProviderUtils.merge(globalBindings, arguments); SlingScriptHelper sling = UseProviderUtils.getHelper(bindings);
svn commit: r1644385 - in /sling/site/trunk/content/documentation/bundles: models.mdtext validation.mdtext
Author: kwin Date: Wed Dec 10 12:42:57 2014 New Revision: 1644385 URL: http://svn.apache.org/r1644385 Log: SLING-3709 - document ModelFactory SLING-4161 - extend documentation around validation Modified: sling/site/trunk/content/documentation/bundles/models.mdtext sling/site/trunk/content/documentation/bundles/validation.mdtext Modified: sling/site/trunk/content/documentation/bundles/models.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/models.mdtext?rev=1644385r1=1644384r2=1644385view=diff == --- sling/site/trunk/content/documentation/bundles/models.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/models.mdtext Wed Dec 10 12:42:57 2014 @@ -67,6 +67,7 @@ can be listed in a comma-separated list /Sling-Model-Packages # Client Code +## adaptTo() Client code doesn't need to be aware that Sling Models is being used. It just uses the Sling Adapter framework: @@ -84,6 +85,20 @@ Or ${sling:adaptTo(resource, 'org.apache.sling.models.it.models.MyModel')} As with other AdapterFactories, if the adaptation can't be made for any reason, `adaptTo()` returns null. +## ModelFactory (since 1.2.0) + +Since Sling Models 1.2.0 ([SLING-3709](https://issues.apache.org/jira/browse/SLING-3709)) there is another way of instanciating models. The OSGi service `ModelFactory` provides a method for instanciating a model that throws exceptions in case the model cannot be instanciated. That way `null` checks are not necessary. + +::java + try { +MyModel model = modelFactory.createModel(resource, MyModel.class); +} catch (Exception e) { +// give out error message that the model could not be instanciated. +// The exception contains further information. +// See the javadoc of the ModelFactory for which Exception can be expected here +} + +In addition `ModelFactory` provides methods for checking whether a given class is a model at all (having the model annotation) or whether a class can be adapted from a given adaptable. # Other Options ## Names @@ -294,6 +309,20 @@ Constructor injection is supported for t private String propertyName; } +## a name=validation/aSling Validation (since 1.2.0) +*See also [SLING-4161](https://issues.apache.org/jira/browse/SLING-4161)* + +You can use the attribute `validation` on the Model annotation to enable validation of the resource being used by the Sling model through [Sling Validation]({{ refs.validation.path }}). That field supports three different values: + + Value | Description | Invalid validation model | No validation model found | Resource invalid according to model + - | --- | - | -| - + `DISABLED` (default) | don't validate the resource bound to the Model | Model instanciated | Model instanciated | Model instanciated + `REQUIRED` | enforce validation of the resource bound to the Model | Model not instanciated | Model not instanciated | Model not instanciated + `OPTIONAL` | validate the resource bound to the Model (if a validation model is found) | Model not instanciated | Model instanciated | Model not instanciated + +In case the model is not instanciated an appropriate error message is logged (if the model is instanciated through the `adaptTo()` method or an appropriate exception is thrown if the model is instanciated through `ModelFactory.createModel()`). +Validation is only supported on models which are adapted from a `Resource` and if the Sling Validation Bundle is deployed. + # Custom Injectors To create a custom injector, simply implement the `org.apache.sling.models.spi.Injector` interface and register your implementation with the OSGi service registry. Please refer to the standard injectors in [Subversion](http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/) for examples. @@ -344,7 +373,7 @@ Sling Object | `sling-object` # Injector-specific Annotations (Since Sling Models Impl 1.0.6) -See also [SLING-3499](https://issues.apache.org/jira/browse/SLING-3499) +*See also [SLING-3499](https://issues.apache.org/jira/browse/SLING-3499)* Sometimes it is desirable to use customized annotations which aggregate the standard annotations described above. This will generally have the following advantages over using the standard annotations: Modified: sling/site/trunk/content/documentation/bundles/validation.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/validation.mdtext?rev=1644385r1=1644384r2=1644385view=diff == --- sling/site/trunk/content/documentation/bundles/validation.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/validation.mdtext Wed Dec 10
svn commit: r932172 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html documentation/bundles/validation.html
Author: buildbot Date: Wed Dec 10 12:43:15 2014 New Revision: 932172 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/models.html websites/staging/sling/trunk/content/documentation/bundles/validation.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Dec 10 12:43:15 2014 @@ -1 +1 @@ -1644098 +1644385 Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html == --- websites/staging/sling/trunk/content/documentation/bundles/models.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/models.html Wed Dec 10 12:43:15 2014 @@ -94,7 +94,11 @@ ul lia href=#design-goalsDesign Goals/a/li lia href=#basic-usageBasic Usage/a/li -lia href=#client-codeClient Code/a/li +lia href=#client-codeClient Code/aul +lia href=#adapttoadaptTo()/a/li +lia href=#modelfactory-since-120ModelFactory (since 1.2.0)/a/li +/ul +/li lia href=#other-optionsOther Options/aul lia href=#namesNames/a/li lia href=#optional-and-requiredOptional and Required/a/li @@ -105,6 +109,7 @@ lia href=#viaVia/a/li lia href=#sourceSource/a/li lia href=#adaptationsAdaptations/a/li +lia href=#wzxhzdk25wzxhzdk26sling-validation-since-120a name=validation/aSling Validation (since 1.2.0)/a/li /ul /li lia href=#custom-injectorsCustom Injectors/a/li @@ -182,6 +187,7 @@ can be listed in a comma-separated list h1 id=client-codeClient Code/h1 +h2 id=adapttoadaptTo()/h2 pClient code doesn't need to be aware that Sling Models is being used. It just uses the Sling Adapter framework:/p div class=codehiliteprespan class=nMyModel/span span class=nmodel/span span class=o=/span span class=nresource/spanspan class=o./spanspan class=naadaptTo/spanspan class=o(/spanspan class=nMyModel/spanspan class=o./spanspan class=naclass/spanspan class=o)/span /pre/div @@ -198,6 +204,19 @@ can be listed in a comma-separated list pAs with other AdapterFactories, if the adaptation can't be made for any reason, codeadaptTo()/code returns null./p +h2 id=modelfactory-since-120ModelFactory (since 1.2.0)/h2 +pSince Sling Models 1.2.0 (a href=https://issues.apache.org/jira/browse/SLING-3709;SLING-3709/a) there is another way of instanciating models. The OSGi service codeModelFactory/code provides a method for instanciating a model that throws exceptions in case the model cannot be instanciated. That way codenull/code checks are not necessary./p +div class=codehiliteprespan class=ktry/span span class=o{/span +span class=nMyModel/span span class=nmodel/span span class=o=/span span class=nmodelFactory/spanspan class=o./spanspan class=nacreateModel/spanspan class=o(/spanspan class=nresource/spanspan class=o,/span span class=nMyModel/spanspan class=o./spanspan class=naclass/spanspan class=o);/span +span class=o}/span span class=kcatch/span span class=o(/spanspan class=nException/span span class=ne/spanspan class=o)/span span class=o{/span +span class=c1// give out error message that the model could not be instanciated. /span +span class=c1// The exception contains further information. /span +span class=c1// See the javadoc of the ModelFactory for which Exception can be expected here/span +span class=o}/span +/pre/div + + +pIn addition codeModelFactory/code provides methods for checking whether a given class is a model at all (having the model annotation) or whether a class can be adapted from a given adaptable./p h1 id=other-optionsOther Options/h1 h2 id=namesNames/h2 pIf the field or method name doesn't exactly match the property name, code@Named/code can be used:/p @@ -399,6 +418,45 @@ strategy by using adding codedefaultIn /pre/div +h2 id=wzxhzdk25wzxhzdk26sling-validation-since-120a name=validation/aSling Validation (since 1.2.0)/h2 +pemSee also a href=https://issues.apache.org/jira/browse/SLING-4161;SLING-4161/a/em/p +pYou can use the attribute codevalidation/code on the Model annotation to enable validation of the resource being used by the Sling model through a href=/documentation/bundles/validation.htmlSling Validation/a. That field supports three different values:/p +table +thead +tr +thValue/th +thDescription/th +thInvalid validation model/th +thNo validation model found/th +thResource invalid according to model/th +/tr +/thead +tbody +tr +tdcodeDISABLED/code (default)/td +tddon't validate the resource bound to the Model/td +tdModel instanciated/td +tdModel instanciated/td +tdModel instanciated/td +/tr +tr +tdcodeREQUIRED/code/td +tdenforce validation of the resource bound to the Model/td +tdModel not instanciated/td +tdModel not instanciated/td +tdModel not instanciated/td +/tr +tr +tdcodeOPTIONAL/code/td +tdvalidate
svn commit: r932173 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html
Author: buildbot Date: Wed Dec 10 13:02:32 2014 New Revision: 932173 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/models.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Dec 10 13:02:32 2014 @@ -1 +1 @@ -1644385 +1644388 Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html == --- websites/staging/sling/trunk/content/documentation/bundles/models.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/models.html Wed Dec 10 13:02:32 2014 @@ -109,7 +109,7 @@ lia href=#viaVia/a/li lia href=#sourceSource/a/li lia href=#adaptationsAdaptations/a/li -lia href=#wzxhzdk25wzxhzdk26sling-validation-since-120a name=validation/aSling Validation (since 1.2.0)/a/li +lia href=#sling-validation-since-120Sling Validation (since 1.2.0)/a/li /ul /li lia href=#custom-injectorsCustom Injectors/a/li @@ -418,8 +418,8 @@ strategy by using adding codedefaultIn /pre/div -h2 id=wzxhzdk25wzxhzdk26sling-validation-since-120a name=validation/aSling Validation (since 1.2.0)/h2 -pemSee also a href=https://issues.apache.org/jira/browse/SLING-4161;SLING-4161/a/em/p +h2 id=sling-validation-since-120Sling Validation (since 1.2.0)/h2 +pa name=validationemSee also a href=https://issues.apache.org/jira/browse/SLING-4161;SLING-4161/a/em/a/p pYou can use the attribute codevalidation/code on the Model annotation to enable validation of the resource being used by the Sling model through a href=/documentation/bundles/validation.htmlSling Validation/a. That field supports three different values:/p table thead @@ -678,7 +678,7 @@ SPI interface which could use context to content path context. If multiple implementations of the codeImplementationPicker/code interface are present, they are queried one after another in order of their service ranking property, the first one that picks an implementation wins./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1644385 by kwin on Wed, 10 Dec 2014 12:42:57 + +Rev. 1644388 by kwin on Wed, 10 Dec 2014 13:02:24 + /div div class=trademarkFooter Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
svn commit: r1644388 - /sling/site/trunk/content/documentation/bundles/models.mdtext
Author: kwin Date: Wed Dec 10 13:02:24 2014 New Revision: 1644388 URL: http://svn.apache.org/r1644388 Log: fix anchor Modified: sling/site/trunk/content/documentation/bundles/models.mdtext Modified: sling/site/trunk/content/documentation/bundles/models.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/models.mdtext?rev=1644388r1=1644387r2=1644388view=diff == --- sling/site/trunk/content/documentation/bundles/models.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/models.mdtext Wed Dec 10 13:02:24 2014 @@ -309,8 +309,8 @@ Constructor injection is supported for t private String propertyName; } -## a name=validation/aSling Validation (since 1.2.0) -*See also [SLING-4161](https://issues.apache.org/jira/browse/SLING-4161)* +## Sling Validation (since 1.2.0) +a name=validation*See also [SLING-4161](https://issues.apache.org/jira/browse/SLING-4161)*/a You can use the attribute `validation` on the Model annotation to enable validation of the resource being used by the Sling model through [Sling Validation]({{ refs.validation.path }}). That field supports three different values:
svn commit: r932176 - /websites/production/sling/content/
Author: kwin Date: Wed Dec 10 13:20:56 2014 New Revision: 932176 Log: Publishing svnmucc operation to sling site by kwin Added: websites/production/sling/content/ - copied from r932175, websites/staging/sling/trunk/content/
svn commit: r932209 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html
Author: buildbot Date: Wed Dec 10 16:44:33 2014 New Revision: 932209 Log: Staging update by buildbot for sling Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/models.html Propchange: websites/staging/sling/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Dec 10 16:44:33 2014 @@ -1 +1 @@ -1644388 +1644472 Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html == --- websites/staging/sling/trunk/content/documentation/bundles/models.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/models.html Wed Dec 10 16:44:33 2014 @@ -205,11 +205,11 @@ can be listed in a comma-separated list pAs with other AdapterFactories, if the adaptation can't be made for any reason, codeadaptTo()/code returns null./p h2 id=modelfactory-since-120ModelFactory (since 1.2.0)/h2 -pSince Sling Models 1.2.0 (a href=https://issues.apache.org/jira/browse/SLING-3709;SLING-3709/a) there is another way of instanciating models. The OSGi service codeModelFactory/code provides a method for instanciating a model that throws exceptions in case the model cannot be instanciated. That way codenull/code checks are not necessary./p +pSince Sling Models 1.2.0 (a href=https://issues.apache.org/jira/browse/SLING-3709;SLING-3709/a) there is another way of instantiating models. The OSGi service codeModelFactory/code provides a method for instantiating a model that throws exceptions this is not possible. That way codenull/code checks are not necessary./p div class=codehiliteprespan class=ktry/span span class=o{/span span class=nMyModel/span span class=nmodel/span span class=o=/span span class=nmodelFactory/spanspan class=o./spanspan class=nacreateModel/spanspan class=o(/spanspan class=nresource/spanspan class=o,/span span class=nMyModel/spanspan class=o./spanspan class=naclass/spanspan class=o);/span span class=o}/span span class=kcatch/span span class=o(/spanspan class=nException/span span class=ne/spanspan class=o)/span span class=o{/span -span class=c1// give out error message that the model could not be instanciated. /span +span class=c1// give out error message that the model could not be instantiated. /span span class=c1// The exception contains further information. /span span class=c1// See the javadoc of the ModelFactory for which Exception can be expected here/span span class=o}/span @@ -435,27 +435,27 @@ strategy by using adding codedefaultIn tr tdcodeDISABLED/code (default)/td tddon't validate the resource bound to the Model/td -tdModel instanciated/td -tdModel instanciated/td -tdModel instanciated/td +tdModel instantiated/td +tdModel instantiated/td +tdModel instantiated/td /tr tr tdcodeREQUIRED/code/td tdenforce validation of the resource bound to the Model/td -tdModel not instanciated/td -tdModel not instanciated/td -tdModel not instanciated/td +tdModel not instantiated/td +tdModel not instantiated/td +tdModel not instantiated/td /tr tr tdcodeOPTIONAL/code/td tdvalidate the resource bound to the Model (if a validation model is found)/td -tdModel not instanciated/td -tdModel instanciated/td -tdModel not instanciated/td +tdModel not instantiated/td +tdModel instantiated/td +tdModel not instantiated/td /tr /tbody /table -pIn case the model is not instanciated an appropriate error message is logged (if the model is instanciated through the codeadaptTo()/code method or an appropriate exception is thrown if the model is instanciated through codeModelFactory.createModel()/code). +pIn case the model is not instantiated an appropriate error message is logged (if codeadaptTo()/code is used) or an appropriate exception is thrown (if codeModelFactory.createModel()/code is used). Validation is only supported on models which are adapted from a codeResource/code and if the Sling Validation Bundle is deployed./p h1 id=custom-injectorsCustom Injectors/h1 pTo create a custom injector, simply implement the codeorg.apache.sling.models.spi.Injector/code interface and register your implementation with the OSGi service registry. Please refer to the standard injectors in a href=http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/;Subversion/a for examples./p @@ -678,7 +678,7 @@ SPI interface which could use context to content path context. If multiple implementations of the codeImplementationPicker/code interface are present, they are queried one after another in order of their service ranking property, the first one that picks an implementation wins./p div class=timestamp style=margin-top: 30px; font-size: 80%; text-align: right; -Rev. 1644388 by kwin on Wed, 10 Dec 2014
svn commit: r1644472 - /sling/site/trunk/content/documentation/bundles/models.mdtext
Author: kwin Date: Wed Dec 10 16:44:21 2014 New Revision: 1644472 URL: http://svn.apache.org/r1644472 Log: fix typos Modified: sling/site/trunk/content/documentation/bundles/models.mdtext Modified: sling/site/trunk/content/documentation/bundles/models.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/models.mdtext?rev=1644472r1=1644471r2=1644472view=diff == --- sling/site/trunk/content/documentation/bundles/models.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/models.mdtext Wed Dec 10 16:44:21 2014 @@ -87,13 +87,13 @@ Or As with other AdapterFactories, if the adaptation can't be made for any reason, `adaptTo()` returns null. ## ModelFactory (since 1.2.0) -Since Sling Models 1.2.0 ([SLING-3709](https://issues.apache.org/jira/browse/SLING-3709)) there is another way of instanciating models. The OSGi service `ModelFactory` provides a method for instanciating a model that throws exceptions in case the model cannot be instanciated. That way `null` checks are not necessary. +Since Sling Models 1.2.0 ([SLING-3709](https://issues.apache.org/jira/browse/SLING-3709)) there is another way of instantiating models. The OSGi service `ModelFactory` provides a method for instantiating a model that throws exceptions this is not possible. That way `null` checks are not necessary. ::java try { MyModel model = modelFactory.createModel(resource, MyModel.class); } catch (Exception e) { -// give out error message that the model could not be instanciated. +// give out error message that the model could not be instantiated. // The exception contains further information. // See the javadoc of the ModelFactory for which Exception can be expected here } @@ -316,11 +316,11 @@ You can use the attribute `validation` o Value | Description | Invalid validation model | No validation model found | Resource invalid according to model - | --- | - | -| - - `DISABLED` (default) | don't validate the resource bound to the Model | Model instanciated | Model instanciated | Model instanciated - `REQUIRED` | enforce validation of the resource bound to the Model | Model not instanciated | Model not instanciated | Model not instanciated - `OPTIONAL` | validate the resource bound to the Model (if a validation model is found) | Model not instanciated | Model instanciated | Model not instanciated + `DISABLED` (default) | don't validate the resource bound to the Model | Model instantiated | Model instantiated | Model instantiated + `REQUIRED` | enforce validation of the resource bound to the Model | Model not instantiated | Model not instantiated | Model not instantiated + `OPTIONAL` | validate the resource bound to the Model (if a validation model is found) | Model not instantiated | Model instantiated | Model not instantiated -In case the model is not instanciated an appropriate error message is logged (if the model is instanciated through the `adaptTo()` method or an appropriate exception is thrown if the model is instanciated through `ModelFactory.createModel()`). +In case the model is not instantiated an appropriate error message is logged (if `adaptTo()` is used) or an appropriate exception is thrown (if `ModelFactory.createModel()` is used). Validation is only supported on models which are adapted from a `Resource` and if the Sling Validation Bundle is deployed. # Custom Injectors
svn commit: r932210 - /websites/production/sling/content/
Author: kwin Date: Wed Dec 10 16:44:56 2014 New Revision: 932210 Log: Publishing svnmucc operation to sling site by kwin Added: websites/production/sling/content/ - copied from r932209, websites/staging/sling/trunk/content/