Author: chris.laprun(a)jboss.com
Date: 2007-02-24 20:07:09 -0500 (Sat, 24 Feb 2007)
New Revision: 6394
Added:
trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
Removed:
trunk/wsrp/src/resources/jboss-portal-wsrp.dtd
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
Log:
- Added setter and getter for EntityResolver on WSRPDeployerMBean to fix deployment
issue.
- Activated DB-backed code on ConsumersRegistryService (will still require some major
work).
- Use AOP to add transaction support on ConsumersRegistryService.startService method.
- Added means to see registration context on registered clients in GUI.
- Removed old dtd.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-02-25 00:58:24 UTC (rev 6393)
+++ trunk/wsrp/build.xml 2007-02-25 01:07:09 UTC (rev 6394)
@@ -161,10 +161,20 @@
<path refid="jboss.serialization.classpath"/>
</path>
+ <path id="aop.classpath">
+ <pathelement
path="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
+ <pathelement path="${jboss.aop.lib}/jboss-aop.jar"/>
+ <path refid="javassist.javassist.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="trove.trove.classpath"/>
+ <path refid="qdox.qdox.classpath"/>
+ </path>
+
<!-- Configure defaults & build tools -->
<call target="configure-defaults"/>
<call target="configure-tools"/>
<call target="configure-explode"/>
+ <call target="configure-jbossaop"/>
<!--+=======================================+-->
<!--| Define module specific elements here. |-->
@@ -180,6 +190,20 @@
<property name="build.lib.test"
value="${build.lib}/tests"/>
</target>
+ <target name="configure-jbossaop">
+ <path id="jbossaop.task.classpath">
+ <path refid="jboss.aop.classpath"/>
+ <path refid="javassist.javassist.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="trove.trove.classpath"/>
+ <path refid="qdox.qdox.classpath"/>
+ </path>
+ <taskdef
+ name="aopc"
+ classname="org.jboss.aop.ant.AopC"
+ classpathref="jbossaop.task.classpath"/>
+ </target>
+
<target name="configure-explode">
<path id="explode.task.classpath">
<pathelement location="${project.tools}/lib/explode.jar"/>
@@ -217,6 +241,20 @@
</copy>
<mkdir dir="${build.lib.test}"/>
<mkdir dir="${build.resources.test}"/>
+
+ <path id="bilto">
+ <path refid="jbossas/core.libs.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ <pathelement path="${build.classes}"/>
+ </path>
+
+ <aopc compilerclasspathref="aop.classpath"
verbose="true">
+ <classpath refid="bilto"/>
+ <src path="${build.classes}"/>
+ <aoppath
path="${build.resources}/portal-wsrp-sar/wsrp-aop.xml"/>
+ <include
name="org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.class"/>
+ </aopc>
+
<property name="compile.disable" value="true"/>
</target>
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2007-02-25
00:58:24 UTC (rev 6393)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2007-02-25
01:07:09 UTC (rev 6394)
@@ -24,6 +24,7 @@
import org.jboss.deployment.SubDeployerExtMBean;
import org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry;
+import org.xml.sax.EntityResolver;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,4 +39,8 @@
ConsumersRegistry getConsumerRegistry();
void setConsumerRegistry(ConsumersRegistry consumerRegistry);
+
+ EntityResolver getEntityResolver();
+
+ void setEntityResolver(EntityResolver entityResolver);
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java 2007-02-25
00:58:24 UTC (rev 6393)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java 2007-02-25
01:07:09 UTC (rev 6394)
@@ -23,20 +23,22 @@
package org.jboss.portal.wsrp.portlet.consumers;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.WSRPConsumerImpl;
+import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
-import java.util.ArrayList;
+import javax.naming.InitialContext;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
-import java.util.List;
import java.util.SortedMap;
+import java.util.TreeMap;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -74,7 +76,7 @@
this.sessionFactoryJNDIName = sessionFactoryJNDIName;
}
- /*protected void startService() throws Exception
+ protected void startService() throws Exception
{
sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
@@ -90,7 +92,7 @@
consumer = new WSRPConsumerImpl();
consumer.setProducerInfo(producerInfo);
consumers.put(producerInfo.getId(), consumer);
- if(producerInfo.isActive())
+ if (producerInfo.isActive())
{
WSRPConsumerService service = new WSRPConsumerService();
service.setConsumer(consumer);
@@ -105,53 +107,53 @@
sessionFactory = null;
consumers.clear();
consumers = null;
- }*/
+ }
public Collection getConfiguredConsumers()
{
-// return Collections.unmodifiableCollection(consumers.values());
- Collection invokers = federatingPortletInvoker.getFederatedInvokers();
- if (invokers.isEmpty())
- {
- return Collections.EMPTY_LIST;
- }
-
- List result = new ArrayList(invokers.size());
- for (Iterator invokersIt = invokers.iterator(); invokersIt.hasNext();)
- {
- WSRPConsumer consumer =
getConsumerFrom((FederatedPortletInvoker)invokersIt.next());
-
- if (consumer != null)
- {
- result.add(consumer);
- }
- }
-
- return result;
+ return Collections.unmodifiableCollection(consumers.values());
}
public WSRPConsumer getConsumer(String id)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer
id", null);
- // return (WSRPConsumer) consumers.get(id);
- return getConsumerFrom(federatingPortletInvoker.getFederatedInvoker(id));
- }
+ return (WSRPConsumer)consumers.get(id);
- private WSRPConsumer getConsumerFrom(FederatedPortletInvoker service)
- {
- if (service == null)
- {
- return null;
- }
+ /*// first check if this consumer has already been loaded
+ WSRPConsumer wsrpConsumer = (WSRPConsumer)consumers.get(id);
- PortletInvoker invoker = service.getPortletInvoker();
- if (invoker instanceof WSRPConsumer)
+ if(wsrpConsumer != null)
{
- return (WSRPConsumer)invoker;
+ return wsrpConsumer;
}
else
{
+ Session session = sessionFactory.getCurrentSession();
+ Query query = session.createQuery("from ProducerInfo where id=:id");
+ query.setString("id", id);
+ ProducerInfo pi = (ProducerInfo)query.uniqueResult();
+ if (pi != null)
+ {
+ wsrpConsumer = new WSRPConsumerImpl();
+ wsrpConsumer.setProducerInfo(pi);
+ consumers.put(pi.getId(), wsrpConsumer);
+ if (pi.isActive())
+ {
+ WSRPConsumerService service = new WSRPConsumerService();
+ service.setConsumer(wsrpConsumer);
+ service.setFederatingPortletInvoker(federatingPortletInvoker);
+ try
+ {
+ service.start();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't start Consumer
'" + pi.getId() + "'", e);
+ }
+ }
+ return wsrpConsumer;
+ }
return null;
- }
+ }*/
}
}
Deleted: trunk/wsrp/src/resources/jboss-portal-wsrp.dtd
===================================================================
--- trunk/wsrp/src/resources/jboss-portal-wsrp.dtd 2007-02-25 00:58:24 UTC (rev 6393)
+++ trunk/wsrp/src/resources/jboss-portal-wsrp.dtd 2007-02-25 01:07:09 UTC (rev 6394)
@@ -1,85 +0,0 @@
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
-<!--
-JBoss Portal's WSRP Remote Producer Configuration deployment descriptor for the
*-wsrp.xml files used by Portal to be
-able to consume WSRP portlets exposed by a remote producer.
-author: <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
-version: 1.0 (Portal 2.4)
-revision: $Revision$
--->
-
-<!-- The root element. Contains deployment elements. -->
-<!ELEMENT deployments ( deployment* )>
-
-<!-- Deployment related information. As of 1.0 (Portal 2.4), the only deployment
information relates to WSRP producers. -->
-<!ELEMENT deployment ( wsrp-producer )>
-
-<!-- The WSRP producer information. -->
-<!ELEMENT wsrp-producer ( producer-id, expiration-cache?, ( endpoint-config |
endpoint-wsdl-url ), registration-data? )>
-
-<!-- The producer identifier. This should be unique for a given Portal deployment. The
identifier is used to
-identify the portlet provider in the management interface. -->
-<!ELEMENT producer-id ( #PCDATA )>
-
-<!-- The period of producer information (such as list of offered portlets) cache
refreshing in seconds. -->
-<!ELEMENT expiration-cache ( #PCDATA )>
-
-<!-- WSRP endpoints configuration information by interface URL. Mutually exclusive
with endpoint-wsdl-url. -->
-<!ELEMENT endpoint-config ( service-description-url, markup-url, registration-url?,
portlet-management-url? )>
-
-<!-- The URL for the service description interface endpoint on the remote producer.
-->
-<!ELEMENT service-description-url ( #PCDATA )>
-
-<!-- The URL for the markup interface endpoint on the remote producer. -->
-<!ELEMENT markup-url ( #PCDATA )>
-
-<!-- The URL for the optional portlet management interface endpoint on the remote
producer. -->
-<!ELEMENT portlet-management-url ( #PCDATA )>
-
-<!-- The URL for the optional registration interface endpoint on the remote producer.
-->
-<!ELEMENT registration-url ( #PCDATA )>
-
-<!-- The URL of the WSDL description of the producer's WSRP services. Mutally
exclusive with endpoint-config. -->
-<!ELEMENT endpoint-wsdl-url ( #PCDATA )>
-
-<!-- Container for registration information. -->
-<!ELEMENT registration-data ( consumer-name?, property* )>
-
-<!--
-An optional name (preferably unique) that identifies the Consumer. An example of such a
name would be the Consumer's URL.
-If no consumer-name is provided, one will be automatically generated by JBoss Portal.
--->
-<!ELEMENT consumer-name ( #PCDATA )>
-
-<!-- A registration property. -->
-<!ELEMENT property ( name, lang, value )>
-
-<!-- The name of the property. -->
-<!ELEMENT name ( #PCDATA )>
-
-<!-- The language the property is in. -->
-<!ELEMENT lang ( #PCDATA )>
-
-<!-- The value of the property. -->
-<!ELEMENT value ( #PCDATA )>
\ No newline at end of file
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-02-25
00:58:24 UTC (rev 6393)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-25
01:07:09 UTC (rev 6394)
@@ -148,7 +148,7 @@
<attribute
name="JNDIName">java:/portal/WSRPConsumerSessionFactory</attribute>
</mbean>
- <!-- Consumers registry for WSRP consumer configuration portlet -->
+ <!-- Consumers registry for WSRP consumers -->
<mbean
code="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistryService"
name="portal.wsrp:service=ConsumersRegistry"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Added: trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml (rev 0)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-02-25 01:07:09 UTC (rev
6394)
@@ -0,0 +1,64 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<aop>
+ <metadata tag="transaction"
class="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistryService">
+ <method name="startService">
+ <trans-attribute>Required</trans-attribute>
+ </method>
+ </metadata>
+
+ <!-- TRANSACTIONS -->
+ <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor"
scope="PER_VM"/>
+ <interceptor factory="org.jboss.aspects.tx.TxInterceptorFactory"
scope="PER_CLASS_JOINPOINT"/>
+
+ <bind pointcut="all(@transaction)">
+ <interceptor-ref
name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <interceptor name="class-txsynchronized"
factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_CLASS"/>
+ <interceptor name="instance-txsynchronized"
factory="org.jboss.aspects.txlock.TxLockInterceptorFactory"
+ scope="PER_INSTANCE"/>
+
+ <bind pointcut="execution(static * *->@TxSynchronized(..)) OR
execution(*->@TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static * *->@TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="all((a)org.jboss.aspects.tx.Tx)">
+ <interceptor-ref
name="org.jboss.aspects.tx.TxInterceptorFactory"/>
+ </bind>
+
+ <bind
+ pointcut="execution(static *
*->@org.jboss.aspects.txlock.TxSynchronized(..)) OR
execution(*->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="class-txsynchronized"/>
+ </bind>
+
+ <bind pointcut="execution(!static *
*->@org.jboss.aspects.txlock.TxSynchronized(..))">
+ <interceptor-ref name="instance-txsynchronized"/>
+ </bind>
+</aop>
\ No newline at end of file
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-25
00:58:24 UTC (rev 6393)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-25
01:07:09 UTC (rev 6394)
@@ -144,7 +144,19 @@
%>
</td>
</tr>
+<%
+ if (regInfo.isRegistrationValid())
+ {
+%>
<tr>
+ <th>Registration context:</th>
+ <td>Handle: <%=regInfo.getRegistrationContext().getRegistrationHandle()%>
+ </td>
+</tr>
+<%
+ }
+%>
+<tr>
<td colspan="2">
<input type="submit" name="editConsumer"
value="Save" class="portlet-form-button"/>
<a href="<portlet:renderURL>