Author: chris.laprun(a)jboss.com
Date: 2007-03-05 00:42:47 -0500 (Mon, 05 Mar 2007)
New Revision: 6535
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/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/consumer/RegistrationInfo.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- Added getDefaultRegistrationInfo and related initialization on ConsumerRegistry.
- Replaced REGISTRATION_NOT_NEEDED to calls to getDefaultRegistrationInfo.
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-03-05
00:07:16 UTC (rev 6534)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-03-05
05:42:47 UTC (rev 6535)
@@ -30,6 +30,7 @@
import org.jboss.portal.wsrp.consumer.ConsumerException;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import java.util.Collection;
import java.util.HashMap;
@@ -88,4 +89,9 @@
{
// do nothing
}
+
+ public RegistrationInfo getDefaultRegistrationInfo()
+ {
+ return new RegistrationInfo();
+ }
}
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-05
00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-05
05:42:47 UTC (rev 6535)
@@ -47,4 +47,6 @@
void activateConsumerWith(String id) throws ConsumerException;
void updateProducerInfo(ProducerInfo producerInfo);
+
+ RegistrationInfo getDefaultRegistrationInfo();
}
\ No newline at end of file
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-05
00:07:16 UTC (rev 6534)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-05
05:42:47 UTC (rev 6535)
@@ -55,6 +55,8 @@
private String sessionFactoryJNDIName;
+ private RegistrationInfo nullRegistration;
+
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -73,10 +75,12 @@
ProducerInfo info = new ProducerInfo();
info.setId(id);
info.setRegistry(this);
+ info.setRegistrationInfo(nullRegistration);
try
{
Session session = sessionFactory.getCurrentSession();
+ session.refresh(nullRegistration);
session.persist(info);
}
catch (HibernateException e)
@@ -129,6 +133,13 @@
createConsumerFrom(producerInfo);
activateConsumerWith(producerInfo.getId());
}
+
+ nullRegistration = (RegistrationInfo)session.createQuery("from
RegistrationInfo where key = (select min(key) from
RegistrationInfo)").uniqueResult();
+ if (nullRegistration == null)
+ {
+ nullRegistration = new RegistrationInfo();
+ session.persist(nullRegistration);
+ }
}
private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
@@ -209,4 +220,9 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer
id", null);
return (WSRPConsumer)consumers.get(id);
}
+
+ public RegistrationInfo getDefaultRegistrationInfo()
+ {
+ return nullRegistration;
+ }
}
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-05
00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-05
05:42:47 UTC (rev 6535)
@@ -118,7 +118,6 @@
{
unregisteredServiceDescriptionRequest =
initUnregisteredServiceDescriptionRequest();
persistentEndpointInfo = new EndpointConfigurationInfo(this);
- persistentRegistrationInfo = RegistrationInfo.REGISTRATION_NOT_NEEDED;
}
public ConsumerRegistry getRegistry()
@@ -232,7 +231,7 @@
if (!persistentRegistrationInfo.isRegistrationValid())
{
// if this producer info was set up without any registration information,
create one
- if (RegistrationInfo.REGISTRATION_NOT_NEEDED ==
persistentRegistrationInfo)
+ if
(registry.getDefaultRegistrationInfo().equals(persistentRegistrationInfo))
{
persistentRegistrationInfo = new RegistrationInfo(this);
}
@@ -251,8 +250,6 @@
throw new PortletInvokerException("Received null response
after registration from producer '" + persistentId + "'");
}
- //todo: hook to registration subsystem correctly Registration should
deal with state and
- // it should be possible to create a RegistrationContext from a
Registration
persistentRegistrationInfo.setRegistrationContext(registrationContext);
log.info("Successfully registered with handle: '" +
registrationContext.getRegistrationHandle() + "'");
}
@@ -282,7 +279,7 @@
else
{
log.debug("Registration not required");
- setRegistrationInfo(RegistrationInfo.REGISTRATION_NOT_NEEDED);
+ setRegistrationInfo(registry.getDefaultRegistrationInfo());
setServiceDescriptionRequest(getUnregisteredServiceDescriptionRequest());
extractOfferedPortlets(serviceDescription);
return true;
@@ -566,7 +563,7 @@
WSRP_v1_PortletManagement_PortType service =
getEndpointConfigurationInfo().getPortletManagementService();
GetPortletPropertyDescription request =
WSRPTypeFactory.createSimpleGetPortletPropertyDescription(portletHandle);
-
request.setRegistrationContext(persistentRegistrationInfo.getRegistrationContext());
+ request.setRegistrationContext(getRegistrationContext());
request.setUserContext(null); // todo: fix me!
return service.getPortletPropertyDescription(request);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-03-05
00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-03-05
05:42:47 UTC (rev 6535)
@@ -52,7 +52,6 @@
*/
public class RegistrationInfo
{
- public final static RegistrationInfo REGISTRATION_NOT_NEEDED = new
RegistrationInfo();
private final Logger log = Logger.getLogger(getClass());
private Long key;
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-05
00:07:16 UTC (rev 6534)
+++
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-05
05:42:47 UTC (rev 6535)
@@ -33,14 +33,13 @@
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <many-to-one
- name="endpointConfigurationInfo"
- column="ENDPOINT_ID"
- class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
- unique="true"
- not-null="true"
- cascade="all"
- lazy="false"/>
+ <many-to-one name="endpointConfigurationInfo"
+ column="ENDPOINT_ID"
+
class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
+ unique="true"
+ not-null="true"
+ cascade="all"
+ lazy="false"/>
<many-to-one name="registrationInfo"
column="REGISTRATION_ID"
class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
Show replies by date