001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
005: * (C) 2004 TOPP - www.openplans.org
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.validation;
018:
019: import org.geotools.feature.Feature;
020: import org.geotools.feature.FeatureType;
021:
022: /**
023: * Defined a per Feature validation test.
024: *
025: * <p>
026: * Each ValidationPlugIn is very specific in nature: it performs one test
027: * extermly well. This simplifies design decisions, documenation
028: * configuration and use.
029: * </p>
030: *
031: * <p>
032: * Following the lead the excelent design work in the JUnit testing framework
033: * validation results are collected by a ValidationResults object. This
034: * interface for the ValidationResults object also allows it to collect
035: * warning information.
036: * </p>
037: *
038: * <p>
039: * The PlugIn is also required to supply some metadata to aid in its
040: * deployment, scripting, logging and execution and error recovery:
041: *
042: * <ul>
043: * <li>
044: * name: user's name of validation test
045: * </li>
046: * <li>
047: * description: user's description of validation test
048: * </li>
049: * <li>
050: * priority: used to schedule validation test
051: * </li>
052: * <li>
053: * typeNames: used to connect validaiton test to transaction opperation
054: * </li>
055: * </ul>
056: * </p>
057: *
058: * <p>
059: * Capabilities:
060: *
061: * <ul>
062: * <li>
063: * Uses FeatureResults to allow environment to gather error/warning information
064: * as required (transaction XML document, JTable, logging system, etc...)
065: * </li>
066: * <li>
067: * Primiarly used as part of processing an Insert Element in the Transaction
068: * opperation of a Web Feature Server. (Allows us to fail a Feature without
069: * bothering the Database)
070: * </li>
071: * </ul>
072: * </p>
073: *
074: * <p>
075: * Example Use (feature: id=1, name="foo", geom=linestring):
076: * <pre><code>
077: * RangeFeatureValidation test = new RangeFeatureValidation();
078: *
079: * results.setValidation( test );
080: * test.setMin(0);
081: * test.validate( feature, featureType, results ); // true
082: * test.setMin(2);
083: * test.validate( feature, featureType, results ); // false
084: * </code></pre>
085: * </p>
086: *
087: * @author Jody Garnett, Refractions Research, Inc.
088: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/validation/src/main/java/org/geotools/validation/FeatureValidation.java $
089: * @version $Id: FeatureValidation.java 20884 2006-08-07 14:10:46Z jgarnett $
090: */
091: public interface FeatureValidation extends Validation {
092: /**
093: * Used to check features against this validation rule.
094: *
095: * @param feature Feature to be Validated
096: * @param type FeatureTypeInfo schema of feature
097: * @param results coallate results information
098: *
099: * @return True if feature passes this test.
100: */
101: public boolean validate(Feature feature, FeatureType type,
102: ValidationResults results) throws Exception;
103: }
|