View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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.support;
14  
15  import com.eviware.soapui.impl.rest.RestService;
16  import com.eviware.soapui.impl.support.definition.DefinitionLoader;
17  import com.eviware.soapui.impl.support.definition.support.XmlSchemaBasedInterfaceDefinition;
18  import com.sun.research.wadl.x2006.x10.ApplicationDocument;
19  import org.apache.log4j.Logger;
20  
21  public class WadlInterfaceDefinition extends XmlSchemaBasedInterfaceDefinition<RestService>
22  {
23     private ApplicationDocument applicationDocument;
24     private Logger log = Logger.getLogger(WadlInterfaceDefinition.class);
25  
26     public WadlInterfaceDefinition(RestService iface)
27     {
28        super(iface);
29     }
30  
31     public WadlInterfaceDefinition load( DefinitionLoader loader) throws Exception
32     {
33        applicationDocument = (ApplicationDocument) loader.loadXmlObject(loader.getBaseURI(), null);
34  
35        if (!loader.isAborted())
36        {
37           super.loadSchemaTypes(loader);
38        }
39        else
40           throw new Exception("Loading of WADL from [" + loader.getBaseURI() + "] was aborted");
41  
42        return this;
43     }
44  
45     public String getTargetNamespace()
46     {
47        return null;
48     }
49  
50     public ApplicationDocument.Application getApplication()
51     {
52        return applicationDocument.getApplication();
53     }
54  }