Author: chris.laprun(a)jboss.com
Date: 2006-11-21 22:13:47 -0500 (Tue, 21 Nov 2006)
New Revision: 5708
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
Log:
- Required registration is not a service, so shouldn't be handled like one.
- Producer can now access registration info via WSRPDeployer. This is pretty crappy so
need to find a better solution if possible.
- Adapted service definitions...
- Tests still don't pass
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22
02:16:17 UTC (rev 5707)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/DeploymentTestCase.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -67,7 +67,7 @@
WSRPDeployment deployment = (WSRPDeployment)o;
List services = deployment.getServices();
assertNotNull(services);
- assertEquals(5, services.size());
+ assertEquals(4, services.size());
//
Object service = services.get(0);
@@ -132,7 +132,7 @@
assertNotNull(registrationData.getConsumerName());
assertEquals(WSRPConstants.CONSUMER_AGENT, registrationData.getConsumerAgent());
- ProducerRegistrationRequirements requirements =
(ProducerRegistrationRequirements)services.get(4);
+ ProducerRegistrationRequirements requirements =
deployment.getRegistrationRequirements();
assertTrue(requirements.requiresRegistration());
assertTrue(requirements.fullServiceDescriptionRequiresRegistration());
Map properties = requirements.getRegistrationProperties();
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2006-11-22
02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -27,6 +27,7 @@
import org.jboss.deployment.SubDeployerSupport;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -59,6 +60,8 @@
/** . */
private String defaultWSRPLocation;
+ private ProducerRegistrationRequirements registrationRequirements;
+
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -79,6 +82,11 @@
this.defaultWSRPLocation = defaultWSRPLocation;
}
+ public ProducerRegistrationRequirements getProducerRegistrationRequirements()
+ {
+ return registrationRequirements;
+ }
+
public void init(DeploymentInfo di) throws DeploymentException
{
super.init(di);
@@ -105,6 +113,7 @@
{
super.start(di);
WSRPDeployment deployment = (WSRPDeployment)di.metaData;
+ registrationRequirements = deployment.getRegistrationRequirements();
for (Iterator i = deployment.getServices().iterator(); i.hasNext();)
{
try
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2006-11-22
02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -24,6 +24,7 @@
import org.jboss.deployment.SubDeployerExtMBean;
import org.jboss.portal.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,4 +39,6 @@
String getDefaultWSRPLocation();
void setDefaultWSRPLocation(String defaultWSRPLocation);
+
+ ProducerRegistrationRequirements getProducerRegistrationRequirements();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-11-22
02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployment.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.wsrp.deployment;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
import org.jboss.system.ServiceMBeanSupport;
import java.util.ArrayList;
@@ -33,8 +35,8 @@
*/
public class WSRPDeployment extends ServiceMBeanSupport implements WSRPDeploymentMBean
{
-
private final List services;
+ private ProducerRegistrationRequirements registrationRequirements;
public WSRPDeployment()
{
@@ -45,4 +47,15 @@
{
return services;
}
+
+ public ProducerRegistrationRequirements getRegistrationRequirements()
+ {
+ return registrationRequirements;
+ }
+
+ public void setRegistrationRequirements(ProducerRegistrationRequirements
registrationRequirements)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(registrationRequirements,
"Registration requirements");
+ this.registrationRequirements = registrationRequirements;
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22
02:16:17 UTC (rev 5707)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -446,6 +446,6 @@
System.out.println("addchild deployment regreq " + localName);
}
- deployment.getServices().add(regReq);
+ deployment.setRegistrationRequirements(regReq);
}
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-11-22
02:16:17 UTC (rev 5707)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -36,6 +36,7 @@
import org.jboss.portal.portlet.info.WindowStateInfo;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
@@ -44,7 +45,7 @@
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
import java.rmi.RemoteException;
import java.util.Collection;
@@ -132,14 +133,13 @@
private ServiceDescription refreshServiceDescription(String[] desiredLocales)
{
// todo: find out how to cache this
- RegistrationPolicy policy = producer.getRegistrationPolicy();
-// ServiceDescription serviceDescription =
WSRPTypeFactory.createServiceDescription(policy.getMetaData().requiresRegistration());
-// serviceDescription.setRequiresInitCookie(CookieProtocol.none);
-// PortletDescription[] descriptions =
(PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
-// .toArray(new PortletDescription[]{});
-// serviceDescription.setOfferedPortlets(descriptions);
-// return serviceDescription;
- throw new FixMe();
+ ProducerRegistrationRequirements requirements =
producer.getProducerRegistrationRequirements();
+ ServiceDescription serviceDescription =
WSRPTypeFactory.createServiceDescription(requirements.requiresRegistration());
+ serviceDescription.setRequiresInitCookie(CookieProtocol.none);
+ PortletDescription[] descriptions =
(PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
+ .toArray(new PortletDescription[]{});
+ serviceDescription.setOfferedPortlets(descriptions);
+ return serviceDescription;
}
/**
@@ -151,12 +151,10 @@
{
// todo: find out how to cache this
log.debug("Using service description offered for unregistered
consumers");
- RegistrationPolicy policy = producer.getRegistrationPolicy();
-// RegistrationMetaData metaData = policy.getMetaData();
-// return new ServiceDescription(true, null, null, null, null, null,
CookieProtocol.none,
-//
WSRPUtils.convertRegistrationPropertiesToModelDescription(metaData.getRegistrationProperties()),
-// producer.getSupportedLocales(), null, null);
- throw new FixMe();
+ ProducerRegistrationRequirements requirements =
producer.getProducerRegistrationRequirements();
+ return new ServiceDescription(true, null, null, null, null, null,
CookieProtocol.none,
+
WSRPUtils.convertRegistrationPropertiesToModelDescription(requirements.getRegistrationProperties()),
+ producer.getSupportedLocales(), null, null);
}
/**
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-22
02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-22
03:13:47 UTC (rev 5708)
@@ -24,7 +24,6 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.FixMe;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
@@ -75,8 +74,9 @@
import org.jboss.portal.wsrp.core.UnsupportedMimeTypeFault;
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
+import org.jboss.portal.wsrp.deployment.WSRPDeployer;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+import
org.jboss.portal.wsrp.producer.registration.impl.ProducerRegistrationRequirementsImpl;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.http.HttpSession;
@@ -112,9 +112,12 @@
/** Handles Portlet Management interface calls. */
private PortletManagementHandler portletManagementHandler;
- /** The RegistrationPolicy to be used by the registration handler. */
- private RegistrationPolicy registrationPolicy;
+ /** To access the required registration information */
+ private WSRPDeployer deployer;
+ private static final ProducerRegistrationRequirements
DEFAULT_REGISTRATION_REQUIREMENTS =
+ new ProducerRegistrationRequirementsImpl(false, false, false);
+
/**
* The ServiceDescription that is returned to an unregistred Consumer when
registration is required: no information
* is provided apart from the fact that registration is required and what information
is required to sucessfully
@@ -150,8 +153,14 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
-// return registrationPolicy.getMetaData();
- throw new FixMe();
+ ProducerRegistrationRequirements registrationRequirements =
DEFAULT_REGISTRATION_REQUIREMENTS;
+ if (deployer != null)
+ {
+ registrationRequirements = deployer.getProducerRegistrationRequirements();
+ }
+
+ // still need to check for null, in case there wasn't no registration info in
the descriptor
+ return registrationRequirements != null ? registrationRequirements :
DEFAULT_REGISTRATION_REQUIREMENTS;
}
// ServiceDescription implementation
********************************************************************************
@@ -254,15 +263,14 @@
return registrationState;
}
- public RegistrationPolicy getRegistrationPolicy()
+ public WSRPDeployer getDeployer()
{
- return registrationPolicy;
+ return deployer;
}
- public void setRegistrationPolicy(RegistrationPolicy registrationPolicy)
+ public void setDeployer(WSRPDeployer deployer)
{
- this.registrationPolicy = registrationPolicy;
- registrationHandler.setPolicy(registrationPolicy);
+ this.deployer = deployer;
}
// PortletManagement implementation
*********************************************************************************
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 2006-11-22
02:16:17 UTC (rev 5707)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2006-11-22
03:13:47 UTC (rev 5708)
@@ -77,9 +77,9 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends optional-attribute-name="RegistrationPolicy"
proxy-type="attribute">portal.wsrp:service=RegistrationPolicy</depends>
<depends optional-attribute-name="Invoker"
proxy-type="attribute">portal:service=PortletInvoker,type=WSRPProducer</depends>
+ <depends optional-attribute-name="Deployer"
proxy-type="attribute">portal.wsrp:service=WSRPDeployer</depends>
</mbean>
<!-- Configure a consumer that is the portal itself -->
Modified:
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml
===================================================================
---
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-11-22
02:16:17 UTC (rev 5707)
+++
trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml 2006-11-22
03:13:47 UTC (rev 5708)
@@ -171,10 +171,8 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
- <depends
- optional-attribute-name="Invoker"
-
proxy-type="attribute">portal:service=PortletInvoker,type=Stateful</depends>
- <depends optional-attribute-name="RegistrationPolicy"
proxy-type="attribute">portal.wsrp:service=RegistrationPolicy</depends>
+ <depends optional-attribute-name="Invoker"
+
proxy-type="attribute">portal:service=PortletInvoker,type=Stateful</depends>
<attribute name="RemotableByDefault">true</attribute>
</mbean>