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