beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Olander <dolan...@gmail.com>
Subject Re: svn commit: r356430 - in /beehive/trunk: system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/ wsm/src/axis/org/apache/beehive/wsm/axis/ wsm/src/axis/org/apache/beehive/wsm/axis/databinding/ wsm/src/axis/org/apache/b
Date Tue, 13 Dec 2005 04:10:05 GMT
Two things...We should keep the copyrights up to date.  The new copyrights
were added as 2004.  For the new file this should probably be 2005 and the
other something like 2004-2005.  Soon we should do the update them all
again...

Second, I noticed that there was code that was throwing a RuntimeException,
seems like very bad style (I know it was like this).  If we don't want to
throw a checked exception, then we should at least subclass RuntimeException
so people can actually catch it.

On 12/12/05, ekoneil@apache.org <ekoneil@apache.org> wrote:
>
> Author: ekoneil
> Date: Mon Dec 12 16:30:28 2005
> New Revision: 356430
>
> URL: http://svn.apache.org/viewcvs?rev=356430&view=rev
> Log:
> Incremental binding / type work.
>
> - add a SchemaTypesLookupService that implements Class <> QName support
> for the core XSD / SOAP types
> - add a BindingLookupServiceFactory.  This isn't used yet, but it's the
> kind of thing that will support getting different singletons / chains of
> type providers
> - remove the isBuiltInType methods from the TypeRegistrar and
> AxisTypeMappingMetaData classes.  Makes things simpler...
>
> BB: self
> Test: WSM and web service control pass
>
>
> Added:
>     beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java
> (with props)
>     beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java
> (with props)
> Modified:
>
>     beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/AxisTypeRegistrar.java
>
>     beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/TypeRegistrar.java
>
>     beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
>
>     beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisLookupService.java
>
>     beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
>
>     beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanLookupService.java
>
> Modified:
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/AxisTypeRegistrar.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/AxisTypeRegistrar.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/AxisTypeRegistrar.java
> (original)
> +++
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/AxisTypeRegistrar.java
> Mon Dec 12 16:30:28 2005
> @@ -55,10 +55,6 @@
>          return XMLType.AXIS_VOID;
>      }
>
> -    protected boolean isBuiltInType(Class cls) {
> -        return AxisTypeMappingMetaData.isBuiltInType(cls);
> -    }
> -
>      protected void registerClassAsWithDefaultSearialization(Class cls,
> QName q, SOAPBinding.Style style, SOAPBinding.Use use) {
>          try {
>              LOGGER.debug("Assigned Default Serialization to  class: " +
> cls.getCanonicalName() + " qname:" + q);
>
> Modified:
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/TypeRegistrar.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/TypeRegistrar.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/TypeRegistrar.java
> (original)
> +++
> beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/TypeRegistrar.java
> Mon Dec 12 16:30:28 2005
> @@ -76,22 +76,21 @@
>              if(Void.TYPE.equals(cls))
>                  return null;
>
> -            if(isBuiltInType(cls))
> -                return getBuiltInTypeQname(cls);
> +            QName builtInQName = getBuiltInTypeQname(cls);
> +            if(builtInQName != null)
> +                return builtInQName;
> +
>              if(q == null)
> -                throw new RuntimeException(
> -                    "Invalid registeration requestion qname is null");
> +                throw new RuntimeException("Invalid registeration
> requestion qname is null");
>
>              if(cls.isArray()) {
>                  if (SOAPBinding.Use.ENCODED == use) {
> -                    if(!classIsRegistered(cls, q)) {
> +                    if(!classIsRegistered(cls, q))
>                          registerClassAsSoapEncodedArray(cls, q);
> -                    }
>                  } else {
> -                   q = registerType(cls.getComponentType(), q, style,
> use);
> -                   if (SOAPBinding.Style.RPC == style) {
> +                   if (SOAPBinding.Style.RPC == style)
>                         q = XMLType.SOAP_ARRAY;
> -                   }
> +                    else q = registerType(cls.getComponentType(), q,
> style, use);
>                  }
>              }
>              else if(!classIsRegistered(cls, q)) {
> @@ -111,10 +110,6 @@
>                          registerClassAsDataHandler(cls, q);
>                      }
>                      catch(Exception e) {
> -                        /*
> -                               * FIXME jcolwell@bea.com 2004-Oct-08 --
> log this
> -                               * properly
> -                               */
>                          e.printStackTrace();
>                      }
>                  }
> @@ -142,9 +137,8 @@
>              return q;
>          }
>          catch(RuntimeException e) {
> -            LOGGER.error("Failed to register class: " +
> cls.getCanonicalName()
> -                + " type: " + q.getNamespaceURI() + ":" + q.getLocalPart
> ());
> -
> +            LOGGER.error("Failed to register class: " +
> cls.getCanonicalName() + " type: " +
> +                q.getNamespaceURI() + ":" + q.getLocalPart());
>              e.printStackTrace();
>              throw e;
>          }
> @@ -215,8 +209,6 @@
>       */
>      protected abstract boolean classIsRegistered(Class cls, QName q);
>
> -    protected abstract boolean isBuiltInType(Class cls);
> -
>      protected abstract QName getBuiltInTypeQname(Class cls);
>
>      private boolean isActivationEnabled() {
> @@ -227,9 +219,8 @@
>          try {
>              return getClass().getClassLoader().loadClass("
> javax.activation.DataHandler");
>          }
> -        catch(ClassNotFoundException e) {
> -            /* ignore: datahandler support will be disabled */
> -        }
> +        /* ignore: datahandler support will be disabled */
> +        catch(ClassNotFoundException e) {}
>          return null;
>      }
>
> @@ -237,9 +228,8 @@
>          try {
>              return getClass().getClassLoader().loadClass("
> javax.mail.internet.MimeMultipart");
>          }
> -        catch(ClassNotFoundException e) {
> -            /* ignore; multipart support will be disabled */
> -        }
> +        /* ignore: datahandler support will be disabled */
> +        catch(ClassNotFoundException e) {}
>          return null;
>      }
> }
>
> Modified:
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
> (original)
> +++
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
> Mon Dec 12 16:30:28 2005
> @@ -373,8 +373,9 @@
>          // todo: need to replace this with delegation to the
> BindingLookupService's implementation
>          //       for the built-in types
>          /* get built-in type QName */
> -        if(AxisTypeMappingMetaData.isBuiltInType(type))
> -            return AxisTypeMappingMetaData.getBuiltInTypeQname(type);
> +        QName builtInQName = AxisTypeMappingMetaData.getBuiltInTypeQname
> (type);
> +        if(builtInQName != null)
> +            return builtInQName;
>
>          /* todo: may need to register the holder type also? */
>          if(Holder.class.isAssignableFrom(type))
>
> Modified:
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisLookupService.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisLookupService.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisLookupService.java
> (original)
> +++
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisLookupService.java
> Mon Dec 12 16:30:28 2005
> @@ -40,28 +40,27 @@
>
>          TypeDesc td = TypeDesc.getTypeDescForClass(cls);
>
> -        if(null != td)
> +        if(td != null)
>              return td.getXmlType();
>          else {
>              String namespace = Namespaces.makeNamespace(cls.getName());
>              if(namespace == null || namespace.endsWith
> ("DefaultNamespace"))
>                  namespace = "http://no.namespace.specified";
> -
>              return class2qname(cls, namespace);
>          }
>      }
>
>      public QName class2qname(Class cls, String namespace) {
> -        if(AxisTypeMappingMetaData.isBuiltInType(cls))
> -            return AxisTypeMappingMetaData.getBuiltInTypeQname(cls);
> -        else return new QName(namespace, Types.getLocalNameFromFullName(
> cls.getName()));
> +        QName qname = AxisTypeMappingMetaData.getBuiltInTypeQname(cls);
> +
> +        if(qname == null)
> +            qname = new QName(namespace, Types.getLocalNameFromFullName(
> cls.getName()));
> +        return qname;
>      }
>
>      public Class qname2class(QName qType) {
> -
> -        if(qType == null) {
> +        if(qType == null)
>              return null;
> -        }
>
>          /*
>           If the type has the rpc encoded namespace, lookup the class it
> maps
> @@ -84,14 +83,13 @@
>          if (Constants.URI_1999_SCHEMA_XSD.equals(qType.getNamespaceURI())
>              || Constants.URI_2000_SCHEMA_XSD.equals(qType.getNamespaceURI
> ())
>              || Constants.URI_2001_SCHEMA_XSD.equals(qType.getNamespaceURI()))
> {
> -
>              qType = stripArrayDelimiters(qType);
>              TypeMappingRegistry tmr = new TypeMappingRegistryImpl(true);
>              TypeMapping tm = (TypeMapping)tmr.getTypeMapping(
> qType.getNamespaceURI());
>              return tm.getClassForQName(qType);
>          }
>
> -        // Special case for image attachments.
> +        /* special case for Images */
>          if (Constants.NS_URI_XMLSOAP.equals(qType.getNamespaceURI())
>                  && ("Image".equals(qType.getLocalPart()) ||
> "Image[]".equals(qType.getLocalPart()))) {
>              return java.awt.Image.class;
> @@ -101,8 +99,7 @@
>          String className;
>          if(packageName != null && packageName.length() > 0)
>              className = packageName + "." + Utils.xmlNameToJavaClass(
> qType.getLocalPart());
> -        else
> -            className = Utils.xmlNameToJavaClass(qType.getLocalPart());
> +        else className = Utils.xmlNameToJavaClass(qType.getLocalPart());
>
>          Class javaType = null;
>          try {
> @@ -112,39 +109,36 @@
>              System.out.println("Unable to find the class \"" + className
> + "\".  No Axis generated classes were found for qname \"" + qType + "\"");
>          }
>
> -        if(null != javaType)
> +        if(javaType != null)
>              System.out.println("Found an Axis generated type for qname
> \"" + qType + "\" class \"" + javaType.getCanonicalName() + "\"");
>
>          return javaType;
>      }
>
>      private String getPackageNameFromQName(QName qType) {
> -        /*
> -        todo: keep a cache of previous conversions
> -        */
> +        /* todo: caching */
>          String packageName = Utils.makePackageName(qType.getNamespaceURI
> ());
>          return normalizePackageName(packageName, '.');
>      }
>
>      /**
> -     * If the type QName has been suffixed with '[]' strip the brackets
> -     * and return the new QName.
> +     * If the type QName has been suffixed with '[]' strip the brackets
> and return the new QName.
>       * @param type QName to check.
>       * @return A new QName.
>       */
>      private QName stripArrayDelimiters(QName type) {
>          if (type.getLocalPart().endsWith("[]")) {
> -            return new QName(type.getNamespaceURI(),
> -                             type.getLocalPart().substring(0,
> type.getLocalPart().length()-2));
> +            String namespaceUri = type.getNamespaceURI();
> +            String localPart = type.getLocalPart().substring(0,
> type.getLocalPart().length()-2);
> +
> +            return new QName(namespaceUri, localPart);
>          }
> -        return type;
> +        else return type;
>      }
>
>      private static String normalizePackageName(String pkg, char
> separator) {
> -
>          for(int i = 0; i < PACKAGE_SEPARATORS.length; i++)
>              pkg = pkg.replace(PACKAGE_SEPARATORS[i], separator);
> -
>          return pkg;
>      }
> }
>
> Modified:
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
> (original)
> +++
> beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/registration/AxisTypeMappingMetaData.java
> Mon Dec 12 16:30:28 2005
> @@ -32,10 +32,6 @@
>          initBuildInTypes();
>      }
>
> -    public static boolean isBuiltInType(Class cls) {
> -        return (builtInTypes.containsKey(cls));
> -    }
> -
>      public static QName getBuiltInTypeQname(Class cls) {
>          return builtInTypes.get(cls);
>      }
>
> Added:
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java?rev=356430&view=auto
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java
> (added)
> +++
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java
> Mon Dec 12 16:30:28 2005
> @@ -0,0 +1,29 @@
> +/**
> + Copyright 2004 The Apache Software Foundation.
> +
> + Licensed under the Apache License, Version 2.0 (the "License");
> + you may not use this file except in compliance with the License.
> + You may obtain a copy of the License at
> +
> + http://www.apache.org/licenses/LICENSE-2.0
> +
> + Unless required by applicable law or agreed to in writing, software
> + distributed under the License is distributed on an "AS IS" BASIS,
> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + See the License for the specific language governing permissions and
> + limitations under the License.
> +
> + $Header:$
> + */
> +package org.apache.beehive.wsm.databinding;
> +
> +import org.apache.beehive.wsm.util.SchemaTypesLookupService;
> +
> +/**
> + *
> + */
> +public class BindingLookupServiceFactory {
> +    public static BindingLookupService builtInTypes() {
> +        return new SchemaTypesLookupService();
> +    }
> +}
>
> Propchange:
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/BindingLookupServiceFactory.java
>
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Modified:
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanLookupService.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanLookupService.java?rev=356430&r1=356429&r2=356430&view=diff
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanLookupService.java
> (original)
> +++
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/databinding/xmlbeans/XmlBeanLookupService.java
> Mon Dec 12 16:30:28 2005
> @@ -39,13 +39,6 @@
>      implements BindingLookupService {
>
>      private static Log LOGGER = LogFactory.getLog(
> XmlBeanLookupService.class);
> -    private static XmlBeanLookupService THE_LOOKUP = new
> XmlBeanLookupService();
> -
> -/*
> -    public static Class q2Class(QName q) {
> -        return THE_LOOKUP.qname2class(q);
> -    }
> -*/
>
>      public QName class2qname(Class cls) {
>          if(XmlObject.class.isAssignableFrom(cls))
> @@ -54,16 +47,12 @@
>      }
>
>      public QName class2qname(Class cls, String defaultnamespace) {
> -        QName res = class2qname(cls);
> -        // for xmlbeans we can ignore default name space.
> -        return res;
> +        return class2qname(cls);
>      }
>
> -    /*
> -     *  @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
> -     */
>      public Class qname2class(QName qname) {
>          LOGGER.debug("Get XMLBeans class for Qname: " + qname);
> +
>          SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
>          SchemaType st = stl.findType(qname);
>          if(st == null) {
> @@ -75,16 +64,12 @@
>          if(st != null) {
>              Class xmlClass = st.getJavaClass();
>
> -            //String clName = xmlClass.getName();
>              if(st.isBuiltinType()) {
>                  Method[] declared = xmlClass.getDeclaredMethods();
>                  Class natural =
> scanDeclaredMethodsForViableReturnType(declared);
>                  if(natural != null)
>                      return natural;
>                  else {
> -                    // NOTE jcolwell@bea.com 2004-Nov-12 --
> -                    // XmlString declares no methods
> -
>                      if(xmlClass.isInterface()) {
>                          for(Class cl : xmlClass.getInterfaces()) {
>                              natural =
> scanDeclaredMethodsForViableReturnType(cl.getDeclaredMethods());
> @@ -113,18 +98,16 @@
>      }
>
>      private Class scanDeclaredMethodsForViableReturnType(Method[]
> declared) {
> -        /* TODO:  Does this make sense?  IT looks as if the type of the
> class is determined based on the
> -        * method return types.
> +        /*
> +        todo:  Does this make sense?  IT looks as if the type of the
> class is determined based
> +               on the method return types.
>          */
>          for(Method meth : declared) {
>              Class returnType = meth.getReturnType();
>              if(!returnType.equals(Void.TYPE)) {
>                  /*
> -                * NOTE jcolwell@bea.com 2004-Nov-12 --
> -                * built-in XmlBeans types may be of the following natural
> -                * types:
> -                * primitives, byte arrays, Strings, Calendars,
> BigIntegers
> -                * and BigDecimals
> +                built-in XmlBeans types may be of the following natural
> types:
> +                primitives, byte arrays, Strings, Calendars, BigIntegers
> and BigDecimals
>                  */
>                  if(returnType.isArray()
>                      || returnType.isPrimitive()
>
> Added:
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java
> URL:
> http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java?rev=356430&view=auto
>
> ==============================================================================
> ---
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java
> (added)
> +++
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java
> Mon Dec 12 16:30:28 2005
> @@ -0,0 +1,261 @@
> +/*
> + Copyright 2004 The Apache Software Foundation.
> +
> + Licensed under the Apache License, Version 2.0 (the "License");
> + you may not use this file except in compliance with the License.
> + You may obtain a copy of the License at
> +
> + http://www.apache.org/licenses/LICENSE-2.0
> +
> + Unless required by applicable law or agreed to in writing, software
> + distributed under the License is distributed on an "AS IS" BASIS,
> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + See the License for the specific language governing permissions and
> + limitations under the License.
> +
> + $Header:$
> + */
> +package org.apache.beehive.wsm.util;
> +
> +import java.util.HashMap;
> +import java.util.Iterator;
> +import java.util.Map;
> +import javax.xml.namespace.QName;
> +
> +import org.apache.beehive.wsm.databinding.BindingLookupService;
> +
> +/**
> + *
> + */
> +public class SchemaTypesLookupService
> +    implements BindingLookupService {
> +
> +    private static HashMap<Class, QName> SCHEMA_TYPES = new
> HashMap<Class, QName>();
> +
> +    public QName class2qname(Class clazz) {
> +        return SCHEMA_TYPES.get(clazz);
> +    }
> +
> +    public QName class2qname(Class clazz, String namespace) {
> +        return SCHEMA_TYPES.get(clazz);
> +    }
> +
> +    public Class qname2class(QName qname) {
> +        Iterator values = SCHEMA_TYPES.entrySet().iterator();
> +        while(values.hasNext()) {
> +            Map.Entry entry = (Map.Entry)values.next();
> +            if(entry.getValue().equals(qname))
> +                return (Class)entry.getKey();
> +        }
> +        return null;
> +    }
> +
> +    private static final String NS_URI_XML = "
> http://www.w3.org/XML/1998/namespace";
> +
> +    private static final String URI_1999_SCHEMA_XSD = "
> http://www.w3.org/1999/XMLSchema";
> +    private static final String URI_2000_SCHEMA_XSD = "
> http://www.w3.org/2000/10/XMLSchema";
> +    private static final String URI_2001_SCHEMA_XSD = "
> http://www.w3.org/2001/XMLSchema";
> +    private static final String URI_DEFAULT_SCHEMA_XSD =
> URI_2001_SCHEMA_XSD;
> +
> +    private static final String URI_SOAP11_ENC = "
> http://schemas.xmlsoap.org/soap/encoding/";
> +    private static final String URI_SOAP12_ENC = "
> http://www.w3.org/2003/05/soap-encoding";
> +    private static final String URI_DEFAULT_SOAP_ENC = URI_SOAP11_ENC;
> +
> +    public static final String NS_URI_XMLSOAP = "
> http://xml.apache.org/xml-soap";
> +
> +    private static final QName XSD_STRING = new
> QName(URI_DEFAULT_SCHEMA_XSD, "string");
> +    private static final QName XSD_BOOLEAN = new
> QName(URI_DEFAULT_SCHEMA_XSD, "boolean");
> +    private static final QName XSD_DOUBLE = new
> QName(URI_DEFAULT_SCHEMA_XSD, "double");
> +    private static final QName XSD_FLOAT = new
> QName(URI_DEFAULT_SCHEMA_XSD, "float");
> +    private static final QName XSD_INT = new
> QName(URI_DEFAULT_SCHEMA_XSD, "int");
> +    private static final QName XSD_INTEGER = new
> QName(URI_DEFAULT_SCHEMA_XSD, "integer");
> +    private static final QName XSD_LONG = new
> QName(URI_DEFAULT_SCHEMA_XSD, "long");
> +    private static final QName XSD_SHORT = new
> QName(URI_DEFAULT_SCHEMA_XSD, "short");
> +    private static final QName XSD_BYTE = new
> QName(URI_DEFAULT_SCHEMA_XSD, "byte");
> +    private static final QName XSD_DECIMAL = new
> QName(URI_DEFAULT_SCHEMA_XSD, "decimal");
> +    private static final QName XSD_BASE64 = new
> QName(URI_DEFAULT_SCHEMA_XSD, "base64Binary");
> +    private static final QName XSD_HEXBIN = new
> QName(URI_DEFAULT_SCHEMA_XSD, "hexBinary");
> +    private static final QName XSD_ANYSIMPLETYPE = new
> QName(URI_DEFAULT_SCHEMA_XSD, "anySimpleType");
> +    private static final QName XSD_ANYTYPE = new
> QName(URI_DEFAULT_SCHEMA_XSD, "anyType");
> +    private static final QName XSD_ANY = new
> QName(URI_DEFAULT_SCHEMA_XSD, "any");
> +    private static final QName XSD_QNAME = new
> QName(URI_DEFAULT_SCHEMA_XSD, "QName");
> +    private static final QName XSD_DATETIME = new
> QName(URI_DEFAULT_SCHEMA_XSD, "dateTime");
> +    private static final QName XSD_DATE = new
> QName(URI_DEFAULT_SCHEMA_XSD, "date");
> +    private static final QName XSD_TIME = new
> QName(URI_DEFAULT_SCHEMA_XSD, "time");
> +    private static final QName XSD_TIMEINSTANT1999 = new
> QName(URI_1999_SCHEMA_XSD, "timeInstant");
> +    private static final QName XSD_TIMEINSTANT2000 = new
> QName(URI_2000_SCHEMA_XSD, "timeInstant");
> +
> +    private static final QName XSD_NORMALIZEDSTRING = new
> QName(URI_2001_SCHEMA_XSD, "normalizedString");
> +    private static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD,
> "token");
> +
> +    private static final QName XSD_UNSIGNEDLONG = new
> QName(URI_2001_SCHEMA_XSD, "unsignedLong");
> +    private static final QName XSD_UNSIGNEDINT = new
> QName(URI_2001_SCHEMA_XSD, "unsignedInt");
> +    private static final QName XSD_UNSIGNEDSHORT = new
> QName(URI_2001_SCHEMA_XSD, "unsignedShort");
> +    private static final QName XSD_UNSIGNEDBYTE = new
> QName(URI_2001_SCHEMA_XSD, "unsignedByte");
> +    private static final QName XSD_POSITIVEINTEGER = new
> QName(URI_2001_SCHEMA_XSD, "positiveInteger");
> +    private static final QName XSD_NEGATIVEINTEGER = new
> QName(URI_2001_SCHEMA_XSD, "negativeInteger");
> +    private static final QName XSD_NONNEGATIVEINTEGER = new
> QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
> +    private static final QName XSD_NONPOSITIVEINTEGER = new
> QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
> +
> +    private static final QName XSD_YEARMONTH = new
> QName(URI_2001_SCHEMA_XSD, "gYearMonth");
> +    private static final QName XSD_MONTHDAY = new
> QName(URI_2001_SCHEMA_XSD, "gMonthDay");
> +    private static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD,
> "gYear");
> +    private static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD,
> "gMonth");
> +    private static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD,
> "gDay");
> +    private static final QName XSD_DURATION = new
> QName(URI_2001_SCHEMA_XSD, "duration");
> +
> +    private static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD,
> "Name");
> +    private static final QName XSD_NCNAME = new
> QName(URI_2001_SCHEMA_XSD, "NCName");
> +    private static final QName XSD_NMTOKEN = new
> QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
> +    private static final QName XSD_NMTOKENS = new
> QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
> +    private static final QName XSD_NOTATION = new
> QName(URI_2001_SCHEMA_XSD, "NOTATION");
> +    private static final QName XSD_ENTITY = new
> QName(URI_2001_SCHEMA_XSD, "ENTITY");
> +    private static final QName XSD_ENTITIES = new
> QName(URI_2001_SCHEMA_XSD, "ENTITIES");
> +    private static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD,
> "IDREF");
> +    private static final QName XSD_IDREFS = new
> QName(URI_2001_SCHEMA_XSD, "IDREFS");
> +    private static final QName XSD_ANYURI = new
> QName(URI_2001_SCHEMA_XSD, "anyURI");
> +    private static final QName XSD_LANGUAGE = new
> QName(URI_2001_SCHEMA_XSD, "language");
> +    private static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD,
> "ID");
> +    private static final QName XSD_SCHEMA = new
> QName(URI_2001_SCHEMA_XSD, "schema");
> +
> +    private static final QName XML_LANG = new QName(NS_URI_XML, "lang");
> +
> +    private static final QName SOAP_BASE64 = new
> QName(URI_DEFAULT_SOAP_ENC, "base64");
> +    private static final QName SOAP_BASE64BINARY = new
> QName(URI_DEFAULT_SOAP_ENC, "base64Binary");
> +    private static final QName SOAP_STRING = new
> QName(URI_DEFAULT_SOAP_ENC, "string");
> +    private static final QName SOAP_BOOLEAN = new
> QName(URI_DEFAULT_SOAP_ENC, "boolean");
> +    private static final QName SOAP_DOUBLE = new
> QName(URI_DEFAULT_SOAP_ENC, "double");
> +    private static final QName SOAP_FLOAT = new
> QName(URI_DEFAULT_SOAP_ENC, "float");
> +    private static final QName SOAP_INT = new QName(URI_DEFAULT_SOAP_ENC,
> "int");
> +    private static final QName SOAP_LONG = new
> QName(URI_DEFAULT_SOAP_ENC, "long");
> +    private static final QName SOAP_SHORT = new
> QName(URI_DEFAULT_SOAP_ENC, "short");
> +    private static final QName SOAP_BYTE = new
> QName(URI_DEFAULT_SOAP_ENC, "byte");
> +    private static final QName SOAP_INTEGER = new
> QName(URI_DEFAULT_SOAP_ENC, "integer");
> +    private static final QName SOAP_DECIMAL = new
> QName(URI_DEFAULT_SOAP_ENC, "decimal");
> +    private static final QName SOAP_ARRAY = new
> QName(URI_DEFAULT_SOAP_ENC, "Array");
> +    private static final QName SOAP_COMMON_ATTRS11 = new
> QName(URI_SOAP11_ENC, "commonAttributes");
> +    private static final QName SOAP_COMMON_ATTRS12 = new
> QName(URI_SOAP12_ENC, "commonAttributes");
> +    private static final QName SOAP_ARRAY_ATTRS11 = new
> QName(URI_SOAP11_ENC, "arrayAttributes");
> +    private static final QName SOAP_ARRAY_ATTRS12 = new
> QName(URI_SOAP12_ENC, "arrayAttributes");
> +    private static final QName SOAP_ARRAY12 = new QName(URI_SOAP12_ENC,
> "Array");
> +
> +    // unsupported since they're bound to Axis
> +    /*
> +    private static final QName SOAP_MAP = new QName(NS_URI_XMLSOAP,
> "Map");
> +    private static final QName SOAP_ELEMENT = new QName(NS_URI_XMLSOAP,
> "Element");
> +    private static final QName SOAP_DOCUMENT = new QName(NS_URI_XMLSOAP,
> "Document");
> +    private static final QName SOAP_VECTOR = new QName(NS_URI_XMLSOAP,
> "Vector");
> +    */
> +
> +    static {
> +        addBuiltInType(XSD_HEXBIN, byte[].class);
> +        addBuiltInType(XSD_BYTE, byte[].class);
> +        addBuiltInType(XSD_BASE64, byte[].class);
> +        // anySimpleType is mapped to java.lang.String according to
> JAX-RPC 1.1 spec.
> +        addBuiltInType(XSD_ANYSIMPLETYPE, java.lang.String.class);
> +        // If SOAP 1.1 over the wire, map wrapper classes to XSD
> primitives.
> +        addBuiltInType(XSD_STRING, java.lang.String.class);
> +        addBuiltInType(XSD_BOOLEAN, java.lang.Boolean.class);
> +        addBuiltInType(XSD_DOUBLE, java.lang.Double.class);
> +        addBuiltInType(XSD_FLOAT, java.lang.Float.class);
> +        addBuiltInType(XSD_INT, java.lang.Integer.class);
> +        addBuiltInType(XSD_INTEGER, java.math.BigInteger.class);
> +        addBuiltInType(XSD_DECIMAL, java.math.BigDecimal.class);
> +        addBuiltInType(XSD_LONG, java.lang.Long.class);
> +        addBuiltInType(XSD_SHORT, java.lang.Short.class);
> +        addBuiltInType(XSD_BYTE, java.lang.Byte.class);
> +        // The XSD Primitives are mapped to java primitives.
> +        addBuiltInType(XSD_BOOLEAN, boolean.class);
> +        addBuiltInType(XSD_DOUBLE, double.class);
> +        addBuiltInType(XSD_FLOAT, float.class);
> +        addBuiltInType(XSD_INT, int.class);
> +        addBuiltInType(XSD_LONG, long.class);
> +        addBuiltInType(XSD_SHORT, short.class);
> +        addBuiltInType(XSD_BYTE, byte.class);
> +        // Map QNAME to the jax rpc QName class
> +        addBuiltInType(XSD_QNAME, javax.xml.namespace.QName.class);
> +        // The closest match for anytype is Object
> +        addBuiltInType(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(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(XSD_DATETIME, java.util.Date.class);
> +        addBuiltInType(XSD_DATETIME, java.util.Calendar.class);
> +
> +        addBuiltInType(SOAP_ARRAY, java.util.ArrayList.class);
> +
> +        /* Axis types */
> +        /*
> +        addBuiltInType(XSD_HEXBIN, HexBinary.class);
> +        // Mapping for xsd:time. Map to Axis type Time
> +        addBuiltInType(XSD_TIME, org.apache.axis.types.Time.class);
> +        // These are the g* types (gYearMonth, etc) which map to Axis
> types
> +        addBuiltInType(XSD_YEARMONTH,
> org.apache.axis.types.YearMonth.class);
> +        addBuiltInType(XSD_YEAR, org.apache.axis.types.Year.class);
> +        addBuiltInType(XSD_MONTH, org.apache.axis.types.Month.class);
> +        addBuiltInType(XSD_DAY, org.apache.axis.types.Day.class);
> +        addBuiltInType(XSD_MONTHDAY, org.apache.axis.types.MonthDay.class
> );
> +        */
> +
> +        /* Axis custom types */
> +        /*
> +        // Serialize all extensions of Map to SOAP_MAP Order counts here,
> HashMap should be last.
> +        addBuiltInType(SOAP_MAP, java.util.Hashtable.class);
> +        addBuiltInType(SOAP_MAP, java.util.Map.class);
> +        // The SOAP_MAP will be deserialized into a HashMap by default.
> +        addBuiltInType(SOAP_MAP, java.util.HashMap.class);
> +
> +        // Use the Element Serializeration for elements
> +        addBuiltInType(SOAP_ELEMENT, org.w3c.dom.Element.class);
> +
> +        // Use the Document Serializeration for Document's
> +        addBuiltInType(SOAP_DOCUMENT, org.w3c.dom.Document.class);
> +
> +        addBuiltInType(SOAP_VECTOR, java.util.Vector.class);
> +        */
> +        /* attachment support */
> +        /*
> +        if (JavaUtils.isAttachmentSupported()) {
> +            addBuiltInType(MIME_IMAGE, java.awt.Image.class);
> +            addBuiltInType(MIME_MULTIPART,
> javax.mail.internet.MimeMultipart.class);
> +            addBuiltInType(MIME_SOURCE, javax.xml.transform.Source.class
> );
> +            addBuiltInType(MIME_OCTETSTREAM, OctetStream.class);
> +            addBuiltInType(MIME_DATA_HANDLER,
> javax.activation.DataHandler.class);
> +        }
> +        */
> +
> +        /*
> +        addBuiltInType(XSD_TOKEN, org.apache.axis.types.Token.class);
> +        addBuiltInType(XSD_NORMALIZEDSTRING,
> org.apache.axis.types.NormalizedString.class);
> +        addBuiltInType(XSD_UNSIGNEDLONG,
> org.apache.axis.types.UnsignedLong.class);
> +        addBuiltInType(XSD_UNSIGNEDINT,
> org.apache.axis.types.UnsignedInt.class);
> +        addBuiltInType(XSD_UNSIGNEDSHORT,
> org.apache.axis.types.UnsignedShort.class);
> +        addBuiltInType(XSD_UNSIGNEDBYTE,
> org.apache.axis.types.UnsignedByte.class);
> +        addBuiltInType(XSD_NONNEGATIVEINTEGER,
> org.apache.axis.types.NonNegativeInteger.class);
> +        addBuiltInType(XSD_NEGATIVEINTEGER,
> org.apache.axis.types.NegativeInteger.class);
> +        addBuiltInType(XSD_POSITIVEINTEGER,
> org.apache.axis.types.PositiveInteger.class);
> +        addBuiltInType(XSD_NONPOSITIVEINTEGER,
> org.apache.axis.types.NonPositiveInteger.class);
> +        addBuiltInType(XSD_NAME, org.apache.axis.types.Name.class);
> +        addBuiltInType(XSD_NCNAME, org.apache.axis.types.NCName.class);
> +        addBuiltInType(XSD_ID, org.apache.axis.types.Id.class);
> +        addBuiltInType(XML_LANG, org.apache.axis.types.Language.class);
> +        addBuiltInType(XSD_LANGUAGE, org.apache.axis.types.Language.class
> );
> +        addBuiltInType(XSD_NMTOKEN, org.apache.axis.types.NMToken.class);
> +        addBuiltInType(XSD_NMTOKENS, org.apache.axis.types.NMTokens.class
> );
> +        addBuiltInType(XSD_NOTATION, org.apache.axis.types.Notation.class
> );
> +        addBuiltInType(XSD_ENTITY, org.apache.axis.types.Entity.class);
> +        addBuiltInType(XSD_ENTITIES, org.apache.axis.types.Entities.class
> );
> +        addBuiltInType(XSD_IDREF, org.apache.axis.types.IDRef.class);
> +        addBuiltInType(XSD_IDREFS, org.apache.axis.types.IDRefs.class);
> +        addBuiltInType(XSD_DURATION, org.apache.axis.types.Duration.class
> );
> +        addBuiltInType(XSD_ANYURI, org.apache.axis.types.URI.class);
> +        addBuiltInType(XSD_SCHEMA, org.apache.axis.types.Schema.class);
> +        */
> +    }
> +
> +    private static void addBuiltInType(QName qname, Class clazz) {
> +        SCHEMA_TYPES.put(clazz, qname);
> +    }
> +}
> \ No newline at end of file
>
> Propchange:
> beehive/trunk/wsm/src/core/org/apache/beehive/wsm/util/SchemaTypesLookupService.java
>
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message