View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 eviware.com
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the
5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
6    *  the Free Software Foundation.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wadl.inference;
14  
15  import javax.xml.namespace.QName;
16  
17  /***
18   * Handles schedule conflicts while inferring Xml schema from Xml documents. Has
19   * a single callback method.
20   * 
21   * @author Dain Nilsson
22   */
23  public interface ConflictHandler
24  {
25  
26  	/***
27  	 * Callback method for deciding whether given Xml document is valid or not,
28  	 * and if so, to expand the schema. The function should return true if the
29  	 * contents at the cursor is valid in respect to the message provided, false
30  	 * if not.
31  	 * 
32  	 * @param event
33  	 *           What type of event this is, creation or modification.
34  	 * @param type
35  	 *           The type of particle that this is in regards to.
36  	 * @param name
37  	 *           The QName for the particle that is being modified.
38  	 * @param path
39  	 *           The path to the element that is being changed (or contains the
40  	 *           attribute/has the type that is beng changed).
41  	 * @param message
42  	 *           A short message describing the change.
43  	 * @return True to accept the schema modification and continue validation,
44  	 *         false to trigger validation failure.
45  	 */
46  	public boolean callback( Event event, Type type, QName name, String path, String message );
47  
48  	public enum Type
49  	{
50  		ELEMENT, ATTRIBUTE, TYPE
51  	}
52  
53  	public enum Event
54  	{
55  		CREATION, MODIFICATION
56  	}
57  }