Author: chris.laprun(a)jboss.com
Date: 2010-10-26 10:34:50 -0400 (Tue, 26 Oct 2010)
New Revision: 4847
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
Log:
- GTNWSRP-118: replaced EndpointConfigurationInfo.forceRefresh method implementation by
call to new ServiceFactory.refresh method. This also has the advantage of not tying
EndpointConfigurationInfo to WSRP classes.
- GTNWSRP-120: improved handling of ProducerInfo.refresh when WSDL is not correct.
Improved error message as well.
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -50,6 +50,7 @@
private static final String REFRESH_BYPASSED =
"bean_consumermanager_refresh_bypassed";
private static final String REFRESH_SUCCESS =
"bean_consumermanager_refresh_success";
private static final String REFRESH_FAILURE =
"bean_consumermanager_refresh_failure";
+ private static final String REFRESH_FAILURE_WSDL =
"bean_consumermanager_refresh_failure_wsdl";
private static final String REFRESH_EXCEPTION =
"bean_consumermanager_refresh_exception";
static final String CONFIGURE_CONSUMER = "configureConsumer";
static final String EXPORT = "export";
@@ -329,8 +330,15 @@
}
else if (RefreshResult.Status.FAILURE.equals(status))
{
- // todo: extract information from registration result to be more precise
- return REFRESH_FAILURE;
+ RefreshResult registrationResult = result.getRegistrationResult();
+ if (registrationResult != null)
+ {
+ return REFRESH_FAILURE;
+ }
+ else
+ {
+ return REFRESH_FAILURE_WSDL;
+ }
}
else if (RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED.equals(status))
{
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2010-10-26
14:34:50 UTC (rev 4847)
@@ -194,6 +194,7 @@
bean_consumermanager_refresh_bypassed = Refresh was not necessary.
bean_consumermanager_refresh_success = Refresh was successful.
bean_consumermanager_refresh_failure = Refresh failed (probably because the registration
information was not valid).
+bean_consumermanager_refresh_failure_wsdl = Refresh failed (probably because the WSDL
information was not valid).
bean_consumermanager_refresh_exception = An unexpected error occurred.
bean_consumermanager_refresh_modify = Either local or remote information has been
changed, you should modify your registration with the remote producer.\n\
The new local information will be saved but your current registration data will be used
until you successfully \
Modified:
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2010-10-26
14:34:50 UTC (rev 4847)
@@ -179,4 +179,5 @@
edit_consumer_export=Exporter portlets
edit_consumer_export_title=Portlets en export
edit_consumer_import=Importer portlets
-edit_consumer_import_title=Portlets en import
\ No newline at end of file
+edit_consumer_import_title=Portlets en import
+bean_consumermanager_refresh_failure_wsdl=Le rafra\u00eechissement a \u00e9chou\u00e9
(probablement \u00e0 cause d'URL WSDL non valide)
\ No newline at end of file
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EndpointConfigurationInfo.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -32,10 +32,6 @@
import org.gatein.wsrp.services.SOAPServiceFactory;
import org.gatein.wsrp.services.ServiceDescriptionService;
import org.gatein.wsrp.services.ServiceFactory;
-import org.oasis.wsrp.v2.WSRPV2MarkupPortType;
-import org.oasis.wsrp.v2.WSRPV2PortletManagementPortType;
-import org.oasis.wsrp.v2.WSRPV2RegistrationPortType;
-import org.oasis.wsrp.v2.WSRPV2ServiceDescriptionPortType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -198,12 +194,14 @@
boolean forceRefresh() throws InvokerUnavailableException
{
- getService(WSRPV2ServiceDescriptionPortType.class, serviceFactory);
- getService(WSRPV2MarkupPortType.class, serviceFactory);
- getService(WSRPV2PortletManagementPortType.class, serviceFactory);
- getService(WSRPV2RegistrationPortType.class, serviceFactory);
-
- return true;
+ try
+ {
+ return serviceFactory.refresh(true);
+ }
+ catch (Exception e)
+ {
+ throw new InvokerUnavailableException(e);
+ }
}
public String getRemoteHostAddress()
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -339,6 +339,13 @@
{
RefreshResult result = internalRefresh(forceRefresh);
+ // if the refresh failed, return immediately
+ if (RefreshResult.Status.FAILURE.equals(result.getStatus()))
+ {
+ setActiveAndSave(false);
+ return result;
+ }
+
// update DB
if (result.didRefreshHappen())
{
@@ -347,7 +354,7 @@
{
setActive(false);
- // record what the Producer's expectations are
+ // record what the Producer's expectations are if we managed to get a
service description
expectedRegistrationInfo = new
RegistrationInfo(this.persistentRegistrationInfo);
expectedRegistrationInfo.refresh(result.getServiceDescription(), getId(),
true, true, true);
}
@@ -397,7 +404,16 @@
log.debug("Couldn't refresh endpoint information, attempting a
second time: " + e, e);
// try again as refresh on a failed service factory will fail without
attempting the refresh
- didJustRefresh = persistentEndpointInfo.forceRefresh();
+ try
+ {
+ didJustRefresh = persistentEndpointInfo.forceRefresh();
+ }
+ catch (InvokerUnavailableException e1)
+ {
+ result.setStatus(RefreshResult.Status.FAILURE);
+ return result;
+ }
+
// todo: should we fail fast here?
// throw new PortletInvokerException("Couldn't refresh endpoint
information: " + e.getLocalizedMessage());
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/SOAPServiceFactory.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -155,11 +155,7 @@
log.debug("Getting service for class " + clazz);
}
- // if we need a refresh, reload information from WSDL
- if (!isAvailable() && !isFailed())
- {
- start();
- }
+ refresh(false);
Object service = wsService.getPort(clazz);
@@ -429,6 +425,19 @@
}
}
+ public boolean refresh(boolean force) throws Exception
+ {
+ // if we need a refresh, reload information from WSDL
+ if (force || (!isAvailable() && !isFailed()))
+ {
+ start();
+
+ return true;
+ }
+
+ return false;
+ }
+
protected class WSDLInfo
{
private final QName wsrp2ServiceQName;
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/ServiceFactory.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -89,4 +89,6 @@
* @return
*/
Version getWSRPVersion();
+
+ boolean refresh(boolean force) throws Exception;
}
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v1/BehaviorBackedServiceFactory.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -179,6 +179,18 @@
return ServiceFactory.WSRP1;
}
+ public boolean refresh(boolean force) throws Exception
+ {
+ if (force || (!isAvailable() && !isFailed()))
+ {
+ start();
+
+ return true;
+ }
+
+ return false;
+ }
+
public void create() throws Exception
{
throw new NotYetImplemented();
Modified:
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java
===================================================================
---
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2010-10-26
14:34:32 UTC (rev 4846)
+++
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/protocol/v2/BehaviorBackedServiceFactory.java 2010-10-26
14:34:50 UTC (rev 4847)
@@ -138,6 +138,18 @@
return ServiceFactory.WSRP2;
}
+ public boolean refresh(boolean force) throws Exception
+ {
+ if (force || (!isAvailable() && !isFailed()))
+ {
+ start();
+
+ return true;
+ }
+
+ return false;
+ }
+
public BehaviorRegistry getRegistry()
{
return registry;