Author: chris.laprun(a)jboss.com
Date: 2007-03-13 01:39:05 -0400 (Tue, 13 Mar 2007)
New Revision: 6650
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
Log:
- Fixed mapping of registration properties in Hibernate configuration, which seems to have
fixed the deployer issues! YEAH! ^_^
- ConsumerRegister.createConsumer takes cache expiration parameters since it allows for
the cache value to be persisted if something goes wrong later.
- WSRPDeploymentFactory now handles persistence errors better.
- ProducerInfo.*register now properly update the state in DB and deregister doesn't
reset the registration if the deregister operation failed.
- Improved service and AOP configuration.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-13
05:30:34 UTC (rev 6649)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockConsumerRegistry.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -74,7 +74,7 @@
return null;
}
- public WSRPConsumer createConsumer(String id)
+ public WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds)
{
MockWSRPConsumer consumer = new MockWSRPConsumer(id);
consumers.put(id, consumer);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-13
05:30:34 UTC (rev 6649)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -40,7 +40,7 @@
FederatingPortletInvoker getFederatingPortletInvoker();
- WSRPConsumer createConsumer(String id);
+ WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds);
void persistConsumer(WSRPConsumer consumer);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-13
05:30:34 UTC (rev 6649)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -62,7 +62,7 @@
return federatingPortletInvoker;
}
- public WSRPConsumer createConsumer(String id)
+ public WSRPConsumer createConsumer(String id, Integer expirationCacheSeconds)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer
identifier", "createConsumer");
@@ -76,6 +76,7 @@
info.setId(id);
info.setRegistry(this);
info.setRegistrationInfo(nullRegistration);
+ info.setExpirationCacheSeconds(expirationCacheSeconds);
try
{
@@ -122,8 +123,6 @@
protected void startService() throws Exception
{
- super.startService();
-
InitialContext initialContext = new InitialContext();
sessionFactory = (SessionFactory)initialContext.lookup(sessionFactoryJNDIName);
@@ -195,10 +194,9 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo,
"ProducerInfo");
+ Session session = sessionFactory.getCurrentSession();
try
{
- Session session = sessionFactory.getCurrentSession();
-
session.update(producerInfo);
}
catch (HibernateException e)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-13
05:30:34 UTC (rev 6649)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -614,6 +614,7 @@
public void register() throws PortletInvokerException
{
register(null);
+ registry.updateProducerInfo(this);
}
private void register(ServiceDescription serviceDescription) throws
PortletInvokerException
@@ -672,15 +673,13 @@
try
{
persistentEndpointInfo.getRegistrationService().deregister(getRegistrationContext());
+ persistentRegistrationInfo.resetRegistration();
+ registry.updateProducerInfo(this);
}
catch (Exception e)
{
throw new PortletInvokerException("Couldn't deregister with producer
'" + persistentId + "'", e);
}
- finally
- {
- persistentRegistrationInfo.resetRegistration();
- }
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-13
05:30:34 UTC (rev 6649)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.wsrp.deployment;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
/**
@@ -82,6 +82,6 @@
{
consumer.stop();
federatingPortletInvoker.unregisterInvoker(this);
- super.stop();
+ super.stopService();
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-13
05:30:34 UTC (rev 6649)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-13
05:39:05 UTC (rev 6650)
@@ -107,17 +107,13 @@
return null;
}
- // consumer didn't exist in the database, so create one and configure it
- consumer = consumerRegistry.createConsumer(id);
- ProducerInfo info = consumer.getProducerInfo();
-
String expirationCache = attrs.getValue("expiration-cache");
+ Integer expirationCacheSeconds = null;
if (expirationCache != null)
{
try
{
- Integer expirationCacheSeconds = new Integer(expirationCache);
- info.setExpirationCacheSeconds(expirationCacheSeconds);
+ expirationCacheSeconds = new Integer(expirationCache);
}
catch (NumberFormatException e)
{
@@ -125,6 +121,9 @@
}
}
+ // consumer didn't exist in the database, so create one and configure it
+ consumer = consumerRegistry.createConsumer(id, expirationCacheSeconds);
+
service.setConsumer(consumer);
return service;
@@ -288,7 +287,17 @@
}
// update the producer info once the whole information is known
- consumerRegistry.updateProducerInfo(info);
+ try
+ {
+ consumerRegistry.updateProducerInfo(info);
+ }
+ catch (Exception e)
+ {
+ // if we couldn't update the info, remove it from the list of service to be
activated
+ deployment.getServices().remove(service);
+ log.info("Couldn't update the ProducerInfo for Consumer '" +
info.getId() + "'", e);
+ return;
+ }
log.info(message);
}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-03-13
05:30:34 UTC (rev 6649)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-03-13
05:39:05 UTC (rev 6650)
@@ -127,7 +127,7 @@
<!-- Deployer for *-wsrp.xml files. Deploys default-wsrp.xml which contains the
'self' consumer -->
<mbean code="org.jboss.portal.wsrp.deployment.WSRPDeployer"
name="portal.wsrp:service=WSRPDeployer">
<attribute
name="DefaultWSRPLocation">default-wsrp.xml</attribute>
- <depends>portal:service=Hibernate,type=WSRPConsumer</depends>
+ <depends>jboss.system:service=MainDeployer</depends>
<depends optional-attribute-name="ConsumerRegistry"
proxy-type="attribute">portal.wsrp:service=ConsumersRegistry</depends>
<depends optional-attribute-name="EntityResolver"
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
---
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-13
05:30:34 UTC (rev 6649)
+++
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-13
05:39:05 UTC (rev 6650)
@@ -78,8 +78,8 @@
<property name="registrationState" column="STATE"
type="binary"/>
<map name="registrationProperties" cascade="all"
lazy="false">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <key column="REG_PROP_PK"/>
- <map-key type="string" column="NAME"/>
+ <key column="REG_PK" not-null="true"/>
+ <map-key type="string" column="name"/>
<one-to-many
class="org.jboss.portal.wsrp.consumer.RegistrationProperty"/>
</map>
</class>
@@ -91,7 +91,7 @@
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property name="name" type="java.lang.String"
not-null="true"/>
+ <property name="name" type="java.lang.String"
not-null="true" insert="false" update="false"/>
<property name="value" type="java.lang.String"
not-null="true"/>
<property name="invalid" type="boolean"/>
<property name="lang" type="java.lang.String"/>
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-03-13 05:30:34 UTC (rev
6649)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-03-13 05:39:05 UTC (rev
6650)
@@ -30,7 +30,7 @@
<trans-attribute>Required</trans-attribute>
</method>
<method name="activateConsumerWith">
- <trans-attribute>RequiresNew</trans-attribute>
+ <trans-attribute>Required</trans-attribute>
</method>
<method name="updateProducerInfo">
<trans-attribute>Required</trans-attribute>