Author: mmerz
Date: Tue Apr  5 14:29:53 2005
New Revision: 160225

URL: http://svn.apache.org/viewcvs?view=rev&rev=160225
Log:
Added the new class.

Contributor: Daryoush Mehrtash

Added:
    
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java

Added: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java?view=auto&rev=160225
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
 (added)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
 Tue Apr  5 14:29:53 2005
@@ -0,0 +1,237 @@
+/*
+ * Created on Mar 24, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.beehive.wsm.axis.registration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.types.HexBinary;
+
+/**
+ * @author dmehrtash
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class AxisTypeMappingMetaData {
+    static Map<Class, QName> builtInTypes = new HashMap<Class, QName>();
+    
+    static {
+        initBuildInTypes();
+
+    }
+
+    /**
+     * @param cls
+     * @return
+     */
+    static public  boolean isBuiltInType(Class cls) {
+        return (builtInTypes.containsKey(cls));
+    }
+    
+    /* (non-Javadoc)
+     * @see 
org.apache.beehive.wsm.registration.TypeRegistrar#getBuiltInTypeQname(java.lang.Class)
+     */
+    static public  QName getBuiltInTypeQname(Class cls) {
+        return builtInTypes.get(cls);
+    }
+    
+    /**
+     * 
+     */
+    static private void initBuildInTypes() {
+        // HexBinary binary data needs to use the hex binary
+        // serializer/deserializer
+        addBuiltInType(Constants.XSD_HEXBIN, HexBinary.class);
+        addBuiltInType(Constants.XSD_HEXBIN, byte[].class);
+
+        addBuiltInType(Constants.XSD_BYTE, byte[].class);
+
+        addBuiltInType(Constants.XSD_BASE64, byte[].class);
+
+        // anySimpleType is mapped to java.lang.String according to JAX-RPC 1.1
+        // spec.
+        addBuiltInType(Constants.XSD_ANYSIMPLETYPE, java.lang.String.class);
+
+        // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives.
+        addBuiltInType(Constants.XSD_STRING, java.lang.String.class);
+        addBuiltInType(Constants.XSD_BOOLEAN, java.lang.Boolean.class);
+        addBuiltInType(Constants.XSD_DOUBLE, java.lang.Double.class);
+        addBuiltInType(Constants.XSD_FLOAT, java.lang.Float.class);
+        addBuiltInType(Constants.XSD_INT, java.lang.Integer.class);
+        addBuiltInType(Constants.XSD_INTEGER, java.math.BigInteger.class);
+        addBuiltInType(Constants.XSD_DECIMAL, java.math.BigDecimal.class);
+        addBuiltInType(Constants.XSD_LONG, java.lang.Long.class);
+        addBuiltInType(Constants.XSD_SHORT, java.lang.Short.class);
+        addBuiltInType(Constants.XSD_BYTE, java.lang.Byte.class);
+
+        // The XSD Primitives are mapped to java primitives.
+        addBuiltInType(Constants.XSD_BOOLEAN, boolean.class);
+        addBuiltInType(Constants.XSD_DOUBLE, double.class);
+        addBuiltInType(Constants.XSD_FLOAT, float.class);
+        addBuiltInType(Constants.XSD_INT, int.class);
+        addBuiltInType(Constants.XSD_LONG, long.class);
+        addBuiltInType(Constants.XSD_SHORT, short.class);
+        addBuiltInType(Constants.XSD_BYTE, byte.class);
+
+        // Map QNAME to the jax rpc QName class
+        addBuiltInType(Constants.XSD_QNAME, javax.xml.namespace.QName.class);
+
+        // The closest match for anytype is Object
+        addBuiltInType(Constants.XSD_ANYTYPE, java.lang.Object.class);
+
+        // See the SchemaVersion classes for where the registration of
+        // dateTime (for 2001) and timeInstant (for 1999 & 2000) happen.
+        addBuiltInType(Constants.XSD_DATE, java.sql.Date.class);
+
+        // See the SchemaVersion classes for where the registration of
+        // dateTime (for 2001) and timeInstant (for 1999 & 2000) happen.
+        addBuiltInType(Constants.XSD_DATE, java.util.Date.class);
+
+        // Mapping for xsd:time. Map to Axis type Time
+        addBuiltInType(Constants.XSD_TIME, org.apache.axis.types.Time.class);
+        // These are the g* types (gYearMonth, etc) which map to Axis types
+        addBuiltInType(Constants.XSD_YEARMONTH,
+                org.apache.axis.types.YearMonth.class);
+        addBuiltInType(Constants.XSD_YEAR, org.apache.axis.types.Year.class);
+        addBuiltInType(Constants.XSD_MONTH, org.apache.axis.types.Month.class);
+        addBuiltInType(Constants.XSD_DAY, org.apache.axis.types.Day.class);
+        addBuiltInType(Constants.XSD_MONTHDAY,
+                org.apache.axis.types.MonthDay.class);
+
+        // Serialize all extensions of Map to SOAP_MAP
+        // Order counts here, HashMap should be last.
+        addBuiltInType(Constants.SOAP_MAP, java.util.Hashtable.class);
+        addBuiltInType(Constants.SOAP_MAP, java.util.Map.class);
+        // The SOAP_MAP will be deserialized into a HashMap by default.
+        addBuiltInType(Constants.SOAP_MAP, java.util.HashMap.class);
+
+        // Use the Element Serializeration for elements
+        addBuiltInType(Constants.SOAP_ELEMENT, org.w3c.dom.Element.class);
+
+        // Use the Document Serializeration for Document's
+        addBuiltInType(Constants.SOAP_DOCUMENT, org.w3c.dom.Document.class);
+
+        addBuiltInType(Constants.SOAP_VECTOR, java.util.Vector.class);
+
+        // if (JavaUtils.isAttachmentSupported()) {
+        // addBuiltInType(Constants.MIME_IMAGE, java.awt.Image.class);
+        // addBuiltInType(Constants.MIME_MULTIPART,
+        // javax.mail.internet.MimeMultipart.class);
+        // addBuiltInType(Constants.MIME_SOURCE,
+        // javax.xml.transform.Source.class);
+        // addBuiltInType(Constants.MIME_OCTETSTREAM, OctetStream.class);
+        // addBuiltInType(Constants.MIME_DATA_HANDLER,
+        // javax.activation.DataHandler.class);
+        // }
+
+        // xsd:token
+        addBuiltInType(Constants.XSD_TOKEN, org.apache.axis.types.Token.class);
+
+        // a xsd:normalizedString
+        addBuiltInType(Constants.XSD_NORMALIZEDSTRING,
+                org.apache.axis.types.NormalizedString.class);
+
+        // a xsd:unsignedLong
+        addBuiltInType(Constants.XSD_UNSIGNEDLONG,
+                org.apache.axis.types.UnsignedLong.class);
+
+        // a xsd:unsignedInt
+        addBuiltInType(Constants.XSD_UNSIGNEDINT,
+                org.apache.axis.types.UnsignedInt.class);
+
+        // a xsd:unsignedShort
+        addBuiltInType(Constants.XSD_UNSIGNEDSHORT,
+                org.apache.axis.types.UnsignedShort.class);
+
+        // a xsd:unsignedByte
+        addBuiltInType(Constants.XSD_UNSIGNEDBYTE,
+                org.apache.axis.types.UnsignedByte.class);
+
+        // a xsd:nonNegativeInteger
+        addBuiltInType(Constants.XSD_NONNEGATIVEINTEGER,
+                org.apache.axis.types.NonNegativeInteger.class);
+
+        // a xsd:negativeInteger
+        addBuiltInType(Constants.XSD_NEGATIVEINTEGER,
+                org.apache.axis.types.NegativeInteger.class);
+
+        // a xsd:positiveInteger
+        addBuiltInType(Constants.XSD_POSITIVEINTEGER,
+                org.apache.axis.types.PositiveInteger.class);
+
+        // a xsd:nonPositiveInteger
+        addBuiltInType(Constants.XSD_NONPOSITIVEINTEGER,
+                org.apache.axis.types.NonPositiveInteger.class);
+
+        // a xsd:Name
+        addBuiltInType(Constants.XSD_NAME, org.apache.axis.types.Name.class);
+
+        // a xsd:NCName
+        addBuiltInType(Constants.XSD_NCNAME, 
org.apache.axis.types.NCName.class);
+
+        // a xsd:ID
+        addBuiltInType(Constants.XSD_ID, org.apache.axis.types.Id.class);
+
+        // a xml:lang
+        addBuiltInType(Constants.XML_LANG, 
org.apache.axis.types.Language.class);
+
+        // a xsd:language
+        addBuiltInType(Constants.XSD_LANGUAGE,
+                org.apache.axis.types.Language.class);
+
+        // a xsd:NmToken
+        addBuiltInType(Constants.XSD_NMTOKEN,
+                org.apache.axis.types.NMToken.class);
+
+        // a xsd:NmTokens
+        addBuiltInType(Constants.XSD_NMTOKENS,
+                org.apache.axis.types.NMTokens.class);
+
+        // a xsd:NOTATION
+        addBuiltInType(Constants.XSD_NOTATION,
+                org.apache.axis.types.Notation.class);
+
+        // a xsd:XSD_ENTITY
+        addBuiltInType(Constants.XSD_ENTITY, 
org.apache.axis.types.Entity.class);
+
+        // a xsd:XSD_ENTITIES
+        addBuiltInType(Constants.XSD_ENTITIES,
+                org.apache.axis.types.Entities.class);
+
+        // a xsd:XSD_IDREF
+        addBuiltInType(Constants.XSD_IDREF, org.apache.axis.types.IDRef.class);
+
+        // a xsd:XSD_XSD_IDREFS
+        addBuiltInType(Constants.XSD_IDREFS, 
org.apache.axis.types.IDRefs.class);
+
+        // a xsd:Duration
+        addBuiltInType(Constants.XSD_DURATION,
+                org.apache.axis.types.Duration.class);
+
+        // a xsd:anyURI
+        addBuiltInType(Constants.XSD_ANYURI, org.apache.axis.types.URI.class);
+
+        // a xsd:schema
+        addBuiltInType(Constants.XSD_SCHEMA, 
org.apache.axis.types.Schema.class);
+
+        addBuiltInType(Constants.SOAP_ARRAY, java.util.ArrayList.class);
+    }
+
+    /**
+     * @param xsd_hexbin
+     * @param name
+     */
+    static private void addBuiltInType(QName q, Class c) {
+        builtInTypes.put(c, q);
+
+    }
+
+}


Reply via email to