KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > axis > enums > Style


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Axis" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation. For more
52  * information on the Apache Software Foundation, please see
53  * <http://www.apache.org/>.
54  */

55
56 package org.jboss.axis.enums;
57
58 import org.jboss.axis.deployment.wsdd.WSDDConstants;
59
60 import javax.xml.namespace.QName JavaDoc;
61
62
63 /**
64  * Description of the different styles
65  * <br>
66  * <b>style=rpc, use=encoded</b><br>
67  * First element of the SOAP body is the
68  * operation. The operation contains
69  * elements describing the parameters, which
70  * are serialized as encoded (possibly multi-ref)
71  * <pre>
72  * &lt;soap:body&gt;
73  * &lt;operation&gt;
74  * &lt;arg1&gt;...&lt;/arg1&gt;
75  * &lt;arg2&gt;...&lt;/arg2&gt;
76  * &lt;/operation&gt;
77  * </pre>
78  * <br>
79  * <b>style=RPC, use=literal</b><br>
80  * First element of the SOAP body is the
81  * operation. The operation contains elements
82  * describing the parameters, which are serialized
83  * as encoded (no multi-ref)\
84  * <pre>
85  * &lt;soap:body&gt;
86  * &lt;operation&gt;
87  * &lt;arg1&gt;...&lt;/arg1&gt;
88  * &lt;arg2&gt;...&lt;/arg2&gt;
89  * &lt;/operation&gt;
90  * </pre>
91  * <br>
92  * <b>style=document, use=literal</b><br>
93  * Elements of the SOAP body are the names of the parameters
94  * (there is no wrapper operation...no multi-ref)
95  * <pre>
96  * &lt;soap:body&gt;
97  * &lt;arg1&gt;...&lt;/arg1&gt;
98  * &lt;arg2&gt;...&lt;/arg2&gt;
99  * </pre>
100  * <br>
101  * <b>style=wrapped</b><br>
102  * Special case of DOCLIT where there is only one parameter
103  * and it has the same qname as the operation. In
104  * such cases, there is no actual type with the name...the
105  * elements are treated as parameters to the operation
106  * <pre>
107  * &lt;soap:body&gt;
108  * &lt;one-arg-same-name-as-operation&gt;
109  * &lt;elemofarg1&gt;...&lt;/elemofarg1&gt;
110  * &lt;elemofarg2&gt;...&lt;/elemofarg2&gt;
111  * </pre>
112  * <br>
113  * <b>style=document, use=encoded</b><br>
114  * There is not an enclosing operation name element, but
115  * the parmeterss are encoded using SOAP encoding
116  * This mode is not (well?) supported by Axis.
117  *
118  * @author Richard Sitze
119  */

120 public class Style extends Enum JavaDoc
121 {
122
123    private static final Type type = new Type();
124
125    public static final String JavaDoc RPC_STR = "rpc";
126    public static final String JavaDoc DOCUMENT_STR = "document";
127    public static final String JavaDoc WRAPPED_STR = "wrapped";
128    public static final String JavaDoc MESSAGE_STR = "message";
129
130
131    public static final Style RPC = type.getStyle(RPC_STR);
132    public static final Style DOCUMENT = type.getStyle(DOCUMENT_STR);
133    public static final Style WRAPPED = type.getStyle(WRAPPED_STR);
134    public static final Style MESSAGE = type.getStyle(MESSAGE_STR);
135
136    public static final Style DEFAULT = RPC;
137
138    static
139    {
140       type.setDefault(DEFAULT);
141    }
142
143
144    private QName JavaDoc provider;
145
146    public static Style getDefault()
147    {
148       return (Style)type.getDefault();
149    }
150
151    public final QName JavaDoc getProvider()
152    {
153       return provider;
154    }
155
156    public static final Style getStyle(int style)
157    {
158       return type.getStyle(style);
159    }
160
161    public static final Style getStyle(String JavaDoc style)
162    {
163       return type.getStyle(style);
164    }
165
166    public static final Style getStyle(String JavaDoc style, Style dephault)
167    {
168       return type.getStyle(style, dephault);
169    }
170
171    public static final boolean isValid(String JavaDoc style)
172    {
173       return type.isValid(style);
174    }
175
176    public static final int size()
177    {
178       return type.size();
179    }
180
181    public static final String JavaDoc[] getStyles()
182    {
183       return type.getEnumNames();
184    }
185
186    public static class Type extends Enum.Type JavaDoc
187    {
188       private Type()
189       {
190          super("style", new Enum JavaDoc[]{
191             new Style(0, RPC_STR,
192                     WSDDConstants.QNAME_JAVARPC_PROVIDER),
193             new Style(1, DOCUMENT_STR,
194                     WSDDConstants.QNAME_JAVARPC_PROVIDER),
195             new Style(2, WRAPPED_STR,
196                     WSDDConstants.QNAME_JAVARPC_PROVIDER),
197             new Style(3, MESSAGE_STR,
198                     WSDDConstants.QNAME_JAVAMSG_PROVIDER),
199          });
200       }
201
202       public final Style getStyle(int style)
203       {
204          return (Style)this.getEnum(style);
205       }
206
207       public final Style getStyle(String JavaDoc style)
208       {
209          return (Style)this.getEnum(style);
210       }
211
212       public final Style getStyle(String JavaDoc style, Style dephault)
213       {
214          return (Style)this.getEnum(style, dephault);
215       }
216    }
217
218    private Style(int value, String JavaDoc name, QName JavaDoc provider)
219    {
220       super(type, value, name);
221       this.provider = provider;
222    }
223 }
224
225 ;
226
Popular Tags