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.model.iface;
14  
15  import javax.wsdl.Part;
16  import javax.xml.namespace.QName;
17  
18  import org.apache.xmlbeans.SchemaGlobalElement;
19  import org.apache.xmlbeans.SchemaType;
20  
21  /***
22   * A message part in a Request
23   * 
24   * @author ole.matzura
25   */
26  
27  public interface MessagePart
28  {
29  	public String getName();
30  	
31  	public String getDescription();
32  	
33  	public PartType getPartType();
34  	
35  	public enum PartType { HEADER, CONTENT, ATTACHMENT, FAULT, PARAMETER };
36  	
37  	public abstract static class ContentPart implements MessagePart
38  	{
39  		public abstract SchemaType getSchemaType();
40  		
41  		public abstract QName getPartElementName();
42  		
43  		public abstract SchemaGlobalElement getPartElement();
44  		
45  		public PartType getPartType()
46  		{
47  			return PartType.CONTENT;
48  		}
49  	}
50  	
51  	public abstract static class AttachmentPart implements MessagePart
52  	{
53  		public abstract String[] getContentTypes();
54  		
55  		public abstract boolean isAnonymous();
56  		
57  		public PartType getPartType()
58  		{
59  			return PartType.ATTACHMENT;
60  		}
61  	}
62  	
63  	public abstract static class HeaderPart extends ContentPart
64  	{
65  		public PartType getPartType()
66  		{
67  			return PartType.HEADER;
68  		}
69  	}
70  	
71  	public abstract static class ParameterPart extends ContentPart
72  	{
73  		public PartType getPartType()
74  		{
75  			return PartType.PARAMETER;
76  		}
77  	}
78  	
79  	public abstract static class FaultPart extends ContentPart
80  	{
81  		public PartType getPartType()
82  		{
83  			return PartType.FAULT;
84  		}
85  
86  		public abstract Part [] getWsdlParts();
87  	}
88  }