Author: chris.laprun(a)jboss.com
Date: 2007-02-25 22:58:07 -0500 (Sun, 25 Feb 2007)
New Revision: 6400
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- Added cascade properties in Hibernate mapping where relevant (my Hibernate-fu is
rusty...)
- Added more information display in WSRPDeploymentFactory.
- Still needs work... in particular with respect to where consumers should be started.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-25
08:26:14 UTC (rev 6399)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-26
03:58:07 UTC (rev 6400)
@@ -29,7 +29,6 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
-import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
import javax.naming.InitialContext;
import java.util.Collection;
@@ -85,8 +84,6 @@
Session session = sessionFactory.getCurrentSession();
ProducerInfo info = consumer.getProducerInfo();
- session.persist(info.getEndpointConfigurationInfo());
- session.persist(info.getRegistrationInfo());
session.persist(info);
createAndActivateConsumerIfNeeded(info);
@@ -128,7 +125,7 @@
WSRPConsumer consumer = new WSRPConsumerImpl();
consumer.setProducerInfo(producerInfo);
consumers.put(producerInfo.getId(), consumer);
- if (producerInfo.isActive())
+ /*if (producerInfo.isActive())
{
WSRPConsumerService service = new WSRPConsumerService();
service.setConsumer(consumer);
@@ -141,7 +138,7 @@
{
throw new ConsumerException("Couldn't start Consumer service
'" + producerInfo.getId() + "'", e);
}
- }
+ }*/
return consumer;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25
08:26:14 UTC (rev 6399)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-26
03:58:07 UTC (rev 6400)
@@ -110,16 +110,33 @@
String id = attrs.getValue("id");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "producer
identifier", "Configuring a producer");
+ WSRPConsumerService service = new WSRPConsumerService();
+
// check that the consumer doesn't exist in the database first
WSRPConsumer consumer = consumerRegistry.getConsumer(id);
if (consumer != null)
{
+ service.setConsumer(consumer);
+ String message = "Added consumer for producer '" +
service.getId() + "' with status: ";
+
+ // if consumer is active, add it to the list of services
+ if (consumer.getProducerInfo().isActive())
+ {
+ deployment.getServices().add(service);
+ message += "active";
+ }
+ else
+ {
+ message += "inactive";
+ }
+
+ log.info(message + " (loaded from database).");
+
// consumer already exists, do not further process this producer and use the
DB configuration instead
return null;
}
// consumer didn't exist in the database, so create one and configure it
- WSRPConsumerService service = new WSRPConsumerService();
consumer = new WSRPConsumerImpl();
ProducerInfo info = consumer.getProducerInfo();
info.setId(id);
@@ -134,7 +151,7 @@
}
catch (NumberFormatException e)
{
- System.out.println("Ignoring bad expiration cache value " +
expirationCache);
+ log.info("Ignoring bad expiration cache value " +
expirationCache + " for producer '" + id + "'");
}
}
@@ -305,13 +322,12 @@
System.out.println("addchild deployment service " + localName);
}
- // persist consumer to the database now that it's complete
- consumerRegistry.persistConsumer(service.getConsumer());
String message;
if (service.getConsumer().getServiceFactory().isAvailable())
{
- message = "Added consumer for producer '" + service.getId() +
"'";
+ message = "Added consumer for producer '" + service.getId() +
"' from xml configuration.";
+ service.getConsumer().getProducerInfo().setActive(true);
deployment.getServices().add(service);
}
else
@@ -320,6 +336,9 @@
+ service.getId() + "'. The consumer will NOT be available.";
}
+ // persist consumer to the database now that it's complete
+ consumerRegistry.persistConsumer(service.getConsumer());
+
log.info(message);
}
}
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-02-25
08:26:14 UTC (rev 6399)
+++
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-26
03:58:07 UTC (rev 6400)
@@ -26,14 +26,9 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
- <class
- name="org.jboss.portal.wsrp.consumer.ProducerInfo"
- table="JBP_PRODUCER_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.ProducerInfo"
table="JBP_PRODUCER_INFO">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <id
- name="key"
- column="PK"
- access="field">
+ <id name="key" column="PK" access="field">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
@@ -43,211 +38,105 @@
column="ENDPOINT_ID"
class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
unique="true"
- not-null="true"/>
- <many-to-one
- name="registrationInfo"
- column="REGISTRATION_ID"
- class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
- unique="true"
- not-null="false"/>
- <property
- name="expirationCacheSeconds"
- column="EXPIRATION_CACHE_SECONDS"
- not-null="false"
- unique="false"/>
- <property
- name="active"
- column="ACTIVE"
not-null="true"
- unique="false"/>
+ cascade="all"/>
+ <many-to-one name="registrationInfo"
+ column="REGISTRATION_ID"
+ class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
+ unique="true"
+ not-null="false"
+ cascade="all"/>
+ <property name="expirationCacheSeconds"
column="EXPIRATION_CACHE_SECONDS"/>
+ <property name="active" not-null="true"/>
<property name="id" not-null="true"
unique="true"/>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
- table="JBP_ENDPOINT_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
table="JBP_ENDPOINT_INFO">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK"
type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="serviceDescriptionURL"
- column="SD_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="markupURL"
- column="M_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="portletManagementURL"
- column="PM_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="registrationURL"
- column="R_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="wsdlDefinitionURL"
- column="WSDL_URL"
- type="java.lang.String"
- not-null="false"/>
+ <property name="serviceDescriptionURL" column="SD_URL"
type="java.lang.String" not-null="true"/>
+ <property name="markupURL" column="M_URL"
type="java.lang.String" not-null="true"/>
+ <property name="portletManagementURL" column="PM_URL"
type="java.lang.String" not-null="true"/>
+ <property name="registrationURL" column="R_URL"
type="java.lang.String" not-null="true"/>
+ <property name="wsdlDefinitionURL" column="WSDL_URL"
type="java.lang.String" not-null="false"/>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.RegistrationInfo"
- table="JBP_REGISTRATION_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.RegistrationInfo"
table="JBP_REGISTRATION_INFO">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK"
type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="consumerName"
- column="CONSUMER_NAME"
- type="java.lang.String"
- not-null="true"
- unique="true"/>
- <property
- name="registrationHandle"
- column="HANDLE"
- type="java.lang.String"/>
- <property
- name="registrationState"
- column="STATE"
- type="binary"/>
- <map
- name="registrationProperties">
+ <property name="consumerName" column="CONSUMER_NAME"
type="java.lang.String" not-null="true"/>
+ <property name="registrationHandle" column="HANDLE"
type="java.lang.String"/>
+ <property name="registrationState" column="STATE"
type="binary"/>
+ <map name="registrationProperties" cascade="all">
<cache usage="@portal.hibernate.cache.usage(a)"/>
<key column="REG_PROP_PK"/>
- <map-key
- type="string"
- column="NAME"/>
+ <map-key type="string" column="NAME"/>
<one-to-many
class="org.jboss.portal.wsrp.consumer.RegistrationProperty"/>
</map>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.RegistrationProperty"
- table="JBP_REG_PROPERTY">
+
+ <class name="org.jboss.portal.wsrp.consumer.RegistrationProperty"
table="JBP_REG_PROPERTY">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK"
type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="name"
- column="NAME"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="value"
- column="VALUE"
- type="java.lang.String"/>
- <property
- name="invalid"
- column="INVALID"
- type="boolean"/>
- <property
- name="lang"
- column="LANG"
- type="java.lang.String"/>
+ <property name="name" type="java.lang.String"
not-null="true"/>
+ <property name="value" type="java.lang.String"
not-null="true"/>
+ <property name="invalid" type="boolean"/>
+ <property name="lang" type="java.lang.String"/>
<many-to-one
name="description"
column="DESC_PK"
class="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
- not-null="true"
- unique="true"/>
+ unique="true"
+ cascade="all"/>
</class>
- <class
-
name="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
- table="JBP_REG_PROP_DESC">
+ <class
name="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
table="JBP_REG_PROP_DESC">
<cache usage="@portal.hibernate.cache.usage(a)"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK"
type="java.lang.Long">
<generator class="native">
<param name="sequence">portlet_seq</param>
</generator>
</id>
- <property
- name="name"
- column="NAME"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"/>
- <property
- name="type"
- column="TYPE"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"/>
- <property
- name="schemaLocation"
- column="SCHEMA"
- type="java.lang.String"/>
- <component
- name="description"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <property name="name"
type="org.jboss.portal.jems.hibernate.QNameUserType"
not-null="true"/>
+ <property name="type"
type="org.jboss.portal.jems.hibernate.QNameUserType"
not-null="true"/>
+ <property name="schemaLocation" column="SCHEMA"
type="java.lang.String"/>
+ <component name="description"
class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="DESC_VALUE"/>
<property name="locale" column="DESC_LOCALE"/>
<property name="resourceName" column="DESC_RES"/>
</component>
- <component
- name="hint"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <component name="hint"
class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="HINT_VALUE"/>
<property name="locale" column="HINT_LOCALE"/>
<property name="resourceName" column="HINT_RES"/>
</component>
- <component
- name="label"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <component name="label"
class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="LABEL_VALUE"/>
<property name="locale" column="LABEL_LOCALE"/>
<property name="resourceName" column="LABEL_RES"/>
</component>
- <array
- name="usages"
- table="JBP_REG_PROP_DESC_USAGES"
- cascade="all"
- fetch="join">
+ <array name="usages" table="JBP_REG_PROP_DESC_USAGES"
cascade="all" fetch="join">
<cache usage="@portal.hibernate.cache.usage(a)"/>
<key column="PK"/>
<index column="IDX"/>
- <element
- column="USAGE"
- type="java.lang.String"
- not-null="true"
- unique="false"/>
+ <element column="USAGE" type="java.lang.String"
not-null="true" unique="false"/>
</array>
- <array
- name="aliases"
- table="JBP_REG_PROP_DESC_ALIASES"
- cascade="all"
- fetch="join">
+ <array name="aliases" table="JBP_REG_PROP_DESC_ALIASES"
cascade="all" fetch="join">
<cache usage="@portal.hibernate.cache.usage(a)"/>
<key column="PK"/>
<index column="IDX"/>
- <element
- column="ALIAS"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"
- unique="false"/>
+ <element column="ALIAS"
type="org.jboss.portal.jems.hibernate.QNameUserType" not-null="true"
unique="false"/>
</array>
</class>
</hibernate-mapping>
Show replies by date