Author: chris.laprun(a)jboss.com
Date: 2010-01-20 04:33:19 -0500 (Wed, 20 Jan 2010)
New Revision: 1390
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/RegistrationProperty.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
Log:
- When a refresh has issues, now record expected registration information instead of
leaving up to GUI tools.
- Changed RegistrationProperty's persistentId to String and renamed accessors to
*PersistentKey for coherence.
- Minor refactoring and clean-ups.
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-01-20
08:16:42 UTC (rev 1389)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-01-20
09:33:19 UTC (rev 1390)
@@ -114,6 +114,8 @@
private ConsumerRegistry registry;
private static final String ERASED_LOCAL_REGISTRATION_INFORMATION = "Erased local
registration information!";
+ private transient RegistrationInfo expectedRegistrationInfo;
+
private Map<String, ItemDescription> customModes;
private Map<String, ItemDescription> customWindowStates;
@@ -309,6 +311,11 @@
return requiresInitCookie;
}
+ public RegistrationInfo getExpectedRegistrationInfo()
+ {
+ return expectedRegistrationInfo;
+ }
+
/**
* Refreshes the producer's information from the service description if required.
*
@@ -333,6 +340,10 @@
if (result.hasIssues())
{
setActive(false);
+
+ // record what the Producer's expectations are
+ expectedRegistrationInfo = new
RegistrationInfo(this.persistentRegistrationInfo);
+ expectedRegistrationInfo.refresh(result.getServiceDescription(), getId(),
true, true, true);
}
else
{
@@ -341,6 +352,9 @@
{
setActive(true);
}
+
+ // if we didn't have any issues, then the expected registration info is
the one we have
+ expectedRegistrationInfo = persistentRegistrationInfo;
}
registry.updateProducerInfo(this);
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java 2010-01-20
08:16:42 UTC (rev 1389)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RegistrationProperty.java 2010-01-20
09:33:19 UTC (rev 1390)
@@ -35,7 +35,7 @@
*/
public class RegistrationProperty implements Comparable<RegistrationProperty>
{
- private Long persistentId;
+ private String persistentId;
private RegistrationPropertyDescription persistentDescription;
private String persistentLang;
private String persistentName;
@@ -122,12 +122,12 @@
return result;
}
- public Long getKey()
+ public String getPersistentKey()
{
return persistentId;
}
- public void setKey(Long key)
+ public void setPersistentKey(String key)
{
this.persistentId = key;
}
@@ -231,8 +231,7 @@
this.listener = listener;
}
- /** todo: Should be package-only, public for tests... */
- public static interface PropertyChangeListener
+ static interface PropertyChangeListener
{
void propertyValueChanged(RegistrationProperty property, Object oldValue, Object
newValue);
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-01-20
08:16:42 UTC (rev 1389)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-01-20
09:33:19 UTC (rev 1390)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -531,9 +531,7 @@
throw new PortletInvokerException(e);
}
- RefreshResult refreshResult = producerInfo.detailedRefresh(forceRefresh);
- sessionHandler.setRequiresInitCookie(producerInfo.getRequiresInitCookie());
- return refreshResult;
+ return refreshProducerInfo(forceRefresh);
}
// Service implementation
*******************************************************************************************
@@ -588,10 +586,11 @@
refreshProducerInfo(true);
}
- private void refreshProducerInfo(boolean forceRefresh) throws PortletInvokerException
+ private RefreshResult refreshProducerInfo(boolean forceRefresh) throws
PortletInvokerException
{
- producerInfo.refresh(forceRefresh);
+ RefreshResult refreshResult = producerInfo.detailedRefresh(forceRefresh);
sessionHandler.setRequiresInitCookie(producerInfo.getRequiresInitCookie());
+ return refreshResult;
}
public void releaseSessions() throws PortletInvokerException
Show replies by date