[portal-commits] JBoss Portal SVN: r9135 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Tue Nov 27 13:41:46 EST 2007


Author: chris.laprun at jboss.com
Date: 2007-11-27 13:41:46 -0500 (Tue, 27 Nov 2007)
New Revision: 9135

Modified:
   branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
Log:
- JBPORTAL-1566: improved handling of WSDL status. Perfect handling would require database update which is deffered for 2.8.

Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java	2007-11-27 17:48:07 UTC (rev 9134)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/EndpointConfigurationInfo.java	2007-11-27 18:41:46 UTC (rev 9135)
@@ -75,6 +75,7 @@
 
    /** Whether we're using information from a WSDL or not. */
    private boolean usingWSDL = true;
+   private boolean isModifiedWSDL;
 
    // todo: public for tests
    public EndpointConfigurationInfo()
@@ -106,9 +107,14 @@
 
    public boolean usesWSDL()
    {
-      return usingWSDL;
+      return (isWSDLNotNullAndSet() && !isModifiedWSDL) || usingWSDL;
    }
 
+   public void setUsesWSDL(boolean useWSDL)
+   {
+      usingWSDL = useWSDL;
+   }
+
    public String getWsdlDefinitionURL()
    {
       if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
@@ -199,25 +205,46 @@
       // WSDL url is optional so can be null (and in particular, it is when loaded from Hibernate most of the time)
       // do not attempt to set the URL if the service factory hasn't been created yet to avoid issues when
       // ConsumerRegistry starts (in particular, raising an exception if the WSDL is not available)
-      if (wsdlDefinitionURL != null && !UNSET.equals(wsdlDefinitionURL) && serviceFactory != null)
+      if (isWSDLNotNullAndSet())
       {
          usingWSDL = true;
 
-         if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
+         if (serviceFactory != null)
          {
-            serviceFactory = new RemoteSOAPInvokerServiceFactory();
+            if (!(serviceFactory instanceof RemoteSOAPInvokerServiceFactory))
+            {
+               serviceFactory = new RemoteSOAPInvokerServiceFactory();
+            }
+            internalSetWsdlURL();
          }
-         internalSetWsdlURL();
       }
+      else
+      {
+         usingWSDL = false;
+      }
    }
 
+   private boolean isWSDLNotNullAndSet()
+   {
+      return persistentWsdlDefinitionURL != null && !UNSET.equals(persistentWsdlDefinitionURL);
+   }
+
    private String modifyIfNeeded(String oldValue, String newValue, int whichURL)
    {
       if ((oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null))
       {
+         if (usesWSDL())
+         {
+            if (serviceFactory instanceof RemoteSOAPInvokerServiceFactory)
+            {
+               isModifiedWSDL = true;
+            }
+
+            usingWSDL = false;
+         }
+
          oldValue = newValue;
          clean.clear(whichURL);
-         usingWSDL = false;
       }
 
       return oldValue;
@@ -227,7 +254,7 @@
    {
       if (serviceFactory == null)
       {
-         if (usesWSDL() && !UNSET.equals(persistentWsdlDefinitionURL))
+         if (usesWSDL())
          {
             serviceFactory = new RemoteSOAPInvokerServiceFactory();
             internalSetWsdlURL();
@@ -288,6 +315,7 @@
          persistentServiceDescriptionURL = serviceFactory.getServiceDescriptionURL();
 
          clean.set(0, 4); // if setting the WSDL URL worked, consider everything clean
+         isModifiedWSDL = false;
       }
       catch (Exception e)
       {




More information about the portal-commits mailing list