Author: chris.laprun(a)jboss.com
Date: 2007-03-07 21:13:02 -0500 (Wed, 07 Mar 2007)
New Revision: 6596
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
Log:
- JBPORTAL-1310: Attempting (without success) to force transactional context when deployer
tries to deploy external -wsrp.xml files. (synchronization commit).
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-08
00:00:42 UTC (rev 6595)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-08
02:13:02 UTC (rev 6596)
@@ -80,6 +80,8 @@
try
{
Session session = sessionFactory.getCurrentSession();
+
+ // make sure we re-attach nullRegistration
session.refresh(nullRegistration);
session.persist(info);
}
@@ -95,9 +97,9 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
- Session session = sessionFactory.getCurrentSession();
ProducerInfo info = consumer.getProducerInfo();
+ Session session = sessionFactory.getCurrentSession();
session.persist(info);
createConsumerFrom(info);
@@ -120,14 +122,16 @@
protected void startService() throws Exception
{
- sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
+ super.startService();
+ InitialContext initialContext = new InitialContext();
+ sessionFactory = (SessionFactory)initialContext.lookup(sessionFactoryJNDIName);
+
// load the configured consumers
consumers = new TreeMap();
Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
Iterator producerInfos = session.createQuery("from ProducerInfo pi order by
pi.id").iterate();
// load the configured producers
@@ -147,18 +151,13 @@
activateConsumerWith(producerInfo.getId());
}
}
- session.getTransaction().commit();
- session.beginTransaction();
nullRegistration = (RegistrationInfo)session.createQuery("from
RegistrationInfo where key = (select min(key) from
RegistrationInfo)").uniqueResult();
if (nullRegistration == null)
{
nullRegistration = new RegistrationInfo();
session.persist(nullRegistration);
}
- session.getTransaction().commit();
-
- session.close();
}
private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2007-03-08
00:00:42 UTC (rev 6595)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2007-03-08
02:13:02 UTC (rev 6596)
@@ -25,7 +25,6 @@
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.SubDeployerSupport;
-import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.common.xml.NullEntityResolver;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.xb.binding.ObjectModelFactory;
@@ -100,7 +99,7 @@
ObjectModelFactory factory = new WSRPDeploymentFactory(consumerRegistry);
if (entityResolver == null)
{
- log.debug("Coult not obtain entity resolver for WSRPDeployer");
+ log.debug("Could not obtain entity resolver for WSRPDeployer");
entityResolver = new NullEntityResolver();
}
unmarshaller.setEntityResolver(entityResolver);
@@ -112,11 +111,6 @@
}
}
- protected void createService() throws Exception
- {
- super.createService();
- }
-
public void start(DeploymentInfo di) throws DeploymentException
{
super.start(di);
@@ -146,23 +140,17 @@
super.stop(di);
}
- protected void destroyService() throws Exception
- {
- super.destroyService();
- }
-
-
protected void startService() throws Exception
{
- super.startService();
if (defaultWSRPLocation != null)
{
URL defaultWSRPURL =
Thread.currentThread().getContextClassLoader().getResource(defaultWSRPLocation);
- if (URLTools.exists(defaultWSRPURL))
+ if (defaultWSRPURL != null)
{
try
{
deployedDefaultWSRPURL = defaultWSRPURL;
+
mainDeployer.deploy(defaultWSRPURL);
}
catch (DeploymentException e)
@@ -171,6 +159,8 @@
}
}
}
+
+ super.startService();
}
protected void stopService() throws Exception
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-08
00:00:42 UTC (rev 6595)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-03-08
02:13:02 UTC (rev 6596)
@@ -127,6 +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 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/wsrp-aop.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-03-08 00:00:42 UTC (rev
6595)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-03-08 02:13:02 UTC (rev
6596)
@@ -30,7 +30,7 @@
<trans-attribute>Required</trans-attribute>
</method>
<method name="activateConsumerWith">
- <trans-attribute>Required</trans-attribute>
+ <trans-attribute>RequiresNew</trans-attribute>
</method>
<method name="updateProducerInfo">
<trans-attribute>Required</trans-attribute>
Show replies by date