KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > soap > NamedParameter


1 /*
2  * $Id: NamedParameter.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.soap;
12
13 import org.mule.config.i18n.Message;
14 import org.mule.config.i18n.Messages;
15
16 import javax.xml.namespace.QName JavaDoc;
17 import javax.xml.rpc.ParameterMode JavaDoc;
18
19 /**
20  * Representation of a Named parameter in a soap or XML-RPC call
21  *
22  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
23  * @version $Revision: 3798 $
24  */

25 public class NamedParameter
26 {
27
28     public final int MODE_IN = 0;
29     public final int MODE_OUT = 1;
30     public final int MODE_INOUT = 2;
31
32     public static final String JavaDoc URI_1999_SCHEMA_XSD = "http://www.w3.org/1999/XMLSchema";
33     public static final String JavaDoc URI_2000_SCHEMA_XSD = "http://www.w3.org/2000/10/XMLSchema";
34     public static final String JavaDoc URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
35
36     public static final String JavaDoc URI_DEFAULT_SCHEMA_XSD = URI_2001_SCHEMA_XSD;
37
38     public static final QName JavaDoc XSD_STRING = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "string");
39     public static final QName JavaDoc XSD_BOOLEAN = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "boolean");
40     public static final QName JavaDoc XSD_DOUBLE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "double");
41     public static final QName JavaDoc XSD_FLOAT = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "float");
42     public static final QName JavaDoc XSD_INT = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "int");
43     public static final QName JavaDoc XSD_INTEGER = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "integer");
44     public static final QName JavaDoc XSD_LONG = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "long");
45     public static final QName JavaDoc XSD_SHORT = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "short");
46     public static final QName JavaDoc XSD_BYTE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "byte");
47     public static final QName JavaDoc XSD_DECIMAL = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "decimal");
48     public static final QName JavaDoc XSD_BASE64 = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "base64Binary");
49     public static final QName JavaDoc XSD_HEXBIN = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "hexBinary");
50     public static final QName JavaDoc XSD_ANYSIMPLETYPE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "anySimpleType");
51     public static final QName JavaDoc XSD_ANYTYPE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "anyType");
52     public static final QName JavaDoc XSD_ANY = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "any");
53     public static final QName JavaDoc XSD_QNAME = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "QName");
54     public static final QName JavaDoc XSD_DATETIME = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "dateTime");
55     public static final QName JavaDoc XSD_DATE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "date");
56     public static final QName JavaDoc XSD_TIME = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "time");
57     public static final QName JavaDoc XSD_TIMEINSTANT1999 = new QName JavaDoc(URI_1999_SCHEMA_XSD, "timeInstant");
58     public static final QName JavaDoc XSD_TIMEINSTANT2000 = new QName JavaDoc(URI_2000_SCHEMA_XSD, "timeInstant");
59
60     public static final QName JavaDoc XSD_NORMALIZEDSTRING = new QName JavaDoc(URI_2001_SCHEMA_XSD, "normalizedString");
61     public static final QName JavaDoc XSD_TOKEN = new QName JavaDoc(URI_2001_SCHEMA_XSD, "token");
62
63     public static final QName JavaDoc XSD_UNSIGNEDLONG = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "unsignedLong");
64     public static final QName JavaDoc XSD_UNSIGNEDINT = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "unsignedInt");
65     public static final QName JavaDoc XSD_UNSIGNEDSHORT = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "unsignedShort");
66     public static final QName JavaDoc XSD_UNSIGNEDBYTE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "unsignedByte");
67     public static final QName JavaDoc XSD_POSITIVEINTEGER = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "positiveInteger");
68     public static final QName JavaDoc XSD_NEGATIVEINTEGER = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "negativeInteger");
69     public static final QName JavaDoc XSD_NONNEGATIVEINTEGER = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "nonNegativeInteger");
70     public static final QName JavaDoc XSD_NONPOSITIVEINTEGER = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "nonPositiveInteger");
71
72     public static final QName JavaDoc XSD_YEARMONTH = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "gYearMonth");
73     public static final QName JavaDoc XSD_MONTHDAY = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "gMonthDay");
74     public static final QName JavaDoc XSD_YEAR = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "gYear");
75     public static final QName JavaDoc XSD_MONTH = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "gMonth");
76     public static final QName JavaDoc XSD_DAY = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "gDay");
77     public static final QName JavaDoc XSD_DURATION = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "duration");
78
79     public static final QName JavaDoc XSD_NAME = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "Name");
80     public static final QName JavaDoc XSD_NCNAME = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "NCName");
81     public static final QName JavaDoc XSD_NMTOKEN = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "NMTOKEN");
82     public static final QName JavaDoc XSD_NMTOKENS = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "NMTOKENS");
83     public static final QName JavaDoc XSD_NOTATION = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "NOTATION");
84     public static final QName JavaDoc XSD_ENTITY = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "ENTITY");
85     public static final QName JavaDoc XSD_ENTITIES = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "ENTITIES");
86     public static final QName JavaDoc XSD_IDREF = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "IDREF");
87     public static final QName JavaDoc XSD_IDREFS = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "IDREFS");
88     public static final QName JavaDoc XSD_ANYURI = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "anyURI");
89     public static final QName JavaDoc XSD_LANGUAGE = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "language");
90     public static final QName JavaDoc XSD_ID = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "ID");
91     public static final QName JavaDoc XSD_SCHEMA = new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, "schema");
92
93     private QName JavaDoc name;
94     private QName JavaDoc type;
95     private ParameterMode JavaDoc mode;
96
97     public NamedParameter(QName JavaDoc name, QName JavaDoc type, String JavaDoc mode)
98     {
99         this.name = name;
100         this.type = type;
101         setMode(mode);
102     }
103
104     public NamedParameter(QName JavaDoc name, QName JavaDoc type, ParameterMode JavaDoc mode)
105     {
106         this.name = name;
107         this.type = type;
108         this.mode = mode;
109     }
110
111     public NamedParameter(String JavaDoc name, String JavaDoc type, ParameterMode JavaDoc mode)
112     {
113         this.name = new QName JavaDoc(name);
114         this.type = createQName(name);
115         this.mode = mode;
116     }
117
118     protected void setMode(String JavaDoc mode)
119     {
120         mode = mode.toLowerCase().trim();
121         if (mode.equals("in"))
122         {
123             this.mode = ParameterMode.IN;
124         }
125         else if (mode.equals("out"))
126         {
127             this.mode = ParameterMode.OUT;
128         }
129         else if (mode.equals("inout"))
130         {
131             this.mode = ParameterMode.INOUT;
132         }
133         else
134         {
135             throw new IllegalArgumentException JavaDoc(
136                 new Message(Messages.VALUE_X_IS_INVALID_FOR_X, mode, "mode").toString());
137         }
138     }
139
140     public QName JavaDoc getName()
141     {
142         return name;
143     }
144
145     public QName JavaDoc getType()
146     {
147         return type;
148     }
149
150     public ParameterMode JavaDoc getMode()
151     {
152         return mode;
153     }
154
155     public static QName JavaDoc createQName(String JavaDoc value)
156     {
157         return new QName JavaDoc(URI_DEFAULT_SCHEMA_XSD, value);
158     }
159 }
160
Popular Tags