axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/message EnvelopeHandler.java MessageElement.java
Date Sun, 22 Jul 2001 05:57:22 GMT
gdaniels    01/07/21 22:57:22

  Modified:    java/src/org/apache/axis/encoding
                        DeserializationContext.java
               java/src/org/apache/axis/handlers DebugHandler.java
               java/src/org/apache/axis/message EnvelopeHandler.java
                        MessageElement.java
  Log:
  Finish getValueAsType() support for MessageElements.
  
  Note also that EnvelopeHandler is now a generic "container" SOAPHandler
  who simply defers to an internal handler on the first child notification that
  it receives.  This is used by getValueAsType() to publish the recorded
  MessageElement events through the deserialization context.
  
  Turn the functionality of the DebugHandler back on.
  
  Revision  Changes    Path
  1.18      +1 -1      xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
  
  Index: DeserializationContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DeserializationContext.java	2001/07/16 17:36:59	1.17
  +++ DeserializationContext.java	2001/07/22 05:57:22	1.18
  @@ -128,7 +128,7 @@
           envelope.setRecorder(recorder);
           envelope.setMessageType(messageType);
           
  -        pushElementHandler(new EnvelopeHandler());
  +        pushElementHandler(new EnvelopeHandler(new EnvelopeBuilder()));
       }
       
       public DeserializationContext(InputSource is, MessageContext ctx, 
  
  
  
  1.18      +6 -6      xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java
  
  Index: DebugHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DebugHandler.java	2001/07/15 16:40:07	1.17
  +++ DebugHandler.java	2001/07/22 05:57:22	1.18
  @@ -81,15 +81,15 @@
                                                           "Debug");
               
               if (header != null) {
  -                /*
  -                int debugVal = 
  -                      ((Integer)header
  -                             .getValueAsType(SOAPTypeMappingRegistry.XSD_INT))
  -                      .intValue();
  +                Integer i = ((Integer)header
  +                             .getValueAsType(SOAPTypeMappingRegistry.XSD_INT));
  +                if (i == null)
  +                    throw new AxisFault("Couldn't convert value to int");
  +                
  +                int debugVal = i.intValue();
                   Debug.Print( 1, "Setting debug level to: " + debugVal );
                   Debug.setDebugLevel(debugVal);
                   header.setProcessed(true);
  -                */
               }
           }
           catch( Exception e ) {
  
  
  
  1.3       +8 -1      xml-axis/java/src/org/apache/axis/message/EnvelopeHandler.java
  
  Index: EnvelopeHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/EnvelopeHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EnvelopeHandler.java	2001/07/16 17:37:02	1.2
  +++ EnvelopeHandler.java	2001/07/22 05:57:22	1.3
  @@ -13,6 +13,13 @@
   
   public class EnvelopeHandler extends SOAPHandler
   {
  +    SOAPHandler realHandler;
  +    
  +    public EnvelopeHandler(SOAPHandler realHandler)
  +    {
  +        this.realHandler = realHandler;
  +    }
  +    
       public SOAPHandler onStartChild(String namespace,
                                       String localName,
                                       String prefix,
  @@ -20,6 +27,6 @@
                                       DeserializationContext context)
           throws SAXException
       {
  -        return new EnvelopeBuilder();
  +        return realHandler;
       }
   }
  
  
  
  1.36      +17 -5     xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- MessageElement.java	2001/07/20 22:14:28	1.35
  +++ MessageElement.java	2001/07/22 05:57:22	1.36
  @@ -65,6 +65,7 @@
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.SOAPTypeMappingRegistry;
  +import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.MessageContext;
   import org.apache.axis.utils.Debug;
   import org.apache.axis.utils.QName;
  @@ -88,8 +89,6 @@
       
       protected DeserializationContext context;
       
  -    // The java Object value of this element.  This is either set by
  -    // deserialization, or by the user creating a message.
       protected QName typeQName = null;
       
       protected Vector qNameAttrs = null;
  @@ -194,10 +193,23 @@
       public SAX2EventRecorder getRecorder() { return recorder; }
       public void setRecorder(SAX2EventRecorder rec) { recorder = rec; }
       
  -    public Object getValueAsType(QName type)
  +    public Object getValueAsType(QName type) throws Exception
       {
  -        // !!! TODO : Implement
  -        return null;
  +        if (context == null)
  +            throw new Exception(
  +             "No deserialization context to use in getValueAsType()!");
  +        
  +        TypeMappingRegistry tmr = context.getTypeMappingRegistry();
  +        Deserializer dser = tmr.getDeserializer(type);
  +        if (dser == null)
  +            throw new Exception("No deserializer for requested type " +
  +                                type);
  +        
  +        context.pushElementHandler(new EnvelopeHandler(dser));
  +        
  +        publishToHandler(context);
  +        
  +        return dser.getValue();
       }
       
       protected static class QNameAttr {
  
  
  

Mime
View raw message