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.support;
14  
15  import javax.xml.namespace.QName;
16  
17  import com.eviware.soapui.impl.wadl.inference.ConflictHandler;
18  
19  /***
20   * ConflictHandler that allows any changes that need to be made to the schema in
21   * order to validate against given XML document.
22   * 
23   * @author Dain Nilsson
24   */
25  public class AllowAll implements ConflictHandler
26  {
27  	/***
28  	 * Constructs a new AllowAll instance.
29  	 */
30  	public AllowAll()
31  	{
32  
33  	}
34  
35  	public boolean callback( Event event, Type type, QName name, String path, String message )
36  	{
37  		StringBuilder s = new StringBuilder( message ).append( "\n" );
38  		if( event == Event.CREATION )
39  			s.append( "Create " );
40  		else if( event == Event.MODIFICATION )
41  			s.append( "Modify " );
42  		if( type == Type.ELEMENT )
43  			s.append( "element '" );
44  		else if( type == Type.ATTRIBUTE )
45  			s.append( "attribute '" );
46  		else if( type == Type.TYPE )
47  			s.append( "type '" );
48  		s.append( name.getLocalPart() ).append( "' in namespace '" ).append( name.getNamespaceURI() ).append( "'" );
49  		s.append( " at path " ).append( path ).append( "?" );
50  		System.out.println( s.toString() );
51  		return true;
52  	}
53  
54  }