You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wh...@apache.org on 2002/08/27 12:24:08 UTC

cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis WSIFPort_ApacheAxis.java

whitlock    2002/08/27 03:24:08

  Modified:    java/src/org/apache/wsif/providers/soap/apachesoap
                        SOAPJMSConnection.java WSIFPort_ApacheSOAP.java
               java/src/org/apache/wsif/util/jms WSIFJMSFinderForJndi.java
                        WSIFJMSFinder.java JMS2HTTPBridge.java
               java/test/org/apache/wsif/util/jms
                        NativeJMSRequestListener.java JMSAsyncListener.java
               java/src/org/apache/wsif/providers/jms
                        WSIFOperation_Jms.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSIFPort_ApacheAxis.java
  Log:
  Improve WSIFExceptions and error checking
  
  Revision  Changes    Path
  1.8       +3 -3      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SOAPJMSConnection.java	7 Aug 2002 15:10:25 -0000	1.7
  +++ SOAPJMSConnection.java	27 Aug 2002 10:24:07 -0000	1.8
  @@ -101,11 +101,11 @@
       private static final String DUMMY_RESPONSE =
           "<?xml version='1.0' encoding='UTF-8'?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">\n<SOAP-ENV:Body>\n<ns1:addEntryResponse xmlns:ns1=\"http://wsifservice.addressbook/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n</ns1:addEntryResponse>\n\n</SOAP-ENV:Body>\n</SOAP-ENV:Envelope>";
   
  -    public SOAPJMSConnection(JMSAddress ja) throws WSIFException {
  -        Trc.entry(this, ja);
  +    public SOAPJMSConnection(JMSAddress ja, String portName) throws WSIFException {
  +        Trc.entry(this, ja, portName);
           destination =
               new WSIFJMSDestination(
  -                WSIFJMSFinder.newFinder(ja),
  +                WSIFJMSFinder.newFinder(ja,portName),
                   ja.getJmsProvDestName(),
                   WSIFProperties.getSyncTimeout());
           Trc.exit(ja);
  
  
  
  1.15      +1 -1      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java
  
  Index: WSIFPort_ApacheSOAP.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WSIFPort_ApacheSOAP.java	19 Aug 2002 10:32:45 -0000	1.14
  +++ WSIFPort_ApacheSOAP.java	27 Aug 2002 10:24:07 -0000	1.15
  @@ -166,7 +166,7 @@
           if (ja != null) {
               // Port jms:address binding element
               jmsAddressPropVals = ja.getJMSPropertyValues();
  -            st = new SOAPJMSConnection(ja);
  +            st = new SOAPJMSConnection(ja, port.getName());
           } else {
               // Port soap:address bindng element
               st = new SOAPHTTPConnection();
  
  
  
  1.7       +53 -19    xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSFinderForJndi.java
  
  Index: WSIFJMSFinderForJndi.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSFinderForJndi.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSIFJMSFinderForJndi.java	8 Aug 2002 11:55:04 -0000	1.6
  +++ WSIFJMSFinderForJndi.java	27 Aug 2002 10:24:07 -0000	1.7
  @@ -79,6 +79,7 @@
       private QueueConnectionFactory factory;
       private Destination initialDestination = null;
       private String style;
  +    private String portName;
   
       /**
        * Package private constructor.
  @@ -96,7 +97,8 @@
           String jndiProviderURL,
           String style,
           String jndiConnectionFactory,
  -        String jndiDestinationName)
  +        String jndiDestinationName,
  +        String portName)
           throws WSIFException {
           Trc.entry(
               this,
  @@ -105,17 +107,22 @@
               jndiProviderURL,
               style,
               jndiConnectionFactory,
  -            jndiDestinationName);
  +            jndiDestinationName,
  +            portName);
   
           if (!allStyles.contains(style))
               throw new WSIFException("Style must either be queue or topic");
           this.style = style;
  +        if (portName == null)
  +            portName = "<null>";
  +        this.portName = portName;
   
           if (((initialContextFactory == null) && (jndiProviderURL != null))
               || ((initialContextFactory != null) && (jndiProviderURL == null)))
               throw new WSIFException(
                   "Either both initialContextFactory and jndiProviderURL "
  -                    + "must be specified or neither of them must be specified");
  +                    + "must be specified or neither of them must be specified. Port="
  +                    + portName);
   
           if (initialContextFactory != null && jndiProviderURL != null) {
               Hashtable environment = new Hashtable();
  @@ -133,7 +140,8 @@
                           + initialContextFactory
                           + "' ProviderUrl was '"
                           + jndiProviderURL
  -                        + "'");
  +                        + "'. Port="
  +                        + portName);
               }
           } 
   
  @@ -145,38 +153,48 @@
                   throw new WSIFException(
                       "WSIFJMSFinderForJndi caught '"
                           + ne
  -                        + "' using the default JNDI repository.");
  +                        + "' using the default JNDI repository. Port="
  +                        + portName);
           }
   
           if (STYLE_TOPIC.equals(style))
  -            throw new WSIFException("Topics not implemented");
  +            throw new WSIFException("Topics not implemented. Port=" + portName);
           else if (!STYLE_QUEUE.equals(style))
               throw new WSIFException(
                   "jms:address must either be a queue or a topic not a '"
                       + (style == null ? "null" : style)
  -                    + "'");
  +                    + "'. Port="
  +                    + portName);
   
           if (jndiConnectionFactory == null)
  -            throw new WSIFException("jndiConnectionFactory must be specified");
  +            throw new WSIFException(
  +                "jndiConnectionFactory must be specified in port " + portName);
           try {
               factory = (QueueConnectionFactory) lookup(jndiConnectionFactory);
               if (factory == null)
                   throw new WSIFException(
                       "WSIFJMSFinderForJndi was not able to lookup the ConnectionFactory "
                           + jndiConnectionFactory
  -                        + " in JNDI.");
  +                        + " in JNDI. Port="
  +                        + portName);
           } catch (ClassCastException cce) {
           	Trc.exception(cce);
               throw new WSIFException(
                   "WSIFJMSFinderForJndi caught ClassCastException. The ConnectionFactory "
                       + jndiConnectionFactory
  -                    + " in JNDI was not defined to be a connection factory.");
  +                    + " in JNDI was not defined to be a connection factory. Port="
  +                    + portName
  +                    + " "
  +                    + cce);
           } catch (NamingException ne) {
           	Trc.exception(ne);
               throw new WSIFException(
                   "WSIFJMSFinderForJndi caught NamingException. The ConnectionFactory "
                       + jndiConnectionFactory
  -                    + " in JNDI was not defined to be a connection factory.");
  +                    + " in JNDI was not defined to be a connection factory. Port="
  +                    + portName
  +                    + " "
  +                    + ne);
           }
   
           if (jndiDestinationName != null)
  @@ -186,19 +204,26 @@
                       throw new WSIFException(
                           "WSIFJMSFinderForJndi was not able to lookup the Destination "
                               + jndiDestinationName
  -                            + " in JNDI.");
  +                            + " in JNDI. Port="
  +                            + portName);
               } catch (ClassCastException cce) {
   	        	Trc.exception(cce);
                   throw new WSIFException(
                       "WSIFJMSFinderForJndi caught ClassCastException. The Destination "
                           + jndiDestinationName
  -                        + " in JNDI was not defined to be a destination.");
  +                        + " in JNDI was not defined to be a destination. Port="
  +                        + portName
  +                        + " "
  +                        + cce);
               } catch (NamingException cce) {
   	        	Trc.exception(cce);
                   throw new WSIFException(
                       "WSIFJMSFinderForJndi caught NamingException. The Destination "
                           + jndiDestinationName
  -                        + " in JNDI was not defined to be a destination.");
  +                        + " in JNDI was not defined to be a destination. Port="
  +                        + portName
  +                        + " "
  +                        + cce);
               }
           if (Trc.ON)
               Trc.exit(deep());
  @@ -231,19 +256,26 @@
                   throw new WSIFException(
                       "WSIFJMSFinderForJndi was not able to lookup the Destination "
                           + name
  -                        + " in JNDI.");
  +                        + " in JNDI.Port="
  +                        + portName);
           } catch (ClassCastException cce) {
           	Trc.exception(cce);
               throw new WSIFException(
                   "WSIFJMSFinderForJndi caught ClassCastException. The Queue "
                       + name
  -                    + " in JNDI was not defined to be a queue.");
  -        } catch (NamingException cce) {
  -        	Trc.exception(cce);
  +                    + " in JNDI was not defined to be a queue. Port="
  +                    + portName
  +                    + " "
  +                    + cce);
  +        } catch (NamingException ne) {
  +        	Trc.exception(ne);
               throw new WSIFException(
                   "WSIFJMSFinderForJndi caught NamingException. The Queue "
                       + name
  -                    + " in JNDI was not defined to be a queue.");
  +                    + " in JNDI was not defined to be a queue. Port="
  +                    + portName
  +                    + " "
  +                    + ne);
           }
           Trc.exit(q);
           return q;
  @@ -296,9 +328,11 @@
           try {
           	result = lookupJNDIName("java:comp/env/" + name);
           } catch (NamingException ignored) {
  +        	Trc.exception(ignored);
           	try {
   	        	result = lookupJNDIName(name);
           	} catch (NamingException ne) {
  +        		Trc.exception(ne);
   				throw ne;
               }
           }
  
  
  
  1.4       +9 -5      xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSFinder.java
  
  Index: WSIFJMSFinder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/WSIFJMSFinder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WSIFJMSFinder.java	19 Jul 2002 15:46:29 -0000	1.3
  +++ WSIFJMSFinder.java	27 Aug 2002 10:24:07 -0000	1.4
  @@ -88,7 +88,7 @@
       abstract Queue findQueue(String name) throws WSIFException;
       abstract String getStyle();
   
  -    public static WSIFJMSFinder newFinder(JMSAddress ja) throws WSIFException {
  +    public static WSIFJMSFinder newFinder(JMSAddress ja, String portName) throws WSIFException {
           Trc.entry(null, ja);
           boolean jndiSpecified =
               ja.getInitCxtFact() != null
  @@ -102,12 +102,14 @@
           if (jndiSpecified && implSpecURI != null)
               throw new WSIFException(
                   "Cannot specify both JNDI attributes and "
  -                    + "jmsImplementationSpecificURL in the jms:address");
  +                    + "jmsImplementationSpecificURL in the jms:address in port "
  +                    + portName);
   
           if (!jndiSpecified && implSpecURI == null)
               throw new WSIFException(
                   "Must specify either JNDI attributes or "
  -                    + "jmsImplementationSpecificURL in the jms:address");
  +                    + "jmsImplementationSpecificURL in the jms:address in port "
  +                    + portName);
   
           WSIFJMSFinder finder;
           if (jndiSpecified)
  @@ -118,7 +120,8 @@
                       ja.getJndiProvURL(),
                       ja.getDestStyle(),
                       ja.getJndiConnFactName(),
  -                    ja.getJndiDestName());
  +                    ja.getJndiDestName(),
  +                    portName);
           else {
               if (implSpecURI.startsWith(MQ_URL_PREFIX))
                   finder = new WSIFJMSFinderForMq(ja.getJmsVendorURI(), implSpecURI);
  @@ -126,7 +129,8 @@
                   throw new WSIFException(
                       "No jms implementation found for jmsImplementationSpecificURI '"
                           + implSpecURI
  -                        + "'");
  +                        + "' for port "
  +                        + portName);
           }
           Trc.exit(finder);
           return finder;
  
  
  
  1.6       +2 -1      xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java
  
  Index: JMS2HTTPBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/jms/JMS2HTTPBridge.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JMS2HTTPBridge.java	19 Jul 2002 15:46:29 -0000	1.5
  +++ JMS2HTTPBridge.java	27 Aug 2002 10:24:07 -0000	1.6
  @@ -158,7 +158,8 @@
                       jndiUrl,
                       WSIFJMSFinder.STYLE_QUEUE,
                       queueConnectionFactory,
  -                    readQueue),
  +                    readQueue,
  +                    null),
                   null,
                   WSIFJMSConstants.WAIT_FOREVER,
                   startType,
  
  
  
  1.10      +2 -1      xml-axis-wsif/java/test/org/apache/wsif/util/jms/NativeJMSRequestListener.java
  
  Index: NativeJMSRequestListener.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/org/apache/wsif/util/jms/NativeJMSRequestListener.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NativeJMSRequestListener.java	7 Aug 2002 12:04:44 -0000	1.9
  +++ NativeJMSRequestListener.java	27 Aug 2002 10:24:07 -0000	1.10
  @@ -132,7 +132,8 @@
                       jndiUrl,
                       WSIFJMSFinder.STYLE_QUEUE,
                       queueConnectionFactory,
  -                    msgQ),
  +                    msgQ,
  +                    null),
                   null,
                   WSIFJMSConstants.WAIT_FOREVER,
                   startType,
  
  
  
  1.5       +2 -1      xml-axis-wsif/java/test/org/apache/wsif/util/jms/JMSAsyncListener.java
  
  Index: JMSAsyncListener.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/test/org/apache/wsif/util/jms/JMSAsyncListener.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JMSAsyncListener.java	19 Jul 2002 15:46:30 -0000	1.4
  +++ JMSAsyncListener.java	27 Aug 2002 10:24:07 -0000	1.5
  @@ -108,7 +108,8 @@
                       jndiUrl,
                       WSIFJMSFinder.STYLE_QUEUE,
                       queueConnectionFactory,
  -                    msgQ),
  +                    msgQ,
  +                    null),
                   null,
                   WSIFJMSConstants.WAIT_FOREVER,
                   startType,
  
  
  
  1.19      +12 -4     xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java
  
  Index: WSIFOperation_Jms.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/jms/WSIFOperation_Jms.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- WSIFOperation_Jms.java	19 Aug 2002 09:19:32 -0000	1.18
  +++ WSIFOperation_Jms.java	27 Aug 2002 10:24:07 -0000	1.19
  @@ -187,7 +187,9 @@
               getOperation();
               WSIFJMSDestination jmsDest =
                   new WSIFJMSDestination(
  -                    WSIFJMSFinder.newFinder(fieldJmsPort.getObjectReference()),
  +                    WSIFJMSFinder.newFinder(
  +                        fieldJmsPort.getObjectReference(),
  +                        fieldJmsPort.getPortModel().getName()),
                       fieldJmsPort.getObjectReference().getJmsProvDestName(),
                       WSIFProperties.getSyncTimeout());
   
  @@ -280,7 +282,9 @@
   
               WSIFJMSDestination jmsDest =
                   new WSIFJMSDestination(
  -                    WSIFJMSFinder.newFinder(fieldJmsPort.getObjectReference()),
  +                    WSIFJMSFinder.newFinder(
  +                        fieldJmsPort.getObjectReference(),
  +                        fieldJmsPort.getPortModel().getName()),
                       fieldJmsPort.getObjectReference().getJmsProvDestName(),
                       WSIFProperties.getSyncTimeout());
   
  @@ -338,7 +342,9 @@
               output.setName(fieldBindingOperation.getBindingOutput().getName());
               WSIFJMSDestination jmsDest =
                   new WSIFJMSDestination(
  -                    WSIFJMSFinder.newFinder(fieldJmsPort.getObjectReference()),
  +                    WSIFJMSFinder.newFinder(
  +                        fieldJmsPort.getObjectReference(),
  +                        fieldJmsPort.getPortModel().getName()),
                       fieldJmsPort.getObjectReference().getJmsProvDestName(),
                       WSIFProperties.getSyncTimeout());
               receiveJmsMessage(responseObject, output, fault, jmsDest);
  @@ -377,7 +383,9 @@
           // **NS
           WSIFJMSDestination jmsDest =
               new WSIFJMSDestination(
  -                WSIFJMSFinder.newFinder(fieldJmsPort.getObjectReference()),
  +                WSIFJMSFinder.newFinder(
  +                    fieldJmsPort.getObjectReference(),
  +                    fieldJmsPort.getPortModel().getName()),
                   fieldJmsPort.getObjectReference().getJmsProvDestName(),
                   WSIFProperties.getSyncTimeout());
           WSIFMessage output = createOutputMessage();
  
  
  
  1.9       +1 -1      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java
  
  Index: WSIFPort_ApacheAxis.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WSIFPort_ApacheAxis.java	7 Aug 2002 15:10:25 -0000	1.8
  +++ WSIFPort_ApacheAxis.java	27 Aug 2002 10:24:08 -0000	1.9
  @@ -209,7 +209,7 @@
           if (transportcode == JMS_TRANSPORT) {
               WSIFJMSDestination jmsDestination =
                   new WSIFJMSDestination(
  -                    WSIFJMSFinder.newFinder(jmsaddress),
  +                    WSIFJMSFinder.newFinder(jmsaddress,port.getName()),
                       jmsaddress.getJmsProvDestName(),
                       WSIFProperties.getSyncTimeout());