Author: chris.laprun(a)jboss.com
Date: 2007-11-08 00:12:27 -0500 (Thu, 08 Nov 2007)
New Revision: 8846
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
Log:
- JBPORTAL-1783: Return "sane" values when possible when optional WSRP services
are not available.
- JBPORTAL-1786: Cleaned-up Producer service definition to use
portal:service=PortletInvoker,type=Producer for its PortletInvoker instead of defining a
new one.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-08 04:49:10 UTC (rev 8845)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/build.xml 2007-11-08 05:12:27 UTC (rev 8846)
@@ -158,7 +158,7 @@
<pathelement path="${jboss.deploy.lib.dir}/jbosssx.jar"/>
<pathelement
path="${jboss.deploy.lib.dir}/jboss-transaction.jar"/>
<path refid="jboss.serialization.classpath"/>
- <path refid="jboss.remoting.classpath"/>
+ <path refid="jboss.remoting.classpath"/>
</path>
<!-- Configure modules -->
@@ -182,8 +182,8 @@
<property name="build.gen.classes"
value="${build.gen}/generated"/>
<property name="jboss.endorsed.dir"
location="${jboss.home}/lib/endorsed"/>
-
+
<path id="aop.classpath">
<!-- not directly available in AS -->
<pathelement
path="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
@@ -207,12 +207,12 @@
<property name="javadoc.private" value="true"/>
<property name="javadoc.protected" value="false"/>
- <property name="log.dir" value="${module.output}/logs"/>
+ <property name="log.dir" value="${module.output}/logs"/>
<property name="reports.dir"
value="${module.output}/reports"/>
<property name="test.reports"
value="${module.output}/tests"/>
<property name="build.resources.test"
value="${build.resources}/tests"/>
<property name="build.lib.test"
value="${build.lib}/tests"/>
- </target>
+ </target>
<target name="configure-jbossaop">
<path id="jbossaop.task.classpath">
@@ -228,15 +228,15 @@
classpathref="jbossaop.task.classpath"/>
</target>
- <target name="configure-explode">
+ <target name="configure-explode">
<path id="explode.task.classpath">
- <pathelement location="${project.tools}/lib/explode.jar"/>
- <path refid="apache.ant.classpath"/>
+ <pathelement location="${project.tools}/lib/explode.jar"/>
+ <path refid="apache.ant.classpath"/>
</path>
<taskdef name="explode"
classname="org.jboss.portal.common.ant.Explode"
classpathref="explode.task.classpath"/>
- </target>
+ </target>
<!--+====================================================================+-->
<!--| Compile |-->
@@ -282,7 +282,7 @@
</aopc>
<property name="compile.disable" value="true"/>
- </target>
+ </target>
<!--+====================================================================+-->
<!--| Generate Output |-->
@@ -317,11 +317,11 @@
<ant inheritAll="false" antfile="../core-wsrp/build.xml"
output="output.log" dir="../core-wsrp" target="output">
<property name="build.lib" value="${build.lib}"/>
<property name="build.resources"
value="${build.resources}"/>
- </ant>
+ </ant>
<copy todir="${build.resources}/portal-wsrp-sar"
overwrite="true">
<fileset dir="${build.lib}"
includes="portal-wsrp-client.jar"/>
<fileset dir="${build.lib}"
includes="portal-wsrp.war"/>
- </copy>
+ </copy>
<copy todir="${build.resources}/portal-wsrp-sar"
overwrite="true">
<fileset dir="${build.lib}"
includes="portal-wsrp-lib.jar"/>
@@ -423,32 +423,32 @@
<target name="package-deployment-test" description="Generates the
deployment test artifacts" depends="compile">
<jar jarfile="${build.lib.test}/test-deployment-lib.jar">
- <fileset
dir="${build.resources.test}/test-deployment-lib-jar"/>
- <fileset dir="${build.classes}/">
- <include name="org/jboss/portal/test/wsrp/deployment/**"/>
- <include
name="org/jboss/portal/test/wsrp/framework/support/**"/>
- </fileset>
+ <fileset
dir="${build.resources.test}/test-deployment-lib-jar"/>
+ <fileset dir="${build.classes}/">
+ <include name="org/jboss/portal/test/wsrp/deployment/**"/>
+ <include
name="org/jboss/portal/test/wsrp/framework/support/**"/>
+ </fileset>
</jar>
</target>
<target name="package-producer-configuration-test"
description="Generates the producer configuration test artifacts"
depends="compile">
<jar
jarfile="${build.lib.test}/test-producer-configuration-lib.jar">
- <fileset
dir="${build.resources.test}/test-producer-configuration-lib-jar"/>
- <fileset dir="${source.resources}/portal-wsrp-sar/dtd"/>
- <fileset dir="${build.classes}/">
- <include name="org/jboss/portal/test/wsrp/config/**"/>
- </fileset>
+ <fileset
dir="${build.resources.test}/test-producer-configuration-lib-jar"/>
+ <fileset dir="${source.resources}/portal-wsrp-sar/dtd"/>
+ <fileset dir="${build.classes}/">
+ <include name="org/jboss/portal/test/wsrp/config/**"/>
+ </fileset>
</jar>
</target>
<target name="package-other-test" description="Generates the other
test artifacts" depends="compile">
<jar jarfile="${build.lib.test}/test-other-lib.jar">
- <fileset dir="${build.classes}/">
- <include name="org/jboss/portal/test/wsrp/framework/**"/>
- <include name="org/jboss/portal/test/wsrp/other/*.class"/>
- <include
name="org/jboss/portal/test/wsrp/handler/*.class"/>
- </fileset>
+ <fileset dir="${build.classes}/">
+ <include name="org/jboss/portal/test/wsrp/framework/**"/>
+ <include name="org/jboss/portal/test/wsrp/other/*.class"/>
+ <include name="org/jboss/portal/test/wsrp/handler/*.class"/>
+ </fileset>
</jar>
</target>
@@ -526,7 +526,7 @@
<jar
jarfile="${build.lib.test}/test-wsrp-consumer-portletmanagement.sar">
<fileset
dir="${build.resources.test}/test-wsrp-consumer-portletmanagement-sar"
includes="**/*"/>
</jar>
- </target>
+ </target>
<!-- Producer tests -->
<target name="package-protocolv1-producer-test"
description="Generate the producer test artifacts"
@@ -547,7 +547,7 @@
<!-- WS related -->
<jar jarfile="${build.lib.test}/test-wsrp-producer.war">
<fileset dir="${build.resources.test}/test-wsrp-producer-war"/>
- </jar>
+ </jar>
<copy todir="${build.resources.test}/test-wsrp-producer-sar"
overwrite="true">
<fileset dir="${build.lib.test}"
includes="test-wsrp-producer.war"/>
@@ -592,7 +592,7 @@
</target>
<!-- Test portlets -->
- <target name="package-test-portlets" description="Generate the test
portlets archives" depends="compile">
+ <target name="package-test-portlets" description="Generate the test
portlets archives" depends="compile">
<!-- Simple test portlet -->
<package-test-portlet archiveName="basic"
portletName="Basic"/>
@@ -709,21 +709,21 @@
</zest>
</x-test>
<x-sysproperty>
-<!--
- <jvmarg value="-Xdebug"/>
- <jvmarg value="-Xnoagent"/>
- <jvmarg value="-Djava.compiler=NONE"/>
- <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
--->
+ <!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=NONE"/>
+ <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
+ -->
<sysproperty key="test.root"
value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
<fileset dir="${build.lib.test}"
includes="test-wsrp-producer-lib.jar"/>
- <path refid="tests.classpath"/>
+ <path refid="tests.classpath"/>
</x-classpath>
</execute-tests>
<antcall target="undeploy-producer-test"/>
- </target>
+ </target>
<!--WSRP v1 Protocol Consumer implementation tests-->
<target name="protocolv1-consumer-test"
depends="deploy-consumer-test">
@@ -749,12 +749,12 @@
</zest>
</x-test>
<x-sysproperty>
-<!--
- <jvmarg value="-Xdebug"/>
- <jvmarg value="-Xnoagent"/>
- <jvmarg value="-Djava.compiler=NONE"/>
- <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
--->
+ <!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=NONE"/>
+ <jvmarg
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"/>
+ -->
<sysproperty key="test.root"
value="${build.lib}/tests"/>
</x-sysproperty>
<x-classpath>
@@ -901,7 +901,7 @@
</execute-tests>
</target>
- <target name="reports">
+ <target name="reports">
<junitreport todir="${reports.dir}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-11-08
04:49:10 UTC (rev 8845)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-11-08
05:12:27 UTC (rev 8846)
@@ -119,10 +119,14 @@
behavior.addPortletDescription(behavior.createPortletDescription("test",
null));
serviceFactory.getRegistry().setServiceDescriptionBehavior(behavior);
+ // activate caching for this test so that we can simulate portlet deployment on the
producer with a cached SD
+ info.setExpirationCacheSeconds(1000);
+
PortletContext portletContext =
PortletContext.createPortletContext("test");
Portlet portlet = info.getPortlet(portletContext);
assertNotNull(portlet);
assertEquals(portletContext, portlet.getContext());
+ assertEquals(1, behavior.getCallCount());
// test2 is not in the service description, so it should be looked up via Portlet
Management...
portletContext = PortletContext.createPortletContext("test2");
@@ -133,6 +137,16 @@
assertEquals(1, pmBehavior.getCallCount());
assertNotNull(portlet);
assertEquals(portletContext, portlet.getContext());
+
+ // try again, this time without a portlet management interface, the service
description should be refreshed
+ serviceFactory.getRegistry().setPortletManagementBehavior(null);
+ // simulate a new portlet deployment since last time the SD was refreshed
+ behavior.addPortletDescription(behavior.createPortletDescription("test3",
null));
+ portletContext = PortletContext.createPortletContext("test3");
+ portlet = info.getPortlet(portletContext);
+ assertEquals(2, behavior.getCallCount());
+ assertNotNull(portlet);
+ assertEquals(portletContext, portlet.getContext());
}
public void testRefreshAndRegistration() throws Exception
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-08
04:49:10 UTC (rev 8845)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-08
05:12:27 UTC (rev 8846)
@@ -35,6 +35,7 @@
import org.jboss.portal.wsrp.consumer.portlet.WSRPPortlet;
import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.jboss.portal.wsrp.core.CookieProtocol;
+import org.jboss.portal.wsrp.core.Fault;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
import org.jboss.portal.wsrp.core.GetServiceDescription;
@@ -445,22 +446,9 @@
// check if we need to refresh
boolean justRefreshed = refresh(false);
- Portlet portlet = null;
// First try caches if caches are still valid or we just refreshed
- if (justRefreshed || (useCache() && !isCacheExpired()))
- {
- log.debug("Trying cached POPs");
+ Portlet portlet = getPortletFromCaches(portletHandle, justRefreshed);
- portlet = (Portlet)popsMap.get(portletHandle);
-
- if (portlet == null && ccpsMap != null)
- {
- log.debug("Trying cached CCPs");
- portlet = (Portlet)ccpsMap.get(portletHandle);
- }
- }
-
-
if (portlet != null) // we had a match in cache, return it
{
log.debug("Portlet was cached");
@@ -468,7 +456,7 @@
}
else // otherwise, retrieve just the information for the appropriate portlet
{
- log.debug("Retrieving portlet via getPortletDescription");
+ log.debug("Trying to retrieve portlet via getPortletDescription");
GetPortletDescription gpd =
WSRPTypeFactory.createGetPortletDescription(getRegistrationContext(), portletContext);
gpd.setUserContext(UserAccess.getUserContext());
@@ -494,11 +482,43 @@
}
catch (Exception e)
{
- throw new InvokerUnavailableException("Couldn't access remote
producer '" + persistentId + "'", e);
+ log.debug("Couldn't get portlet via getPortletDescription for
producer '" + persistentId
+ + "'. Attempting to retrieve it from the service description as
this producer might not support the PortletManagement interface.", e);
+
+ justRefreshed = refresh(true);
+ portlet = getPortletFromCaches(portletHandle, justRefreshed);
+
+ if (portlet == null)
+ {
+ throw new NoSuchPortletException(portletHandle);
+ }
+ else
+ {
+ return portlet;
+ }
}
}
}
+ private Portlet getPortletFromCaches(String portletHandle, boolean justRefreshed)
+ {
+ Portlet portlet = null;
+
+ if (justRefreshed || (useCache() && !isCacheExpired()))
+ {
+ log.debug("Trying cached POPs");
+
+ portlet = (Portlet)popsMap.get(portletHandle);
+
+ if (portlet == null && ccpsMap != null)
+ {
+ log.debug("Trying cached CCPs");
+ portlet = (Portlet)ccpsMap.get(portletHandle);
+ }
+ }
+ return portlet;
+ }
+
public Map getPortletGroupMap() throws PortletInvokerException
{
refresh(false);
@@ -654,8 +674,10 @@
}
catch (Exception e)
{
+ // if we receive an exception that we cannot handle, since the support for
PortletManagement is optional,
+ // just return null as if the portlet had no properties
log.debug("Couldn't get property descriptions for portlet '" +
portletHandle + "'", e);
- throw new RuntimeException(e);
+ return null;
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-11-08
04:49:10 UTC (rev 8845)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-11-08
05:12:27 UTC (rev 8846)
@@ -318,7 +318,9 @@
}
catch (Exception e)
{
- throw new PortletInvokerException("Couldn't get properties for portlet
'" + portletContext.getId() + "'", e);
+ // something went wrong but support for getPortletProperties is optional so
return an empty PropertyMap
+ log.debug("Couldn't get properties for portlet '" +
portletContext.getId() + "'", e);
+ return new SimplePropertyMap();
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-11-08
04:49:10 UTC (rev 8845)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-11-08
05:12:27 UTC (rev 8846)
@@ -23,53 +23,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<server>
- <!-- Producer interceptor stack -->
- <mbean
-
code="org.jboss.portal.server.impl.invocation.JBossInterceptorStackFactory"
- name="portal:service=InterceptorStackFactory,type=WSRP"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends-list optional-attribute-name="InterceptorNames">
-
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ContextDispatcher</depends-list-element>
-
<depends-list-element>portal:service=Interceptor,type=Portlet,name=WindowStates</depends-list-element>
-
<depends-list-element>portal:service=Interceptor,type=Portlet,name=Modes</depends-list-element>
-
<depends-list-element>portal:service=Interceptor,type=Portlet,name=ProducerCache</depends-list-element>
- </depends-list>
- </mbean>
-
- <!-- The producer portlet invoker -->
- <mbean
- code="org.jboss.portal.portlet.state.producer.ProducerPortletInvoker"
- name="portal:service=PortletInvoker,type=WSRPProducer"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends
- optional-attribute-name="PortletInvoker"
-
proxy-type="attribute">portal:service=WSRPPortletInvoker,type=Container</depends>
- <depends
- optional-attribute-name="PersistenceManager"
-
proxy-type="attribute">portal:service=PersistenceManager,type=Producer</depends>
- <depends
- optional-attribute-name="StateManagementPolicy"
-
proxy-type="attribute">portal:service=StateManagementPolicy,type=Producer</depends>
- <depends
- optional-attribute-name="StateConverter"
-
proxy-type="attribute">portal:service=StateConverter,type=Producer</depends>
- </mbean>
-
- <!-- The portlet container invoker -->
- <mbean
- code="org.jboss.portal.portlet.container.PortletContainerInvoker"
- name="portal:service=WSRPPortletInvoker,type=Container"
- xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
- <xmbean/>
- <depends optional-attribute-name="StackFactory"
proxy-type="attribute">portal:service=InterceptorStackFactory,type=WSRP</depends>
- <depends optional-attribute-name="Registry"
proxy-type="attribute">portal:service=WebAppRegistry</depends>
- </mbean>
-
<!-- WSRP Producer implementation -->
<mbean
code="org.jboss.portal.wsrp.producer.WSRPProducerImpl"
@@ -77,10 +30,14 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="Invoker"
-
proxy-type="attribute">portal:service=PortletInvoker,type=WSRPProducer</depends>
- <depends optional-attribute-name="RegistrationManager"
proxy-type="attribute">portal.wsrp:service=RegistrationManager,type=Producer</depends>
- <depends optional-attribute-name="ProducerConfigurationService"
proxy-type="attribute">portal.wsrp:service=ProducerConfiguration</depends>
+ <depends optional-attribute-name="Invoker"
proxy-type="attribute">portal:service=PortletInvoker,type=Producer
+ </depends>
+ <depends optional-attribute-name="RegistrationManager"
proxy-type="attribute">
+ portal.wsrp:service=RegistrationManager,type=Producer
+ </depends>
+ <depends optional-attribute-name="ProducerConfigurationService"
proxy-type="attribute">
+ portal.wsrp:service=ProducerConfiguration
+ </depends>
</mbean>
<!-- Registration manager -->
@@ -88,7 +45,9 @@
name="portal.wsrp:service=RegistrationManager,type=Producer"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="PersistenceManager"
proxy-type="attribute">portal.wsrp:service=PersistenceManager</depends>
+ <depends optional-attribute-name="PersistenceManager"
proxy-type="attribute">
+ portal.wsrp:service=PersistenceManager
+ </depends>
</mbean>
<!-- Persistence manager for registrations -->
@@ -105,7 +64,7 @@
name="portal.wsrp:service=ProducerConfiguration"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <attribute
name="ConfigLocation">conf/producer/config.xml</attribute>
+ <attribute
name="ConfigLocation">conf/producer/config.xml</attribute>
</mbean>
<mbean
@@ -117,9 +76,11 @@
<attribute name="DTDMapping">
<properties>
<entry
- key="-//JBoss Portal//DTD WSRP Remote Producer Configuration
2.6//EN">dtd/jboss-wsrp-consumer_2_6.dtd</entry>
+ key="-//JBoss Portal//DTD WSRP Remote Producer Configuration
2.6//EN">dtd/jboss-wsrp-consumer_2_6.dtd
+ </entry>
<entry
- key="-//JBoss Portal//DTD WSRP Local Producer Configuration
2.6//EN">dtd/jboss-wsrp-producer_2_6.dtd</entry>
+ key="-//JBoss Portal//DTD WSRP Local Producer Configuration
2.6//EN">dtd/jboss-wsrp-producer_2_6.dtd
+ </entry>
</properties>
</attribute>
</mbean>
@@ -129,9 +90,11 @@
<attribute
name="DefaultWSRPLocation">default-wsrp.xml</attribute>
<depends>jboss.system:service=MainDeployer</depends>
<depends optional-attribute-name="ConsumerRegistry"
-
proxy-type="attribute">portal.wsrp:service=ConsumerRegistry</depends>
+ proxy-type="attribute">portal.wsrp:service=ConsumerRegistry
+ </depends>
<depends optional-attribute-name="EntityResolver"
-
proxy-type="attribute">portal.wsrp:service=EntityResolver</depends>
+ proxy-type="attribute">portal.wsrp:service=EntityResolver
+ </depends>
</mbean>
<mbean
@@ -156,8 +119,12 @@
<xmbean/>
<depends>portal:service=Hibernate,type=WSRPConsumer</depends>
<attribute
name="SessionFactoryJNDIName">java:/portal/WSRPConsumerSessionFactory</attribute>
- <depends optional-attribute-name="FederatingPortletInvoker"
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
- <depends optional-attribute-name="PortalEventListenerRegistry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
- </mbean>
+ <depends optional-attribute-name="FederatingPortletInvoker"
proxy-type="attribute">
+ portal:service=PortletInvoker,type=Federating
+ </depends>
+ <depends optional-attribute-name="PortalEventListenerRegistry"
proxy-type="attribute">
+ portal:service=ListenerRegistry
+ </depends>
+ </mbean>
</server>