Java Doc for ValidationProcessor.java in  » GIS » GeoTools-2.4.1 » org » geotools » validation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.validation 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.validation.ValidationProcessor

ValidationProcessor
public class ValidationProcessor (Code)
ValidationProcessor Runs validation tests against Features and reports the outcome of the tests.

The validation processor contains two main data structures. Each one is a HashMap of ArrayLists that hold Validations. The first one, featureLookup, holds per-feature validation tests (tests that operate on one feature at a time with no knowledge of any other features. The second one, integrityLookup, holds integrity validations (validations that span multiple features and/or multiple feature types).

Each HashMap of validations is hashed with a key whose value is a FeatureTypeName. This key provides access to an ArrayList of validations that are to be performed on this FeatureTypeInfo.

Validations are added via the two addValidation() methods.

The validations are run when runFeatureTests() and runIntegrityTests() are called. It is recommended that the user call runFeatureTests() before runIntegrityTests() as it is usually the case that integrity tests are much more time consuming. If a Feature is incorrect, it can probably be detected early on, and quickly, in the feature validation tests.

For validations that are performed on every FeatureTypeInfo, a value called ANYTYPENAME has been created and can be stored in the validationLookup tables if a validation specifies that it is run against all FeatureTypes. The value that causes a validation to be run against all FeatureTypes is null. Or Validation.ALL

Results of the validation tests are handled using a Visitor pattern. This visitor is a ValidationResults object that is passed into the runFeatureTests() and runIntegrityTests() methods. Each individual validation will record error messages in the ValidationResults visitor.

Example Use:


 ValidationProcessor processor = new ValidationProcessor();
processor.addValidation(FeatureValidation1);
processor.addValidation(FeatureValidation2);
processor.addValidation(IntegrityValidation1);
processor.addValidation(FeatureValidation3);

processor.runFeatureTests(FeatureTypeInfo, Feature, ValidationResults);
processor.runIntegrityTests(layers, Envelope, ValidationResults);


author:
   bowens, Refractions Research, Inc.
author:
   $Author: jive $ (last modification)
version:
   $Id: ValidationProcessor.java 27862 2007-11-12 19:51:19Z desruisseaux $


Field Summary
final  ObjectANYTYPENAME
    
protected  MapfeatureLookup
     Stores Lists of FeatureTests by featureType.
protected  MapintegrityLookup
     Stores Lists of IntegrityValidation by featureType.
protected  ArrayListmodifiedFeatureTypes
     List of feature types that have been modified.

Constructor Summary
public  ValidationProcessor()
     ValidationProcessor constructor.

Method Summary
public  voidaddValidation(FeatureValidation validation)
    
public  voidaddValidation(IntegrityValidation validation)
    
public  SetgetDependencies(String typeName)
     getDependencies purpose.
public  voidload(File plugins, File testsuites)
     Load testsuites from provided directories.
public  voidload(Map plugInDTOs, Map testSuiteDTOs)
     Populates this validation processor against the provided DTO objects.
final protected static  SetqueryPlugInNames(Map testSuiteDTOs)
    
public  voidrunFeatureTests(String dsID, FeatureCollection collection, ValidationResults results)
     runFeatureTests Change: Uses a FeatureIterator now instead of a FeatureCollection.

Performs a lookup on the FeatureTypeInfo name to determine what FeatureTests need to be performed.

public  voidrunIntegrityTests(Set typeRefs, Map stores, Envelope envelope, ValidationResults results)
     runIntegrityTests

Performs a lookup on the FeatureTypeInfo name to determine what IntegrityTests need to be performed.


Field Detail
ANYTYPENAME
final Object ANYTYPENAME(Code)
Magic key used to hold the place of any featureType



featureLookup
protected Map featureLookup(Code)
Stores Lists of FeatureTests by featureType.

Map of ArrayLists by featureType (the lists contain FeatureValidation instances)




integrityLookup
protected Map integrityLookup(Code)
Stores Lists of IntegrityValidation by featureType.

A Map with featureTypes as keys that map to array lists of integrity validation tests.

How are tests that map against all FeatureTypes stored?




modifiedFeatureTypes
protected ArrayList modifiedFeatureTypes(Code)
List of feature types that have been modified.




Constructor Detail
ValidationProcessor
public ValidationProcessor()(Code)
ValidationProcessor constructor.

Initializes the data structure to hold the validations.





Method Detail
addValidation
public void addValidation(FeatureValidation validation)(Code)
addValidation

Add a FeatureValidation to the list of Feature tests


Parameters:
  validation -



addValidation
public void addValidation(IntegrityValidation validation)(Code)
addValidation

Add an IntegrityValidation to the list of Integrity tests


Parameters:
  validation -



getDependencies
public Set getDependencies(String typeName)(Code)
getDependencies purpose.

Gets all the FeatureTypes that this FeatureTypeInfo uses.


Parameters:
  typeName - the FeatureTypeName all the FeatureTypes that this FeatureTypeInfo uses.



load
public void load(File plugins, File testsuites) throws Exception(Code)
Load testsuites from provided directories.

This is mostly useful for testing, you may want to write your own load method with enhanced error reporting.


Parameters:
  plugins - DOCUMENT ME!
Parameters:
  testsuites - DOCUMENT ME!
throws:
  Exception - DOCUMENT ME!



load
public void load(Map plugInDTOs, Map testSuiteDTOs) throws Exception(Code)
Populates this validation processor against the provided DTO objects.

This method is useful for testing, it is not forgiving and will error out if things go bad.


Parameters:
  plugInDTOs -
Parameters:
  testSuiteDTOs -
throws:
  Exception -
throws:
  ClassNotFoundException - DOCUMENT ME!



queryPlugInNames
final protected static Set queryPlugInNames(Map testSuiteDTOs)(Code)



runFeatureTests
public void runFeatureTests(String dsID, FeatureCollection collection, ValidationResults results) throws Exception(Code)
runFeatureTests Change: Uses a FeatureIterator now instead of a FeatureCollection.

Performs a lookup on the FeatureTypeInfo name to determine what FeatureTests need to be performed. Once these tests are gathered, they are run on each feature in the FeatureCollection. The first validation test lookup checks to see if there are any validations that are to be performed on every FeatureTypeInfo. An example of this could be an isValid() test on all geometries in all FeatureTypes. Once those tests have been gathered, a lookup is performed on the TypeName of the FeatureTypeInfo to check for specific FeatureTypeInfo validation tests. A list of validation tests is returned from each lookup, if any exist. When all the validation tests have been gathered, each test is iterated through then run on each Feature, with the ValidationResults coming along for the ride, collecting error information. Parameter "FeatureCollection collection" should be changed later to take in a FeatureSource so not everything is loaded into memory.


Parameters:
  dsID - data Store id.
Parameters:
  type - The FeatureTypeInfo of the features being tested.
Parameters:
  features - The collection of features, of a particulareFeatureTypeInfo "type", that are to be validated.
Parameters:
  results - Storage for the results of the validation tests.
throws:
  Exception - FeatureValidations throw Exceptions



runIntegrityTests
public void runIntegrityTests(Set typeRefs, Map stores, Envelope envelope, ValidationResults results) throws Exception(Code)
runIntegrityTests

Performs a lookup on the FeatureTypeInfo name to determine what IntegrityTests need to be performed. Once these tests are gathered, they are run on the collection features in the Envelope, defined by a FeatureSource (not a FeatureCollection!). The first validation test lookup checks to see if there are any validations that are to be performed on every FeatureTypeInfo. An example of this could be a uniqueID() test on a unique column value in all FeatureTypes. Once those tests have been gathered, a lookup is performed on the TypeName of the FeatureTypeInfo to check for specific Integrity validation tests. A list of validation tests is returned from each lookup, if any exist. When all the validation tests have been gathered, each test is iterated through then run on each Feature, with the ValidationResults coming along for the ride, collecting error information.


Parameters:
  typeRefs - List of modified features, or null to usestores.keySet()
Parameters:
  stores - the Map of effected features (Map of key=typeRef,value="featureSource"
Parameters:
  envelope - The bounding box that contains all modified Features
Parameters:
  results - Storage for the results of the validation tests.
throws:
  Exception - Throws an exception if the HashMap contains a valuethat is not a FeatureSource



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.