antelder    2002/06/12 08:35:38

  Modified:    java/src/org/apache/wsif/util/jms WSIFJMSDestination.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSIFOperation_ApacheAxis.java
               java/test/async AsyncTest.java
               java/src/org/apache/wsif/providers/soap/apachesoap
                        WSIFOperation_ApacheSOAP.java
                        SOAPJMSConnection.java
               java/src/org/apache/wsif WSIFConstants.java
               java/test/addressbook AddressBookTest.java
  Log:
  Allow setting JMS input properties from the context message
  
  Revision  Changes    Path
  1.4       +1 -1      
xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSDestination.java
  
  Index: WSIFJMSDestination.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSDestination.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSIFJMSDestination.java   10 Jun 2002 17:03:53 -0000      1.3
  +++ WSIFJMSDestination.java   12 Jun 2002 15:35:38 -0000      1.4
  @@ -453,7 +453,7 @@
        * Sets a HashMap of JMS property value pairs. The property values will be only 
        * be used for the next message that is sent, then all the properties will be 
reset.
        */
  -    public void setProperties(HashMap propMap) throws WSIFException {
  +    public void setProperties(HashMap propMap) {
           Tr.entry(this, propMap);
           if (propMap != null && !propMap.isEmpty())
               inProps.putAll(propMap);
  
  
  
  1.6       +34 -11    
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java
  
  Index: WSIFOperation_ApacheAxis.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFOperation_ApacheAxis.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WSIFOperation_ApacheAxis.java     12 Jun 2002 10:27:25 -0000      1.5
  +++ WSIFOperation_ApacheAxis.java     12 Jun 2002 15:35:38 -0000      1.6
  @@ -93,6 +93,7 @@
   import org.apache.wsif.WSIFOperation;
   import org.apache.wsif.WSIFResponseHandler;
   import org.apache.wsif.base.WSIFDefaultOperation;
  +import org.apache.wsif.base.WSIFDefaultMessage;
   import org.apache.wsif.base.WSIFServiceImpl;
   import org.apache.wsif.logging.Tr;
   import org.apache.wsif.providers.WSIFDynamicTypeMap;
  @@ -593,6 +594,8 @@
               return false;
           }
   
  +        // setJMSOutPropsInContext( dest ); TODO doesn't work yet
  +        
           if (!isAsyncOperation() && returnType != null) {
               return buildResponseMessages(response, wsifmessage1, wsifmessage2);
           }
  @@ -862,23 +865,43 @@
       }
   
       /**
  -     * This sets up any context property values in the Destination
  +     * This sets up the output JMS property values in the context
  +     */
  +    private void setJMSOutPropsInContext(WSIFJMSDestination dest) throws 
WSIFException {
  +       if ( dest == null ) {
  +          return;
  +       }
  +       HashMap props = dest.getProperties();
  +       if ( props != null ) {
  +          if ( context == null ) {
  +             context = new WSIFDefaultMessage();
  +          }
  +          context.setParts( props );
  +       }
  +    }
  +    
  +    /**
  +     * This sets up any context JMS property values in the Destination
        */
       private void setDestinationContext(WSIFJMSDestination dest) {
          if ( context == null 
          || dest == null ) {
             return;
          }
  -
  -       Object o;
  -
  -       try {
  -          o = context.getObjectPart( WSIFConstants.CONTEXT_JMS_REPLYTO );
  -          if ( o instanceof String ) {
  -             dest.setProperty( WSIFConstants.JMS_REPLYTO, (String)o );
  -          }                  
  -       } catch (WSIFException ex) {} // ignore 
  -       
  +       String partName;
  +       HashMap jmsProps = new HashMap();
  +       for (Iterator i = context.getPartNames(); i.hasNext(); ) {
  +          partName = (String)i.next();
  +          if ( partName.startsWith( WSIFConstants.CONTEXT_JMS_PREFIX ) ) {
  +             try {
  +                jmsProps.put( partName.substring( 
WSIFConstants.CONTEXT_JMS_PREFIX.length() ), 
  +                              context.getObjectPart( partName ) );
  +             } catch (WSIFException ex) {}
  +          } 
  +       }
  +       if ( jmsProps.size() > 0 ) {
  +          dest.setProperties( jmsProps );
  +       }
       }
   
       /**
  
  
  
  1.8       +1 -1      xml-axis-wsif/java/test/async/AsyncTest.java
  
  Index: AsyncTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/async/AsyncTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AsyncTest.java    12 Jun 2002 10:27:24 -0000      1.7
  +++ AsyncTest.java    12 Jun 2002 15:35:38 -0000      1.8
  @@ -182,7 +182,7 @@
   
           AsyncResponseHandler quoteHandler = new AsyncResponseHandler(2); // 2 async 
calls
           WSIFMessage context = new WSIFDefaultMessage();
  -        context.setObjectPart( WSIFConstants.CONTEXT_JMS_REPLYTO, 
  +        context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo", 
                                  TestUtilities.getWsifProperty("wsif.async.replytoq") 
);
   
           // First do an async call to get a real quote from the remote service, ie 
slow
  
  
  
  1.5       +33 -11    
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java
  
  Index: WSIFOperation_ApacheSOAP.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WSIFOperation_ApacheSOAP.java     12 Jun 2002 10:27:25 -0000      1.4
  +++ WSIFOperation_ApacheSOAP.java     12 Jun 2002 15:35:38 -0000      1.5
  @@ -98,6 +98,7 @@
   import org.apache.wsif.WSIFOperation;
   import org.apache.wsif.WSIFResponseHandler;
   import org.apache.wsif.base.WSIFDefaultOperation;
  +import org.apache.wsif.base.WSIFDefaultMessage;
   import org.apache.wsif.base.WSIFServiceImpl;
   import org.apache.wsif.logging.MessageLogger;
   import org.apache.wsif.logging.Tr;
  @@ -594,6 +595,8 @@
                   e);
           }
   
  +        // setJMSOutPropsInContext( st ); TODO doesn't work yet
  +
           if (resp.generatedFault()) {
               if (fault != null) {
                   org.apache.soap.Fault soapFault = resp.getFault();
  @@ -1287,6 +1290,22 @@
       }
   
       /**
  +     * This sets up the output JMS property values in the context
  +     */
  +    private void setJMSOutPropsInContext(SOAPTransport t) throws WSIFException {
  +       if ( !(t instanceof SOAPJMSConnection) ) {
  +          return;
  +       }
  +       HashMap props = ((SOAPJMSConnection)t).getJmsProperties();
  +       if ( props != null ) {
  +          if ( context == null ) {
  +             context = new WSIFDefaultMessage();
  +          }
  +          context.setParts( props );
  +       }
  +    }
  +    
  +    /**
        * This sets up any context property values in the transport
        */
       private void setTransportContext(SOAPTransport t) {
  @@ -1294,17 +1313,20 @@
          || !(t instanceof SOAPJMSConnection) ) {
             return;
          }
  -
  -       Object o;
  -       SOAPJMSConnection st = (SOAPJMSConnection) t;
  -
  -       try {
  -          o = context.getObjectPart( WSIFConstants.CONTEXT_JMS_REPLYTO );
  -          if ( o instanceof String ) {
  -             st.setJmsProperty( WSIFConstants.JMS_REPLYTO, (String)o );
  -          }                  
  -       } catch (WSIFException ex) {} // ignore 
  -       
  +       String partName;
  +       HashMap jmsProps = new HashMap();
  +       for (Iterator i = context.getPartNames(); i.hasNext(); ) {
  +          partName = (String)i.next();
  +          if ( partName.startsWith( WSIFConstants.CONTEXT_JMS_PREFIX ) ) {
  +             try {
  +                jmsProps.put( partName.substring( 
WSIFConstants.CONTEXT_JMS_PREFIX.length() ), 
  +                              context.getObjectPart( partName ) );
  +             } catch (WSIFException ex) {}
  +          } 
  +       }
  +       if ( jmsProps.size() > 0 ) {
  +          ((SOAPJMSConnection) t).setJmsProperties( jmsProps );
  +       }
       }
   
       /**
  
  
  
  1.3       +8 -1      
xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/SOAPJMSConnection.java
  
  Index: SOAPJMSConnection.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/SOAPJMSConnection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SOAPJMSConnection.java    10 Jun 2002 17:03:53 -0000      1.2
  +++ SOAPJMSConnection.java    12 Jun 2002 15:35:38 -0000      1.3
  @@ -239,10 +239,17 @@
           Tr.exit();
       }
   
  -    public void setJmsProperties(HashMap hm) throws WSIFException { 
  +    public void setJmsProperties(HashMap hm) { 
           Tr.entry(this,hm);
           destination.setProperties(hm);  
           Tr.exit();
  +    }
  +
  +    public HashMap getJmsProperties() throws WSIFException { 
  +        Tr.entry(this);
  +        HashMap hm = destination.getProperties();  
  +        Tr.exit(hm);
  +        return hm;  
       }
   
       void close() throws WSIFException {
  
  
  
  1.4       +2 -5      xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java
  
  Index: WSIFConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSIFConstants.java        11 Jun 2002 15:09:23 -0000      1.3
  +++ WSIFConstants.java        12 Jun 2002 15:35:38 -0000      1.4
  @@ -121,11 +121,8 @@
       public static final String CONTEXT_SOAP_HEADERS =
           "org.apache.wsif.soap.RequestHeaders";
   
  -    // WSIF context part name for JMSProperty.JMSReplyTo
  -    public static final String CONTEXT_JMS_REPLYTO = "JMSProperty.JMSReplyTo";
  -
  -    // WSIF JMS Property JMSReplyTo
  -    public static final String JMS_REPLYTO = "JMSReplyTo";
  +    // WSIF context part name prefix for JMSProperties
  +    public static final String CONTEXT_JMS_PREFIX = "JMSProperty.";
   
       // SOAP faults WSIFMessage part name for the fault code
       public static final String SOAP_FAULT_MSG_NAME =
  
  
  
  1.4       +1 -1      xml-axis-wsif/java/test/addressbook/AddressBookTest.java
  
  Index: AddressBookTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/addressbook/AddressBookTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AddressBookTest.java      12 Jun 2002 10:27:25 -0000      1.3
  +++ AddressBookTest.java      12 Jun 2002 15:35:38 -0000      1.4
  @@ -312,7 +312,7 @@
               WSIFMessage faultMsg = op.createFaultMessage();
   
               WSIFMessage context = new WSIFDefaultMessage();
  -            context.setObjectPart( WSIFConstants.CONTEXT_JMS_REPLYTO, 
  +            context.setObjectPart( WSIFConstants.CONTEXT_JMS_PREFIX + "JMSReplyTo", 
                                      
TestUtilities.getWsifProperty("wsif.async.replytoq") );
               op.setContext( context );
   
  
  
  


Reply via email to