Author: chris.laprun(a)jboss.com
Date: 2011-03-30 10:55:57 -0400 (Wed, 30 Mar 2011)
New Revision: 6141
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/AbstractRegistrationPersistenceManager.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPersistenceManager.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java
Log:
- GTNWSRP-216: Do not swallow persistence layer exceptions anymore.
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -642,11 +642,23 @@
}
}
- beanContext.createLocalizedMessage(BeanContext.STATUS, IMPORT_SUCCESS,
beanContext.getInfoSeverity(), importCount);
+ // only display success message if we have imported at least one portlet
successfully
+ if (importCount > 0)
+ {
+ beanContext.createLocalizedMessage(BeanContext.STATUS, IMPORT_SUCCESS,
beanContext.getInfoSeverity(), importCount);
+ }
+
SortedMap<QName, List<String>>
errorCodesToFailedPortletHandlesMapping =
info.getErrorCodesToFailedPortletHandlesMapping();
if (!errorCodesToFailedPortletHandlesMapping.isEmpty())
{
- beanContext.createErrorMessage(FAILED_PORTLETS,
errorCodesToFailedPortletHandlesMapping);
+ for (Map.Entry<QName, List<String>> entry :
errorCodesToFailedPortletHandlesMapping.entrySet())
+ {
+ QName errorCode = entry.getKey();
+ for (String handle : entry.getValue())
+ {
+ beanContext.createErrorMessage(FAILED_PORTLETS, handle + " (cause:
" + errorCode + ")");
+ }
+ }
}
return ConsumerManagerBean.CONSUMERS;
@@ -656,7 +668,6 @@
beanContext.createErrorMessageFrom(e);
return null;
}
-
}
public String deleteExport()
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-03-30
14:55:57 UTC (rev 6141)
@@ -188,7 +188,7 @@
bean_consumer_malformed_url = ''{0}'' is not a valid URL: {1}
bean_consumer_update_success = Successfully updated consumer!
bean_consumer_import_success = {0} portlets were successfully imported!
-bean_consumer_import_failed_portlets = The following portlets couldn't be imported:
{0}
+bean_consumer_import_failed_portlets = The following portlet couldn''t be
imported: {0}
# ConsumerManagerBean
bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the
new consumer!
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-03-30
14:55:57 UTC (rev 6141)
@@ -175,7 +175,7 @@
import_import=Importer
import_use=Importer?
bean_consumer_import_success=''{0}'' portlets ont �t� correctement
import�es!
-bean_consumer_import_failed_portlets=Les portlets suivantes n'ont pas pu �tre
import�es: {0}
+bean_consumer_import_failed_portlets=La portlet suivante n''a pas pu �tre
import�e: {0}
edit_consumer_export=Exporter portlets
edit_consumer_export_title=Portlets en export
edit_consumer_import=Importer portlets
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/AbstractRegistrationPersistenceManager.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/AbstractRegistrationPersistenceManager.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/AbstractRegistrationPersistenceManager.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -47,7 +47,7 @@
return consumer;
}
- public void saveChangesTo(Consumer consumer)
+ public void saveChangesTo(Consumer consumer) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
@@ -59,7 +59,7 @@
internalSaveChangesTo(consumer);
}
- public void saveChangesTo(Registration registration)
+ public void saveChangesTo(Registration registration) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(registration,
"Registration");
@@ -163,27 +163,27 @@
// internal methods: extension points for subclasses
- protected abstract void internalAddRegistration(RegistrationSPI registration);
+ protected abstract void internalAddRegistration(RegistrationSPI registration) throws
RegistrationException;
- protected abstract RegistrationSPI internalRemoveRegistration(String registrationId);
+ protected abstract RegistrationSPI internalRemoveRegistration(String registrationId)
throws RegistrationException;
- protected abstract RegistrationSPI internalCreateRegistration(ConsumerSPI consumer,
Map<QName, Object> registrationProperties);
+ protected abstract RegistrationSPI internalCreateRegistration(ConsumerSPI consumer,
Map<QName, Object> registrationProperties) throws RegistrationException;
- protected abstract void internalAddConsumer(ConsumerSPI consumer);
+ protected abstract void internalAddConsumer(ConsumerSPI consumer) throws
RegistrationException;
- protected abstract ConsumerSPI internalRemoveConsumer(String consumerId);
+ protected abstract ConsumerSPI internalRemoveConsumer(String consumerId) throws
RegistrationException;
- protected abstract ConsumerSPI internalCreateConsumer(String consumerId, String
consumerName);
+ protected abstract ConsumerSPI internalCreateConsumer(String consumerId, String
consumerName) throws RegistrationException;
- protected abstract ConsumerSPI internalSaveChangesTo(Consumer consumer);
-
- protected abstract RegistrationSPI internalSaveChangesTo(Registration registration);
+ protected abstract ConsumerSPI internalSaveChangesTo(Consumer consumer) throws
RegistrationException;
- protected abstract void internalAddConsumerGroup(ConsumerGroupSPI group);
+ protected abstract RegistrationSPI internalSaveChangesTo(Registration registration)
throws RegistrationException;
- protected abstract ConsumerGroupSPI internalRemoveConsumerGroup(String name);
+ protected abstract void internalAddConsumerGroup(ConsumerGroupSPI group) throws
RegistrationException;
- protected abstract ConsumerGroupSPI internalCreateConsumerGroup(String name);
+ protected abstract ConsumerGroupSPI internalRemoveConsumerGroup(String name) throws
RegistrationException;
+ protected abstract ConsumerGroupSPI internalCreateConsumerGroup(String name) throws
RegistrationException;
+
protected abstract ConsumerSPI getConsumerSPIById(String consumerId) throws
RegistrationException;
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPersistenceManager.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPersistenceManager.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPersistenceManager.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -47,14 +47,14 @@
*
* @param consumer
*/
- void saveChangesTo(Consumer consumer);
+ void saveChangesTo(Consumer consumer) throws RegistrationException;
/**
* Saves changes made to the specified registration.
*
* @param registration
*/
- void saveChangesTo(Registration registration);
+ void saveChangesTo(Registration registration) throws RegistrationException;
/**
* Retrieves the ConsumerGroup identified by the specified name.
@@ -92,13 +92,13 @@
Registration addRegistrationFor(String consumerId, Map<QName, Object>
registrationProperties) throws RegistrationException;
- Collection<? extends ConsumerGroup> getConsumerGroups();
+ Collection<? extends ConsumerGroup> getConsumerGroups() throws
RegistrationException;
- Registration getRegistration(String registrationId);
+ Registration getRegistration(String registrationId) throws RegistrationException;
Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException;
- Collection<? extends Consumer> getConsumers();
+ Collection<? extends Consumer> getConsumers() throws RegistrationException;
- Collection<? extends Registration> getRegistrations();
+ Collection<? extends Registration> getRegistrations() throws
RegistrationException;
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationManagerImpl.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -281,7 +281,7 @@
return consumer;
}
- private Object getConsumerOrRegistration(String registrationHandle, boolean
getConsumer)
+ private Object getConsumerOrRegistration(String registrationHandle, boolean
getConsumer) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationHandle,
"registration handle", null);
@@ -296,7 +296,7 @@
}
}
- public Collection<? extends ConsumerGroup> getConsumerGroups()
+ public Collection<? extends ConsumerGroup> getConsumerGroups() throws
RegistrationException
{
return persistenceManager.getConsumerGroups();
}
@@ -319,7 +319,7 @@
removeConsumerGroup(getConsumerGroup(name));
}
- public Collection<? extends Consumer> getConsumers()
+ public Collection<? extends Consumer> getConsumers() throws
RegistrationException
{
return persistenceManager.getConsumers();
}
@@ -353,20 +353,38 @@
log.debug("Registration properties have changed, existing registrations
will be invalidated...");
}
- Collection registrations = persistenceManager.getRegistrations();
- for (Object registration : registrations)
+ try
{
- Registration reg = (Registration)registration;
+ Collection registrations = persistenceManager.getRegistrations();
+ for (Object registration : registrations)
+ {
+ Registration reg = (Registration)registration;
- // pending instead of invalid as technically, the registration is not yet
invalid
- reg.setStatus(RegistrationStatus.PENDING);
+ // pending instead of invalid as technically, the registration is not yet
invalid
+ reg.setStatus(RegistrationStatus.PENDING);
- // make changes persistent
- Consumer consumer = reg.getConsumer();
- persistenceManager.saveChangesTo(consumer);
-
-// reg.clearAssociatedState(); //todo: do we need to clear the associated state?
If we do, should we wait until current operations are done?
+ // make changes persistent
+ Consumer consumer = reg.getConsumer();
+ try
+ {
+ persistenceManager.saveChangesTo(consumer);
+ }
+ catch (RegistrationException e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Couldn't persist changes to Consumer '" +
consumer.getId() + "'", e);
+ }
+ }
+ }
}
+ catch (RegistrationException e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Couldn't retrieve registrations...", e);
+ }
+ }
}
/**
@@ -384,6 +402,13 @@
// GTNWSRP-72
public void portletContextsHaveChanged(Registration registration)
{
- persistenceManager.saveChangesTo(registration);
+ try
+ {
+ persistenceManager.saveChangesTo(registration);
+ }
+ catch (RegistrationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings |
File Templates.
+ }
}
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -89,19 +89,19 @@
}
@Override
- protected void internalAddRegistration(RegistrationSPI registration)
+ protected void internalAddRegistration(RegistrationSPI registration) throws
RegistrationException
{
registrations.put(registration.getPersistentKey(), registration);
}
@Override
- protected RegistrationSPI internalRemoveRegistration(String registrationId)
+ protected RegistrationSPI internalRemoveRegistration(String registrationId) throws
RegistrationException
{
return registrations.remove(registrationId);
}
@Override
- protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer,
Map<QName, Object> registrationProperties)
+ protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer,
Map<QName, Object> registrationProperties) throws RegistrationException
{
return newRegistrationSPI(consumer, registrationProperties, "" +
lastRegistrationId++);
}
@@ -112,19 +112,19 @@
}
@Override
- protected void internalAddConsumer(ConsumerSPI consumer)
+ protected void internalAddConsumer(ConsumerSPI consumer) throws RegistrationException
{
consumers.put(consumer.getId(), consumer);
}
@Override
- protected ConsumerSPI internalRemoveConsumer(String consumerId)
+ protected ConsumerSPI internalRemoveConsumer(String consumerId) throws
RegistrationException
{
return consumers.remove(consumerId);
}
@Override
- protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName)
+ protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName)
throws RegistrationException
{
ConsumerSPI consumerSPI = newConsumerSPI(consumerId, consumerName);
consumerSPI.setPersistentKey(consumerId);
@@ -137,19 +137,19 @@
}
@Override
- protected void internalAddConsumerGroup(ConsumerGroupSPI group)
+ protected void internalAddConsumerGroup(ConsumerGroupSPI group) throws
RegistrationException
{
groups.put(group.getName(), group);
}
@Override
- protected ConsumerGroupSPI internalRemoveConsumerGroup(String name)
+ protected ConsumerGroupSPI internalRemoveConsumerGroup(String name) throws
RegistrationException
{
return groups.remove(name);
}
@Override
- protected ConsumerGroupSPI internalCreateConsumerGroup(String name)
+ protected ConsumerGroupSPI internalCreateConsumerGroup(String name) throws
RegistrationException
{
ConsumerGroupSPI groupSPI = newConsumerGroupSPI(name);
groupSPI.setPersistentKey(name);
@@ -168,13 +168,13 @@
}
@Override
- protected ConsumerSPI internalSaveChangesTo(Consumer consumer)
+ protected ConsumerSPI internalSaveChangesTo(Consumer consumer) throws
RegistrationException
{
return (ConsumerSPI)consumer; // nothing to do here, left up to subclasses to
implement update in persistent store
}
@Override
- protected RegistrationSPI internalSaveChangesTo(Registration registration)
+ protected RegistrationSPI internalSaveChangesTo(Registration registration) throws
RegistrationException
{
return (RegistrationSPI)registration; // nothing to do here, left up to subclasses
to implement update in persistent store
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/PortletManagementHandler.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -854,7 +854,7 @@
else // default error message.
{
errorCode = ErrorCodes.Codes.OPERATIONFAILED;
- reason = "Error preparing portlet for export";
+ reason = "Error importing portlet.";
}
if (!failedPortletsMap.containsKey(errorCode.name()))
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java 2011-03-30
14:47:40 UTC (rev 6140)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/handlers/RegistrationHandler.java 2011-03-30
14:55:57 UTC (rev 6141)
@@ -145,7 +145,14 @@
capabilities.setSupportedUserScopes(registrationData.getConsumerUserScopes());
capabilities.setSupportsGetMethod(registrationData.isMethodGetSupported());
- producer.getRegistrationManager().getPersistenceManager().saveChangesTo(consumer);
+ try
+ {
+
producer.getRegistrationManager().getPersistenceManager().saveChangesTo(consumer);
+ }
+ catch (RegistrationException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings |
File Templates.
+ }
}
public List<Extension> deregister(RegistrationContext deregister)