Author: chris.laprun(a)jboss.com
Date: 2006-11-25 21:55:41 -0500 (Sat, 25 Nov 2006)
New Revision: 5721
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.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/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
Log:
- It's now possible to access the RegistrationManager via the producer's public
interface.
- Added clear method on RegistrationManager and associated test case (needed to properly
reset state between tests).
- Fixed incorrect behavior of GSD wrt providing or not the portlet descriptions.
- Fixed incorrect behavior where invalid consumer agent would still result in successful
registration.
- Code clean up.
- Added registration configuration tests to global tests.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2006-11-25 19:35:00 UTC (rev 5720)
+++ trunk/wsrp/build.xml 2006-11-26 02:55:41 UTC (rev 5721)
@@ -542,10 +542,10 @@
<antcall target="agent-deploy"/>
<antcall target="producer-test"/>
<antcall target="consumer-test"/>
- <antcall target="registration-configuration-test"/>
<antcall target="deployment-test"/>
<antcall target="other-test"/>
<antcall target="registration-test"/>
+ <antcall target="registration-configuration-test"/>
<antcall target="agent-undeploy"/>
<server:stop name="default"/>
<antcall target="reports"/>
@@ -557,6 +557,7 @@
<antcall target="deployment-test"/>
<antcall target="other-test"/>
<antcall target="registration-test"/>
+ <antcall target="registration-configuration-test"/>
</target>
<!-- WSRP Producer tests -->
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -71,6 +71,7 @@
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
@@ -366,6 +367,12 @@
public ProducerRegistrationRequirements getProducerRegistrationRequirements()
{
- return null; // todo: implement
+ throw new UnsupportedOperationException("getProducerRegistrationRequirements
not implemented");
}
+
+
+ public RegistrationManager getRegistrationManager()
+ {
+ throw new UnsupportedOperationException("getRegistrationManager not
implemented");
+ }
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -319,7 +319,6 @@
{
String consumerName = "consumer";
Consumer consumer = manager.createConsumer(consumerName);
- String consumerIdentity = consumer.getIdentity();
Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
String handle = reg.getRegistrationHandle();
@@ -369,4 +368,20 @@
{
}
}
+
+ public void testClear() throws Exception
+ {
+ manager.createConsumer("c1");
+ manager.createConsumer("c2");
+ manager.addConsumerToGroupNamed("c1g1", "g1", true, true);
+ manager.createConsumerGroup("g2");
+ Registration r1 = manager.addRegistrationTo("c1", registrationProperties,
false);
+ Registration r2 = manager.addRegistrationTo("c3", registrationProperties,
true);
+
+ manager.clear();
+ assertTrue(manager.getConsumerGroups().isEmpty());
+ assertTrue(manager.getConsumers().isEmpty());
+ assertNull(manager.getRegistration(r1.getRegistrationHandle()));
+ assertNull(manager.getRegistration(r2.getRegistrationHandle()));
+ }
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -25,20 +25,11 @@
import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.wsrp.WSRPConstants;
-import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetServiceDescription;
-import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
-import org.jboss.portal.wsrp.core.ModelDescription;
-import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
-import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.core.ServiceDescription;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
-import javax.xml.namespace.QName;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
@@ -74,7 +65,7 @@
*/
public void testConsumerAgent() throws Exception
{
- initRegistrationInfo();
+ configureRegistrationSettings(false);
RegistrationData regData = createBaseRegData();
regData.setConsumerAgent("invalid consumer agent");
@@ -92,7 +83,7 @@
registrationService.register(regData);
}
- public void testDeregister() throws Exception
+ /*public void testDeregister() throws Exception
{
// initiate registration
initRegistrationInfo();
@@ -114,9 +105,9 @@
{
// expected
}
- }
+ }*/
- public void testModifyRegistration() throws Exception
+ /*public void testModifyRegistration() throws Exception
{
// initiate registration
initRegistrationInfo();
@@ -161,33 +152,18 @@
registrationService.modifyRegistration(new ModifyRegistration(rc, regData));
gs.setRegistrationContext(rc);
checkServiceDescriptionWithOnlyBasicPortlet(gs);
- }
+ }*/
public void testRegister() throws Exception
{
- RegistrationPropertyDescription regProp = initRegistrationInfo();
+ configureRegistrationSettings(false);
// service description request without registration info
GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
- //Invoke the Web Service
- ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);
-
- ExtendedAssert.assertNotNull(sd);
- ExtendedAssert.assertTrue(sd.isRequiresRegistration());
-
- // Check registration properties
- ModelDescription registrationPropertyDescription =
sd.getRegistrationPropertyDescription();
- ExtendedAssert.assertNotNull(registrationPropertyDescription);
- PropertyDescription[] propertyDescriptions =
registrationPropertyDescription.getPropertyDescriptions();
- ExtendedAssert.assertNotNull(propertyDescriptions);
- ExtendedAssert.assertEquals(1, propertyDescriptions.length);
- assertEquals(WSRPUtils.convertToPropertyDescription(regProp),
propertyDescriptions[0]);
-
- // No offered portlets without registration!
- ExtendedAssert.assertNull(sd.getOfferedPortlets());
-
RegistrationContext registrationContext = registerConsumer();
+ ExtendedAssert.assertNotNull(registrationContext);
+ ExtendedAssert.assertNotNull(registrationContext.getRegistrationHandle());
gs.setRegistrationContext(registrationContext);
@@ -197,6 +173,7 @@
public void tearDown() throws Exception
{
producer.getProducerRegistrationRequirements().clearRegistrationProperties();
+ producer.getRegistrationManager().clear();
super.tearDown();
}
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ReleaseSessionTestCase.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -202,7 +202,7 @@
public void testReleasedSessionWithRegistration() throws Exception
{
- initRegistrationInfo();
+ configureRegistrationSettings(false);
testReleasedSession();
registrationService.deregister(getRegistrationContext());
}
@@ -223,7 +223,7 @@
public void testNullReleaseSessionsWithRegistration() throws Exception
{
- initRegistrationInfo();
+ configureRegistrationSettings(false);
testNullReleaseSessions();
registrationService.deregister(getRegistrationContext());
}
@@ -272,7 +272,7 @@
private void releaseSessionsWithRegistration(RegistrationContext regContext, String[]
sessionIDs,
Class exceptionClass, String message)
throws Exception
{
- initRegistrationInfo();
+ configureRegistrationSettings(false);
releaseSessions(regContext, sessionIDs, exceptionClass, message);
registrationService.deregister(regContext);
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -30,8 +30,12 @@
package org.jboss.portal.test.wsrp.v1.producer;
import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.GetServiceDescription;
+import org.jboss.portal.wsrp.core.ModelDescription;
+import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
/**
* Tests WSRP Service Description
@@ -49,7 +53,7 @@
super("ServiceDescriptionTestCase");
}
- public void testGetServiceDescriptionNoRegistration() throws Throwable
+ public void testGetServiceDescriptionNotRequiringRegistration() throws Throwable
{
producer.getProducerRegistrationRequirements().setRequiresRegistration(false);
@@ -64,6 +68,52 @@
ExtendedAssert.assertNull(sd.getRegistrationPropertyDescription());
}
+ public void testGetServiceDescriptionRequiringRegistrationNoOfferedPortlets() throws
Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(false);
+
+ // service description request without registration info
+ GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service
+ ServiceDescription sd = serviceDescriptionService.getServiceDescription(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+
+ // No offered portlets without registration!
+ ExtendedAssert.assertNull(sd.getOfferedPortlets());
+ }
+
+
+ public void testGetServiceDescriptionRequiringRegistrationOfferedPortlets() throws
Throwable
+ {
+ RegistrationPropertyDescription regProp = configureRegistrationSettings(true);
+
+ // service description request without registration info
+ GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
+
+ //Invoke the Web Service, we should have the complete description
+ ServiceDescription sd = checkServiceDescriptionWithOnlyBasicPortlet(gs);
+ ExtendedAssert.assertNotNull(sd);
+ ExtendedAssert.assertTrue(sd.isRequiresRegistration());
+
+ // Check registration properties
+ checkRequiredRegistrationProperties(sd, regProp);
+ }
+
+ private void checkRequiredRegistrationProperties(ServiceDescription sd,
RegistrationPropertyDescription regProp)
+ {
+ ModelDescription registrationPropertyDescription =
sd.getRegistrationPropertyDescription();
+ ExtendedAssert.assertNotNull(registrationPropertyDescription);
+ PropertyDescription[] propertyDescriptions =
registrationPropertyDescription.getPropertyDescriptions();
+ ExtendedAssert.assertNotNull(propertyDescriptions);
+ ExtendedAssert.assertEquals(1, propertyDescriptions.length);
+ assertEquals(WSRPUtils.convertToPropertyDescription(regProp),
propertyDescriptions[0]);
+ }
+
public void testGetServiceDescriptionLiveDeployment() throws Throwable
{
try
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -153,10 +153,11 @@
return regData;
}
- protected RegistrationPropertyDescription initRegistrationInfo()
+ protected RegistrationPropertyDescription configureRegistrationSettings(boolean
provideUnregisteredFullDescription)
{
// define expected registration infos
producer.getProducerRegistrationRequirements().setRequiresRegistration(true);
+
producer.getProducerRegistrationRequirements().setFullServiceDescriptionRequiresRegistration(provideUnregisteredFullDescription);
// fix-me:
http://jira.jboss.com/jira/browse/JBPORTAL-821
RegistrationPropertyDescription regProp = new
RegistrationPropertyDescription("regProp",
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java 2006-11-25 19:35:00 UTC
(rev 5720)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java 2006-11-26 02:55:41 UTC
(rev 5721)
@@ -29,6 +29,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
@@ -98,4 +99,6 @@
boolean isSessionValid(String sessionId);
ProducerRegistrationRequirements getProducerRegistrationRequirements();
+
+ RegistrationManager getRegistrationManager();
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-25 19:35:00 UTC (rev
5720)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-26 02:55:41 UTC (rev
5721)
@@ -336,4 +336,21 @@
return
WSRPTypeFactory.createLocalizedString(LocaleInfo.getRFC3066LanguageTagFor(regLocalizedString.getLocale()),
regLocalizedString.getResourceName(), regLocalizedString.getValue());
}
+
+ public static void validateConsumerAgent(String consumerAgent) throws
IllegalArgumentException
+ {
+ char periodChar = '.';
+ int period = consumerAgent.indexOf(periodChar);
+ if (period != -1)
+ {
+ consumerAgent = consumerAgent.substring(period);
+ period = consumerAgent.indexOf(periodChar);
+
+ if (period != -1)
+ {
+ return;
+ }
+ }
+ throw new IllegalArgumentException("'" + consumerAgent + "'
is not a valid Consumer Agent.");
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-25
19:35:00 UTC (rev 5720)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -80,7 +80,11 @@
{
log.debug("Attempting to register consumer named '" + consumerName
+ "', agent '" + consumerAgent + "'.");
+ // check that the consumer agent is valid before trying to register
+ WSRPUtils.validateConsumerAgent(consumerAgent);
+
registration = producer.getRegistrationManager().addRegistrationTo(consumerName,
createRegistrationProperties(registrationData), true);
+ registration.setStatus(RegistrationStatus.VALID);
Consumer consumer = registration.getConsumer();
consumer.setConsumerAgent(consumerAgent);
ConsumerCapabilities capabilities = consumer.getCapabilities();
@@ -90,7 +94,7 @@
capabilities.setSupportedUserScopes(getListFromArray(registrationData.getConsumerUserScopes(),
false));
capabilities.setSupportsGetMethod(registrationData.isMethodGetSupported());
}
- catch (RegistrationException e)
+ catch (Exception e)
{
log.debug(e);
throw WSRPUtils.createOperationFailedFault(e);
@@ -135,14 +139,7 @@
try
{
Registration reg =
producer.getRegistrationManager().getRegistration(regHandle);
- if (RegistrationStatus.VALID.equals(reg.getStatus()))
- {
- return true;
- }
- else
- {
- return false;
- }
+ return RegistrationStatus.VALID.equals(reg.getStatus());
}
catch (RegistrationException e)
{
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-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -74,10 +74,9 @@
{
WSRPUtils.throwOperationFailedFaultIfValueIsMissing(gs,
"GetServiceDescription");
- if
(producer.getProducerRegistrationRequirements().fullServiceDescriptionRequiresRegistration()
- && !producer.isRegistrationValid(gs.getRegistrationContext()))
+ if (!producer.isRegistrationValid(gs.getRegistrationContext()))
{
- return getRegistrationNotProvidedServiceDescription();
+ return getRegistrationNotProvidedServiceDescription(gs.getDesiredLocales());
}
log.debug("Returning complete service description");
return refreshServiceDescription(gs.getDesiredLocales());
@@ -135,23 +134,37 @@
ProducerRegistrationRequirements requirements =
producer.getProducerRegistrationRequirements();
ServiceDescription serviceDescription =
WSRPTypeFactory.createServiceDescription(requirements.requiresRegistration());
serviceDescription.setRequiresInitCookie(CookieProtocol.none);
- PortletDescription[] descriptions =
(PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
- .toArray(new PortletDescription[]{});
+ PortletDescription[] descriptions = getPortletDescriptions(desiredLocales);
serviceDescription.setOfferedPortlets(descriptions);
return serviceDescription;
}
+ private PortletDescription[] getPortletDescriptions(String[] desiredLocales)
+ {
+ return (PortletDescription[])getOfferedPortletDescriptions(desiredLocales)
+ .toArray(new PortletDescription[]{});
+ }
+
/**
* Retrieves the service description offered to unregistered consumers when
registration is required.
*
+ * @param desiredLocales
* @return the service description offered to unregistered consumers when registration
is required
*/
- protected ServiceDescription getRegistrationNotProvidedServiceDescription()
+ protected ServiceDescription getRegistrationNotProvidedServiceDescription(String[]
desiredLocales)
{
- // todo: find out how to cache this
- log.debug("Using service description offered for unregistered
consumers");
+ log.debug("Unregistered consumer while registration is required. Sending
registration information.");
ProducerRegistrationRequirements requirements =
producer.getProducerRegistrationRequirements();
- return new ServiceDescription(true, null, null, null, null, null,
CookieProtocol.none,
+
+
+ PortletDescription[] offeredPortlets = null;
+ if (requirements.fullServiceDescriptionRequiresRegistration())
+ {
+ log.debug("Sending offered portlets description despite not being
registered, per Producer configuration.");
+ offeredPortlets = getPortletDescriptions(desiredLocales);
+ }
+
+ return new ServiceDescription(true, offeredPortlets, 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-25
19:35:00 UTC (rev 5720)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -53,7 +53,6 @@
import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
import org.jboss.portal.wsrp.core.MarkupResponse;
import org.jboss.portal.wsrp.core.MissingParametersFault;
-import org.jboss.portal.wsrp.core.ModelDescription;
import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PerformBlockingInteraction;
@@ -122,15 +121,6 @@
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
- * register.
- *
- * @see WSRPProducerImpl#requiredRegistrationInfo
- */
- private final ServiceDescription requiredRegistrationNotProvidedSD;
-
private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME;
private CookieProtocol requiresInitCookie = CookieProtocol.none;
@@ -138,16 +128,11 @@
/** Supported locales. */
private String[] supportedLocales = new String[]{"en", "en-US"};
- /** Required registration information to be provided by consumers to access this
Producer's information and services. */
- private ModelDescription requiredRegistrationInfo;
-
/** Manages the sessions. */
private SessionManager sessionManager;
public WSRPProducerImpl()
{
- requiredRegistrationInfo = initRequiredRegistrationInfo();
- requiredRegistrationNotProvidedSD =
initRegistrationNotProvidedServiceDescription();
markupHandler = new MarkupHandler(this);
serviceDescriptionHandler = new ServiceDescriptionHandler(this);
registrationHandler = new RegistrationHandler(this);
@@ -163,7 +148,7 @@
registrationRequirements =
registrationConfiguration.getRegistrationRequirements();
}
- // still need to check for null, in case there wasn't no registration info in
the descriptor
+ // still need to check for null, in case there wasn't any registration info in
the descriptor
return registrationRequirements != null ? registrationRequirements :
DEFAULT_REGISTRATION_REQUIREMENTS;
}
@@ -445,19 +430,6 @@
return serviceDescriptionHandler.getPortletDescription(handle, locales);
}
- // Contract with Invoker implementation
*****************************************************************************
-
- /** Dispatch the invocation to the target by reflection */
- /*public Object invoke(Invocation invocation) throws Exception
- {
- Method method = invocation.getMethod();
- Object[] args = invocation.getArguments();
- log.debug("invoke invoked: method=" + method + " args=" +
args);
- return method.invoke(this, args);
- }*/
-
- // Protected methods
************************************************************************************************
-
/**
* Checks that the specified registration information is valid if this Producer
requires registration.
*
@@ -481,44 +453,7 @@
}
}
- /**
- * Retrieves the service description offered to unregistered consumers when
registration is required.
- *
- * @return the service description offered to unregistered consumers when registration
is required
- */
- protected ServiceDescription getRegistrationNotProvidedServiceDescription()
- {
- log.debug("Using service description offered for unregistered
consumers");
- return requiredRegistrationNotProvidedSD;
- }
- // Private methods
**************************************************************************************************
-
- /**
- * Initializes the information required to be able to sucessfully register with this
Producer.
- * <p/>
- * todo: Decide how this information is passed to the server without having to code
- */
- private ModelDescription initRequiredRegistrationInfo()
- {
- return new ModelDescription();
- }
-
- /**
- * Initializes the ServiceDescription that is returned to Consumers trying to access
this Producer's information
- * without valid registration information when one is required.
- * <p/>
- * todo: this should be loaded dynamically instead of statically
- *
- * @return the service description offered to unregistered consumers when registration
is required
- */
- private ServiceDescription initRegistrationNotProvidedServiceDescription()
- {
- return new ServiceDescription(true, null, null, null, null, null,
requiresInitCookie, requiredRegistrationInfo,
- supportedLocales, null, null);
- }
-
-
private Boolean remotableByDefault;
public Boolean isRemotableByDefault()
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -74,4 +74,6 @@
void removeConsumerGroup(String name) throws RegistrationException;
Collection getConsumers() throws RegistrationException;
+
+ void clear() throws RegistrationException;
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer.registration.impl;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.producer.registration.api.Consumer;
import org.jboss.portal.wsrp.producer.registration.api.ConsumerCapabilities;
import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
@@ -121,7 +122,7 @@
throw new IllegalStateException("Cannot modify the agent of a
Consumer!");
}
- validate(consumerAgent);
+ WSRPUtils.validateConsumerAgent(consumerAgent);
this.consumerAgent = consumerAgent;
agentSet = true;
}
@@ -194,21 +195,4 @@
group.addConsumer(this);
}
}
-
- private void validate(String consumerAgent) throws IllegalArgumentException
- {
- char periodChar = '.';
- int period = consumerAgent.indexOf(periodChar);
- if (period != -1)
- {
- consumerAgent = consumerAgent.substring(period);
- period = consumerAgent.indexOf(periodChar);
-
- if (period != -1)
- {
- return;
- }
- }
- throw new IllegalArgumentException(consumerAgent + " is not a valid Consumer
Agent.");
- }
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-11-25
19:35:00 UTC (rev 5720)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-11-26
02:55:41 UTC (rev 5721)
@@ -327,6 +327,21 @@
return persistenceManager.getConsumers();
}
+ public void clear() throws RegistrationException
+ {
+ Collection tmpColl = new ArrayList(getConsumers());
+ for (Iterator consumers = tmpColl.iterator(); consumers.hasNext();)
+ {
+ removeConsumer((Consumer)consumers.next());
+ }
+
+ tmpColl = new ArrayList(getConsumerGroups());
+ for (Iterator groups = tmpColl.iterator(); groups.hasNext();)
+ {
+ removeConsumerGroup((ConsumerGroup)groups.next());
+ }
+ }
+
private static class ConsumerRegistration
{
private Registration registration;