Author: mwringe
Date: 2010-09-23 23:43:20 -0400 (Thu, 23 Sep 2010)
New Revision: 4366
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
Log:
GTNWSRP-74: move the registration PortletContextListener so that when the policy is
updated the listener also gets recreated.
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java 2010-09-24
03:43:15 UTC (rev 4365)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java 2010-09-24
03:43:20 UTC (rev 4366)
@@ -223,12 +223,12 @@
{
//TODO: this might be better to place somewhere else and use the
RegistrationHandler.register instead of
// doing basically the same thing below.
- String NonRegisteredDConsumer = "NONREGISTERED";
- Consumer unregConsumer = getConsumerByIdentity(NonRegisteredDConsumer);
+ String NonRegisteredConsumer = "NONREGISTERED";
+ Consumer unregConsumer = getConsumerByIdentity(NonRegisteredConsumer);
if (unregConsumer == null)
{
- unregConsumer = createConsumer(NonRegisteredDConsumer);
- Registration registration = addRegistrationTo(NonRegisteredDConsumer, new
HashMap<QName, Object>(), null, false);
+ unregConsumer = createConsumer(NonRegisteredConsumer);
+ Registration registration = addRegistrationTo(NonRegisteredConsumer, new
HashMap<QName, Object>(), null, false);
registration.setStatus(RegistrationStatus.VALID);
getPersistenceManager().saveChangesTo(unregConsumer);
}
@@ -377,6 +377,7 @@
*/
public void policyUpdatedTo(RegistrationPolicy policy)
{
+ policy.addPortletContextChangeListener(this);
setPolicy(policy);
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java 2010-09-24
03:43:15 UTC (rev 4365)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java 2010-09-24
03:43:20 UTC (rev 4366)
@@ -270,7 +270,11 @@
{
listeners = new ArrayList<RegistrationPortletContextChangeListener>();
}
- listeners.add(listener);
+
+ if (!listeners.contains(listener))
+ {
+ listeners.add(listener);
+ }
}
protected void updatePortletContextListeners(Registration registration)
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-09-24
03:43:15 UTC (rev 4365)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPProducerImpl.java 2010-09-24
03:43:20 UTC (rev 4366)
@@ -385,8 +385,6 @@
registrationManager.setPolicy(registrationRequirements.getPolicy());
-
registrationManager.getPolicy().addPortletContextChangeListener(registrationManager);
-
started = true;
}
}
Show replies by date