You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2015/07/29 09:30:32 UTC
svn commit: r1693193 - /sling/trunk/bundles/extensions/validation/README.md
Author: kwin
Date: Wed Jul 29 07:30:32 2015
New Revision: 1693193
URL: http://svn.apache.org/r1693193
Log:
cleanup readme
Modified:
sling/trunk/bundles/extensions/validation/README.md
Modified: sling/trunk/bundles/extensions/validation/README.md
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/README.md?rev=1693193&r1=1693192&r2=1693193&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/README.md (original)
+++ sling/trunk/bundles/extensions/validation/README.md Wed Jul 29 07:30:32 2015
@@ -1,90 +1,7 @@
-# Apache Sling Validation Framework Prototype
-This prototype proposes a new validation framework API for Apache Sling and also provides a default implementation, together with a testing
-services bundle.
+# Apache Sling Validation
+Look at the [Sling Wiki](http://sling.apache.org/documentation/bundles/validation.html) for documentation.
-The core service of the validation framework is represented by the `ValidationService` interface, which provides the following methods:
-```java
-/**
- * Tries to obtain a {@link ValidationModel} that is able to validate a {@code Resource} of type {@code validatedResourceType}.
- *
- * @param validatedResourceType the type of {@code Resources} the model validates
- * @param applicablePath the model's applicable path (the path of the validated resource)
- * @return a {@code ValidationModel} if one is found, {@code null} otherwise
- */
- ValidationModel getValidationModel(String validatedResourceType, String applicablePath);
-
- /**
- * Tries to obtain a {@link ValidationModel} that is able to validate the given {@code resource}.
- *
- * @param resource the resource for which to obtain a validation model
- * @return a {@code ValidationModel} if one is found, {@code null} otherwise
- */
- ValidationModel getValidationModel(Resource resource);
-
- /**
- * Validates a {@link Resource} using a specific {@link ValidationModel}. If the {@code model} describes a resource tree,
- * the {@link ResourceResolver} associated with the {@code resource} will be used for retrieving information about the {@code
- * resource}'s descendants.
- *
- * @param resource the resource to validate
- * @param model the model with which to perform the validation
- * @return a {@link ValidationResult} that provides the necessary information
- */
- ValidationResult validate(Resource resource, ValidationModel model);
-
- /**
- * Validates a {@link ValueMap} or any object adaptable to a {@code ValueMap} using a specific {@link ValidationModel}. Since the
- * {@code valueMap} only contains the direct properties of the adapted object, the {@code model}'s descendants description should not
- * be queried for this validation operation.
- *
- * @param valueMap the map to validate
- * @return a {@link ValidationResult} that provides the necessary information
- */
- ValidationResult validate(ValueMap valueMap, ValidationModel model);
-```
-
-The prototype allows validating resource trees or any other object that is adaptable to a `ValueMap`. For example a `SlingHttpServletRequest` can be validated in the default implementation with the help of an `AdapterFactory` that extracts the request's parameters into a `ValueMap`.
-
-The default implementation is also able to automatically create `ValidationModel` objects from JCR content structures of the following form:
-<pre>
-validationModel
- @validatedResourceType
- @applicablePaths = [path1,path2,...] (optional)
- @sling:resourceType = sling/validation/model
- properties
- property1
- @propertyType = <string value>
- @propertyMultiple = <boolean value> (optional)
- validators
- validator1
- @validatorArguments = [key=value,key=value...] (optional)
- validatorN
- @validatorArguments = [key=value,key=value...] (optional)
- propertyN
- @propertyType = <string value>
- @propertyMultiple = <boolean value> (optional)
- validators
- validator1
- @validatorArguments = [key=value,key=value...] (optional)
- children
- child1
- properties
- property1
- @propertyType = <string value>
- @propertyMultiple = <boolean value> (optional)
- validators
- validator1
- @validatorArguments = [key=value,key=value...] (optional)
- validatorN
- @validatorArguments = [key=value,key=value...] (optional)
-</pre>
-where all nodes can be of type `nt:unstructured`.
-
-## Testing the default implementation
-Clone this repository and install the bundles (api, core test-services, it-http)
-
- git clone https://github.com/raducotescu/org.apache.sling.validation.git
- cd org.apache.sling.validation/
+## Testing the implementation
mvn clean install
This will install all the artifacts in your local repository. During the install phase of the `it-http` module a Sling Launchpad instance