[jboss-svn-commits] JBoss Portal SVN: r5670 - in trunk/wsrp: . src/main/org/jboss/portal/test/wsrp/framework src/main/org/jboss/portal/test/wsrp/other src/main/org/jboss/portal/test/wsrp/v1/producer src/main/org/jboss/portal/wsrp src/main/org/jboss/portal/wsrp/producer src/main/org/jboss/portal/wsrp/producer/registration src/main/org/jboss/portal/wsrp/producer/registration/api src/main/org/jboss/portal/wsrp/producer/registration/impl src/main/org/jboss/portal/wsrp/producer/registration/policies src/main/org/jboss/portal/wsrp/producer/registration/spi src/resources/portal-wsrp-sar/META-INF src/resources/tests/test-wsrp-producer-sar/META-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 17 01:31:24 EST 2006


Author: chris.laprun at jboss.com
Date: 2006-11-17 01:30:31 -0500 (Fri, 17 Nov 2006)
New Revision: 5670

Added:
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPersistenceManagerTestCase.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPersistenceManager.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationPersistenceManagerImpl.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/ProducerRegistrationRequirementsImpl.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerGroupSPI.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerSPI.java
Removed:
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerRegistryTestCase.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/ConsumerRegistry.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerRegistryImpl.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java
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/v1/producer/RegistrationTestCase.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/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/Consumer.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ConsumerGroup.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPolicy.java
   trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerGroupImpl.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/RegistrationImpl.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:
- Phase 1 of new Registration design: compiles but doesn't work yet (synching).
- Renamed RegistrationMetaData to ProducerRegistrationRequirements.
- Renamed (and re-designed) ConsumerRegistry to RegistrationPersistenceManager.
- Producer tests still broken.

Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/build.xml	2006-11-17 06:30:31 UTC (rev 5670)
@@ -625,10 +625,10 @@
    <target name="other-test" depends="package-other-test">
       <execute-tests>
          <x-test>
-            <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.ConsumerRegistryTestCase"/>
-            <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.ProducerSessionInformationTestCase"/>-->
-            <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.WSRPPortletURLTestCase"/>-->
-            <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.handler.RequestHeaderClientHandlerTestCase"/>-->
+            <!--<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.RegistrationPersistenceManagerTestCase"/>-->
+            <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.ProducerSessionInformationTestCase"/>
+            <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.other.WSRPPortletURLTestCase"/>
+            <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.handler.RequestHeaderClientHandlerTestCase"/>
          </x-test>
          <x-sysproperty>
             <jvmarg value="-Xdebug"/>

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/TestWSRPProducerImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -70,7 +70,7 @@
 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.producer.registration.api.RegistrationMetaData;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
@@ -364,7 +364,7 @@
       return true;
    }
 
-   public RegistrationMetaData getRegistrationMetaData()
+   public ProducerRegistrationRequirements getProducerRegistrationRequirements()
    {
       return null; // todo: implement
    }

Deleted: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerRegistryTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerRegistryTestCase.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ConsumerRegistryTestCase.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,368 +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.                   *
- ******************************************************************************/
-
-package org.jboss.portal.test.wsrp.other;
-
-import junit.framework.TestCase;
-import org.jboss.portal.wsrp.core.Extension;
-import org.jboss.portal.wsrp.core.Property;
-import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.producer.registration.ConsumerRegistry;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.impl.ConsumerRegistryImpl;
-
-import javax.xml.soap.SOAPElement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ConsumerRegistryTestCase extends TestCase
-{
-
-   /** . */
-   private ConsumerRegistry registry;
-
-   /** . */
-   private RegistrationData registrationData;
-
-   public void setUp()
-   {
-      registry = new ConsumerRegistryImpl();
-      registrationData = new RegistrationData(
-         "Foo",
-         "Foo 1.0",
-         false,
-         new String[0],
-         new String[0],
-         new String[0],
-         new String[0],
-         new Property[]{new Property("prop1", "", "value1", new SOAPElement[0]), new Property("prop2", "", "value2", new SOAPElement[0])},
-         new Extension[0]);
-   }
-
-   protected void tearDown() throws Exception
-   {
-      registry = null;
-      registrationData = null;
-   }
-
-   public void testGetGroupThrowsIAE() throws Exception
-   {
-      try
-      {
-         registry.getGroup(null);
-         fail();
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testAddGroup() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      assertNotNull(group);
-      assertEquals("Foo", group.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
-
-      // Test by retrieving the same consumer
-      group = registry.getGroup("Foo");
-      assertNotNull(group);
-      assertEquals("Foo", group.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
-
-      // Test by retrieving the consumer list
-      Collection groups = registry.getGroups();
-      assertNotNull(groups);
-      assertEquals(1, groups.size());
-      group = (ConsumerGroup)groups.iterator().next();
-      assertNotNull(group);
-      assertEquals("Foo", group.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
-   }
-
-   public void testAddDuplicateGroup() throws Exception
-   {
-      registry.addGroup("Foo");
-      try
-      {
-         registry.addGroup("Foo");
-         fail();
-      }
-      catch (DuplicateRegistrationException expected)
-      {
-      }
-   }
-
-   public void testAddGroupThrowsIAE() throws Exception
-   {
-      try
-      {
-         registry.addGroup(null);
-      }
-      catch (IllegalArgumentException expected)
-      {
-         assertEquals(Collections.EMPTY_SET, new HashSet(registry.getGroups()));
-      }
-   }
-
-   public void testRemoveGroup() throws Exception
-   {
-      registry.addGroup("Foo");
-      registry.removeGroup("Foo");
-      assertNull(registry.getGroup("Foo"));
-      assertEquals(Collections.EMPTY_SET, new HashSet(registry.getGroups()));
-   }
-
-   public void testRemoveGroupThrowsIAE() throws Exception
-   {
-      try
-      {
-         registry.removeGroup(null);
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testRemoveNonExistingGroup() throws Exception
-   {
-      try
-      {
-         registry.removeGroup("Foo");
-      }
-      catch (NoSuchRegistrationException expected)
-      {
-      }
-   }
-
-   public void testGetConsumerThrowsIAE() throws Exception
-   {
-      try
-      {
-         ConsumerGroup group = registry.addGroup("Foo");
-         group.getConsumer(null);
-         fail();
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testAddConsumer() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-
-      Consumer consumer = group.addConsumer("Bar");
-      assertNotNull(consumer);
-      assertEquals("Bar", consumer.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
-      assertEquals("Foo", consumer.getGroup().getName());
-
-      // Test by retrieving the same consumer
-      consumer = group.getConsumer("Bar");
-      assertNotNull(consumer);
-      assertEquals("Bar", consumer.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
-      assertEquals("Foo", consumer.getGroup().getName());
-
-      // Test by retrieving the consumer list
-      Collection consumers = group.getConsumers();
-      assertNotNull(consumers);
-      assertEquals(1, consumers.size());
-      consumer = (Consumer)consumers.iterator().next();
-      assertNotNull(consumer);
-      assertEquals("Bar", consumer.getName());
-      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
-      assertEquals("Foo", consumer.getGroup().getName());
-   }
-
-   public void testAddDuplicateConsumer() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      group.addConsumer("Bar");
-      try
-      {
-         group.addConsumer("Bar");
-         fail();
-      }
-      catch (DuplicateRegistrationException expected)
-      {
-      }
-   }
-
-   public void testAddConsumerThrowsIAE() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      try
-      {
-         group.addConsumer(null);
-      }
-      catch (IllegalArgumentException expected)
-      {
-         assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
-      }
-   }
-
-   public void testRemoveConsumer() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      group.addConsumer("Bar");
-      group.removeConsumer("Bar");
-      assertNull(group.getConsumer("Bar"));
-      assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
-   }
-
-   public void testRemoveConsumerThrowsIAE() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      try
-      {
-         group.removeConsumer(null);
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testRemoveNonExistingConsumer() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      try
-      {
-         group.removeConsumer("Bar");
-      }
-      catch (NoSuchRegistrationException expected)
-      {
-      }
-   }
-
-   public void testAddRegistration() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      Consumer consumer = group.addConsumer("Foo");
-
-      //
-      Registration reg1 = consumer.addRegistration(registrationData);
-      assertNotNull(reg1);
-      String regId = reg1.getId();
-      assertNotNull(regId);
-      assertEquals(consumer, reg1.getConsumer());
-      Map expectedProps = new HashMap();
-      expectedProps.put("prop1", "value1");
-      expectedProps.put("prop2", "value2");
-      assertEquals(expectedProps, reg1.getProperties());
-
-      // Retrieve it from the list of consumer registrations
-      Collection registrations = consumer.getRegistrations();
-      assertNotNull(registrations);
-      assertEquals(1, registrations.size());
-      Registration reg3 = (Registration)registrations.iterator().next();
-      assertEquals(regId, reg3.getId());
-      assertEquals(consumer, reg3.getConsumer());
-      assertEquals(expectedProps, reg3.getProperties());
-
-      // Retrieve the same registration from the registry
-      Registration reg2 = registry.getRegistration(regId);
-      assertNotNull(reg2);
-      assertEquals(regId, reg2.getId());
-      assertEquals(consumer, reg2.getConsumer());
-      assertEquals(expectedProps, reg2.getProperties());
-   }
-
-   public void testAddRegistrationThrowsIAE() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      Consumer consumer = group.addConsumer("Foo");
-      try
-      {
-         consumer.addRegistration(null);
-         fail();
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testRemoveRegistrationThrowsIAE() throws Exception
-   {
-      try
-      {
-         registry.removeRegistration(null);
-         fail();
-      }
-      catch (IllegalArgumentException expected)
-      {
-      }
-   }
-
-   public void testRemoveRegistration() throws Exception
-   {
-      ConsumerGroup group = registry.addGroup("Foo");
-      Consumer consumer = group.addConsumer("Foo");
-      Registration reg = consumer.addRegistration(registrationData);
-      String regId = reg.getId();
-      registry.removeRegistration(regId);
-
-      //
-      Collection registrations = consumer.getRegistrations();
-      assertNotNull(registrations);
-      assertEquals(0, registrations.size());
-
-      //
-      assertEquals(null, registry.getRegistration(regId));
-   }
-
-   public void testCascadeRemove() throws Exception
-   {
-      ConsumerGroup foo1 = registry.addGroup("Foo1");
-      Consumer bar1 = foo1.addConsumer("Bar1");
-      Registration reg1 = bar1.addRegistration(registrationData);
-      String reg1Id = reg1.getId();
-
-      ConsumerGroup foo2 = registry.addGroup("Foo2");
-      Consumer bar2 = foo2.addConsumer("Bar2");
-      Registration reg2 = bar2.addRegistration(registrationData);
-      String reg2Id = reg2.getId();
-
-      // Test by just removing the consumer
-      foo1.removeConsumer("Bar1");
-      assertEquals(null, registry.getRegistration(reg1Id));
-
-      // Test by removing the group
-      registry.removeGroup("Foo2");
-      assertEquals(null, registry.getRegistration(reg2Id));
-   }
-
-}

Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPersistenceManagerTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPersistenceManagerTestCase.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPersistenceManagerTestCase.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,354 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.test.wsrp.other;
+
+import junit.framework.TestCase;
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
+import org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersistenceManagerImpl;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerGroupSPI;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerSPI;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerTestCase extends TestCase
+{
+   private RegistrationPersistenceManager manager;
+   private Map registrationProperties;
+
+   public void setUp()
+   {
+      manager = new RegistrationPersistenceManagerImpl();
+      registrationProperties = new HashMap();
+      registrationProperties.put(new QName("prop1"), "value1");
+      registrationProperties.put(new QName("prop2"), "value2");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      manager = null;
+      registrationProperties = null;
+   }
+
+   public void testGetGroupThrowsIAE() throws Exception
+   {
+      try
+      {
+         manager.getConsumerGroup(null);
+         fail();
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testAddGroup() throws Exception
+   {
+      ConsumerGroup group = manager.createConsumerGroup("Foo");
+      assertNotNull(group);
+      assertEquals("Foo", group.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+
+      // Test by retrieving the same consumer
+      group = manager.getConsumerGroup("Foo");
+      assertNotNull(group);
+      assertEquals("Foo", group.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+
+      // Test by retrieving the consumer list
+      Collection groups = manager.getConsumerGroups();
+      assertNotNull(groups);
+      assertEquals(1, groups.size());
+      group = (ConsumerGroup)groups.iterator().next();
+      assertNotNull(group);
+      assertEquals("Foo", group.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(group.getConsumers()));
+   }
+
+   public void testAddDuplicateGroup() throws Exception
+   {
+      manager.createConsumerGroup("Foo");
+      try
+      {
+         manager.createConsumerGroup("Foo");
+         fail();
+      }
+      catch (DuplicateRegistrationException expected)
+      {
+      }
+   }
+
+   public void testAddGroupThrowsIAE() throws Exception
+   {
+      try
+      {
+         manager.createConsumerGroup(null);
+      }
+      catch (IllegalArgumentException expected)
+      {
+         assertEquals(Collections.EMPTY_SET, new HashSet(manager.getConsumerGroups()));
+      }
+   }
+
+   public void testRemoveGroup() throws Exception
+   {
+      manager.createConsumerGroup("Foo");
+      manager.removeConsumerGroup("Foo");
+      assertNull(manager.getConsumerGroup("Foo"));
+      assertEquals(Collections.EMPTY_SET, new HashSet(manager.getConsumerGroups()));
+   }
+
+   public void testRemoveGroupThrowsIAE() throws Exception
+   {
+      try
+      {
+         manager.removeConsumerGroup(null);
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testRemoveNonExistingGroup() throws Exception
+   {
+      try
+      {
+         manager.removeConsumerGroup("Foo");
+      }
+      catch (NoSuchRegistrationException expected)
+      {
+      }
+   }
+
+   public void testGetConsumerThrowsIAE() throws Exception
+   {
+      try
+      {
+         ConsumerGroup group = manager.createConsumerGroup("Foo");
+         group.getConsumer(null);
+         fail();
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testAddConsumer() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+      assertNotNull(consumer);
+      assertEquals("Bar", consumer.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+      assertEquals("Foo", consumer.getGroup().getName());
+
+      // Test by retrieving the same consumer
+      consumer = (ConsumerSPI)group.getConsumer("Bar");
+      assertNotNull(consumer);
+      assertEquals("Bar", consumer.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+      assertEquals("Foo", consumer.getGroup().getName());
+
+      // Test by retrieving the consumer list
+      Collection consumers = group.getConsumers();
+      assertNotNull(consumers);
+      assertEquals(1, consumers.size());
+      consumer = (ConsumerSPI)consumers.iterator().next();
+      assertNotNull(consumer);
+      assertEquals("Bar", consumer.getName());
+      assertEquals(Collections.EMPTY_LIST, new ArrayList(consumer.getRegistrations()));
+      assertEquals("Foo", consumer.getGroup().getName());
+   }
+
+   public void testAddDuplicateConsumer() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+
+      try
+      {
+         group.addConsumer(consumer);
+         fail();
+      }
+      catch (DuplicateRegistrationException expected)
+      {
+      }
+   }
+
+   public void testAddConsumerThrowsIAE() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      try
+      {
+         group.addConsumer(null);
+      }
+      catch (IllegalArgumentException expected)
+      {
+         assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+      }
+   }
+
+   public void testRemoveConsumer() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+      group.removeConsumer(consumer);
+      assertNull(group.getConsumer("Bar"));
+      assertEquals(Collections.EMPTY_SET, new HashSet(group.getConsumers()));
+   }
+
+   public void testRemoveConsumerThrowsIAE() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      try
+      {
+         group.removeConsumer(null);
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testAddRegistration() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+
+      //
+      Registration reg1 = manager.addRegistrationFor("Bar", registrationProperties);
+      assertNotNull(reg1);
+      String regId = reg1.getId();
+      assertNotNull(regId);
+      assertEquals(consumer, reg1.getConsumer());
+      Map expectedProps = new HashMap();
+      expectedProps.put("prop1", "value1");
+      expectedProps.put("prop2", "value2");
+      assertEquals(expectedProps, reg1.getProperties());
+
+      // Retrieve it from the list of consumer registrations
+      Collection registrations = consumer.getRegistrations();
+      assertNotNull(registrations);
+      assertEquals(1, registrations.size());
+      Registration reg3 = (Registration)registrations.iterator().next();
+      assertEquals(regId, reg3.getId());
+      assertEquals(consumer, reg3.getConsumer());
+      assertEquals(expectedProps, reg3.getProperties());
+
+      // Retrieve the same registration from the registry
+      Registration reg2 = manager.getRegistration(regId);
+      assertNotNull(reg2);
+      assertEquals(regId, reg2.getId());
+      assertEquals(consumer, reg2.getConsumer());
+      assertEquals(expectedProps, reg2.getProperties());
+   }
+
+   public void testAddRegistrationThrowsIAE() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+
+      try
+      {
+         consumer.addRegistration(null);
+         fail();
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testRemoveRegistrationThrowsIAE() throws Exception
+   {
+      try
+      {
+         manager.removeRegistration(null);
+         fail();
+      }
+      catch (IllegalArgumentException expected)
+      {
+      }
+   }
+
+   public void testRemoveRegistration() throws Exception
+   {
+      ConsumerGroupSPI group = (ConsumerGroupSPI)manager.createConsumerGroup("Foo");
+      ConsumerSPI consumer = (ConsumerSPI)manager.createConsumer("Bar", "Bar");
+      group.addConsumer(consumer);
+      Registration reg = manager.addRegistrationFor("Bar", registrationProperties);
+      String regId = reg.getId();
+      manager.removeRegistration(regId);
+
+      //
+      Collection registrations = consumer.getRegistrations();
+      assertNotNull(registrations);
+      assertEquals(0, registrations.size());
+
+      //
+      assertEquals(null, manager.getRegistration(regId));
+   }
+
+   public void testCascadeRemove() throws Exception
+   {
+      ConsumerGroupSPI foo1 = (ConsumerGroupSPI)manager.createConsumerGroup("Foo1");
+      ConsumerSPI bar1 = (ConsumerSPI)manager.createConsumer("Bar1", "Bar");
+      foo1.addConsumer(bar1);
+      Registration reg1 = manager.addRegistrationFor("Bar", registrationProperties);
+      String reg1Id = reg1.getId();
+
+      ConsumerGroupSPI foo2 = (ConsumerGroupSPI)manager.createConsumerGroup("Foo1");
+      ConsumerSPI bar2 = (ConsumerSPI)manager.createConsumer("Bar1", "Bar");
+      foo2.addConsumer(bar2);
+      Registration reg2 = manager.addRegistrationFor("Bar", registrationProperties);
+      String reg2Id = reg2.getId();
+
+      // Test by just removing the consumer
+      foo1.removeConsumer(bar1);
+      assertEquals(null, manager.getRegistration(reg1Id));
+
+      // Test by removing the group
+      manager.removeConsumerGroup("Foo2");
+      assertEquals(null, manager.getRegistration(reg2Id));
+   }
+
+}

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationTestCase.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -125,7 +125,7 @@
       // now modify Producer's set of required registration info
       RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("new prop", new QName("xsd:string"));
       regProp.setDefaultLabel("New Registration Property");
-      producer.getRegistrationMetaData().addRegistrationProperty(regProp);
+      producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
 
       // Try to get service description
       GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
@@ -196,7 +196,7 @@
 
    public void tearDown() throws Exception
    {
-      producer.getRegistrationMetaData().clearRegistrationProperties();
+      producer.getProducerRegistrationRequirements().clearRegistrationProperties();
       super.tearDown();
    }
 }

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/ServiceDescriptionTestCase.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -51,7 +51,7 @@
 
    public void testGetServiceDescriptionNoRegistration() throws Throwable
    {
-      producer.getRegistrationMetaData().setRequiresRegistration(false);
+      producer.getProducerRegistrationRequirements().setRequiresRegistration(false);
 
       GetServiceDescription gs = getNoRegistrationServiceDescriptionRequest();
 

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -156,21 +156,21 @@
    protected RegistrationPropertyDescription initRegistrationInfo()
    {
       // define expected registration infos
-      producer.getRegistrationMetaData().setRequiresRegistration(true);
+      producer.getProducerRegistrationRequirements().setRequiresRegistration(true);
 
       // fix-me: http://jira.jboss.com/jira/browse/JBPORTAL-821
       RegistrationPropertyDescription regProp = new RegistrationPropertyDescription("regProp",
          new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", "ns1"));
       regProp.setDefaultLabel("Registration Property");
-      producer.getRegistrationMetaData().addRegistrationProperty(regProp);
+      producer.getProducerRegistrationRequirements().addRegistrationProperty(regProp);
 
       return regProp;
    }
 
    protected void resetRegistrationInfo()
    {
-      producer.getRegistrationMetaData().setRequiresRegistration(false);
-      producer.getRegistrationMetaData().clearRegistrationProperties();
+      producer.getProducerRegistrationRequirements().setRequiresRegistration(false);
+      producer.getProducerRegistrationRequirements().clearRegistrationProperties();
    }
 
    protected GetServiceDescription getNoRegistrationServiceDescriptionRequest()

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPProducer.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -28,7 +28,7 @@
 import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
 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.RegistrationMetaData;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
 
 /**
  * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
@@ -97,5 +97,5 @@
     */
    boolean isSessionValid(String sessionId);
 
-   RegistrationMetaData getRegistrationMetaData();
+   ProducerRegistrationRequirements getProducerRegistrationRequirements();
 }

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -24,9 +24,9 @@
 package org.jboss.portal.wsrp.producer;
 
 import org.apache.log4j.Logger;
+import org.jboss.portal.common.FixMe;
 import org.jboss.portal.common.util.LocaleInfo;
 import org.jboss.portal.common.util.LocalizedString;
-import org.jboss.portal.common.FixMe;
 import org.jboss.portal.portlet.Portlet;
 import org.jboss.portal.portlet.PortletInvokerException;
 import org.jboss.portal.portlet.info.CapabilitiesInfo;
@@ -36,7 +36,6 @@
 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;
@@ -45,7 +44,6 @@
 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.RegistrationMetaData;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
 
 import java.rmi.RemoteException;

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -24,6 +24,7 @@
 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;
@@ -74,10 +75,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.producer.registration.api.RegistrationMetaData;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
 import org.jboss.portal.wsrp.servlet.ServletAccess;
-import org.jboss.portal.common.FixMe;
 
 import javax.servlet.http.HttpSession;
 import java.rmi.RemoteException;
@@ -148,7 +148,7 @@
       sessionManager = new SessionManager();
    }
 
-   public RegistrationMetaData getRegistrationMetaData()
+   public ProducerRegistrationRequirements getProducerRegistrationRequirements()
    {
 //      return registrationPolicy.getMetaData();
       throw new FixMe();

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/ConsumerRegistry.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/ConsumerRegistry.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,98 +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.                   *
- ******************************************************************************/
-package org.jboss.portal.wsrp.producer.registration;
-
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface ConsumerRegistry
-{
-
-   /**
-    * Return a collection of the known consumers.
-    *
-    * @return the consumer collection
-    * @throws RegistrationException
-    */
-   Collection getGroups() throws RegistrationException;
-
-   /**
-    * Return a specific consumer in the portal
-    *
-    * @param groupName
-    * @return the consumer registration or null if it does not exist
-    * @throws IllegalArgumentException if the consumer name is null
-    * @throws RegistrationException
-    */
-   ConsumerGroup getGroup(String groupName) throws IllegalArgumentException, RegistrationException;
-
-   /**
-    * Adds the given Consumer to the list of registered Consumers.
-    *
-    * @param groupName
-    * @return the newly created consumer
-    * @throws IllegalArgumentException       if the consumer name is null or if the consumer data is null
-    * @throws RegistrationException
-    * @throws DuplicateRegistrationException if a consumer is already registered under that name
-    */
-   ConsumerGroup addGroup(String groupName) throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException;
-
-   /**
-    * Removes the given consumer from the list of registered Consumers as well as all the related registrations of that
-    * consumer.
-    *
-    * @param groupName
-    * @throws IllegalArgumentException    if the consumer name is null
-    * @throws RegistrationException
-    * @throws NoSuchRegistrationException if there is no consumer registered under that name
-    */
-   void removeGroup(String groupName) throws IllegalArgumentException, RegistrationException, NoSuchRegistrationException;
-
-
-   /**
-    * Return a specific registration for this consumer.
-    *
-    * @param registrationId
-    * @return the registration or null if it does not exist
-    * @throws IllegalArgumentException if the registration id is null
-    * @throws RegistrationException
-    */
-   Registration getRegistration(String registrationId) throws IllegalArgumentException, RegistrationException;
-
-   /**
-    * Remove the Registration associated with the given id from this Consumer's registrations.
-    *
-    * @param registrationId the registration id
-    * @throws NoSuchRegistrationException if the registration does not exist
-    */
-   void removeRegistration(String registrationId) throws IllegalArgumentException, RegistrationException, NoSuchRegistrationException;
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Consumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Consumer.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Consumer.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -22,13 +22,11 @@
  ******************************************************************************/
 package org.jboss.portal.wsrp.producer.registration.api;
 
-import org.jboss.portal.wsrp.core.RegistrationData;
-
 import java.util.Collection;
 
 /**
- * An entity that groups several registrations under the same scope, for exemple a Consumer entity
- * could be related to several registrations for the same consumer with different capabilities.
+ * An entity that groups several registrations under the same scope, for exemple a Consumer entity could be related to
+ * several registrations for the same consumer with different capabilities.
  *
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @author @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
@@ -75,11 +73,15 @@
    ConsumerGroup getGroup();
 
    /**
-    * Add the given Registration to this Consumer.
+    * Retrieves this Consumer's identity, which uniquely identifies the Consumer since the name cannot be relied on. It
+    * is up to the {@link RegistrationPolicy} to determine what the Consumer's identity is. Note also that this is
+    * different from the Consumer's database identifier.
     *
-    * @param registration the Registration to be added
-    * @throws IllegalArgumentException if the registration data is null
-    * @throws RegistrationException
+    * @return this Consumer's identity.
     */
-   Registration addRegistration(RegistrationData registration) throws IllegalArgumentException, RegistrationException;
+   String getIdentity();
+
+   ConsumerCapabilities getCapabilities();
+
+   void setCapabilities(ConsumerCapabilities capabilities);
 }

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ConsumerGroup.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ConsumerGroup.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ConsumerGroup.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -36,14 +36,14 @@
 {
 
    /**
-    * Return the consumer name.
+    * Return this ConsumerGroup's name (i.e. the name of the the business entity aggregating the associated consumers)
     *
-    * @return the consumer name
+    * @return the ConsumerGroup's name
     */
    String getName();
-   
+
    /**
-    * Return a collection of the known consumers.
+    * Return a collection of associated consumers.
     *
     * @return the consumer collection
     * @throws RegistrationException
@@ -51,34 +51,19 @@
    Collection getConsumers() throws RegistrationException;
 
    /**
-    * Return a specific consumer in the portal
+    * Return the member Consumer associated with the given identifier
     *
-    * @param consumerName the consumer name
-    * @return the consumer registration or null if it does not exist
-    * @throws IllegalArgumentException if the consumer name is null
+    * @param consumerIdentity the identity of the Consumer to be retrieved
+    * @return the Consumer associated with the identity or <code>null</code> if no such Consumer is part of this
+    *         ConsumerGroup
+    * @throws IllegalArgumentException if the consumer identity is null
     * @throws RegistrationException
     */
-   Consumer getConsumer(String consumerName) throws IllegalArgumentException, RegistrationException;
+   Consumer getConsumer(String consumerIdentity) throws IllegalArgumentException, RegistrationException;
 
-   /**
-    * Adds the given Consumer to the list of registered Consumers.
-    *
-    * @param consumerName the consumer name
-    * @return the newly created consumer
-    * @throws IllegalArgumentException       if the consumer name is null or if the consumer data is null
-    * @throws RegistrationException
-    * @throws DuplicateRegistrationException if a consumer is already registered under that name
-    */
-   Consumer addConsumer(String consumerName) throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException;
+   boolean isEmpty();
 
-   /**
-    * Removes the given consumer from the list of registered Consumers as well as all the related registrations of that
-    * consumer.
-    *
-    * @param consumerName the consumer name
-    * @throws IllegalArgumentException    if the consumer name is null
-    * @throws RegistrationException
-    * @throws NoSuchRegistrationException if there is no consumer registered under that name
-    */
-   void removeConsumer(String consumerName) throws IllegalArgumentException, RegistrationException, NoSuchRegistrationException;
+   RegistrationStatus getStatus();
+
+   void setStatus(RegistrationStatus status);
 }

Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java (from rev 5651, trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java	2006-11-14 20:19:33 UTC (rev 5651)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.api;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ProducerRegistrationRequirements
+{
+
+   boolean requiresRegistration();
+
+   void setRequiresRegistration(boolean requiresRegistration);
+
+   boolean fullServiceDescriptionRequiresRegistration();
+
+   void setFullServiceDescriptionRequiresRegistration(boolean fullServiceDescriptionRequiresRegistration);
+
+   Map getRegistrationProperties();
+
+   void addRegistrationProperty(RegistrationPropertyDescription propertyDescription);
+
+   void removeRegistrationProperty(String propertyName);
+
+   void removeRegistrationProperty(QName propertyName);
+
+   void clearRegistrationProperties();
+
+   boolean acceptValueFor(Object value, QName propertyName);
+
+   boolean acceptValueFor(Object value, String propertyName);
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ProducerRegistrationRequirements.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -37,13 +37,28 @@
 public interface Registration
 {
    /**
-    * Retrieve the handle associated with this Registration
+    * Retrieves the internal identifier for this Registration. This will correspond to the database key for this
+    * Registration. This identifier can be used by {@link RegistrationPolicy} to create a handle for this Registration.
     *
-    * @return the registration handle
+    * @return this Registration's internal identifier.
     */
    String getId();
 
    /**
+    * Sets the handle for this Registration.
+    *
+    * @param handle
+    */
+   void setRegistrationHandle(String handle);
+
+   /**
+    * Retrieves the handle associated with this Registration
+    *
+    * @return the registration handle
+    */
+   String getRegistrationHandle();
+
+   /**
     * Return the consumer owning this registration.
     *
     * @return the owning consumer

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationManager.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -23,8 +23,14 @@
 
 package org.jboss.portal.wsrp.producer.registration.api;
 
-import org.jboss.portal.wsrp.producer.registration.ConsumerRegistry;
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerGroupSPI;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerSPI;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -35,81 +41,252 @@
 public class RegistrationManager
 {
    private RegistrationPolicy policy;
-   private ConsumerRegistry registry; // todo: rename?
+   private RegistrationPersistenceManager persistenceManager;
+   private Map registrations;
 
-   public Registration addRegistration(String consumerName, ConsumerCapabilities capabilities, Map registrationProperties)
+
+   public RegistrationManager()
+   {
+      registrations = new ConcurrentHashMap();
+   }
+
+   public RegistrationPolicy getPolicy()
+   {
+      return policy;
+   }
+
+   public void setPolicy(RegistrationPolicy policy)
+   {
+      this.policy = policy;
+   }
+
+   public RegistrationPersistenceManager getPersistenceManager()
+   {
+      return persistenceManager;
+   }
+
+   public void setPersistenceManager(RegistrationPersistenceManager persistenceManager)
+   {
+      this.persistenceManager = persistenceManager;
+   }
+
+   public Registration addRegistrationTo(String consumerName, Map registrationProperties, boolean createConsumerIfNeeded)
       throws RegistrationException
    {
-      String id = policy.getOrCreateIdentifierForConsumerWith(consumerName, capabilities);
+      // the policy determines the identity of the consumer based on the given information (note that this might be obsoleted by using WS-Security)
+      String identity = policy.getConsumerIdentityFrom(consumerName, registrationProperties);
 
-      ConsumerGroup group = registry.getGroup("default");
+      // validate the registration information
+      policy.validateRegistrationDataFor(registrationProperties, identity);
 
-      Consumer consumer = group.getConsumer(id);
+      Consumer consumer = getOrCreateConsumer(identity, createConsumerIfNeeded, consumerName);
 
-      // if the consumer doesn't exist already create it
-      boolean justCreated = false;
-      if (consumer == null)
+      // create the actual registration
+      Registration registration = persistenceManager.addRegistrationFor(identity, registrationProperties);
+
+      // let the policy decide what the handle should be
+      String handle = policy.createRegistrationHandleFor(registration.getId());
+      registration.setRegistrationHandle(handle);
+
+      registration = persistenceManager.save(registration);
+
+      // associate the handle to the consumer for easy retrieval
+      registrations.put(handle, new ConsumerRegistration(registration, consumer));
+
+      return registration;
+   }
+
+   public Consumer createConsumer(String name) throws RegistrationException, InvalidConsumerDataException
+   {
+      // check with policy if we allow the consumer
+      policy.validateConsumerName(name);
+
+      String identity = policy.getConsumerIdentityFrom(name, Collections.EMPTY_MAP);
+
+      Consumer consumer = persistenceManager.createConsumer(identity, name);
+      consumer.setStatus(RegistrationStatus.PENDING);
+
+      // deal with group if needed
+      // let the policy decide if there should be a group associated with the Consumer and if yes, with which id
+      String groupName = policy.getGroupNameFor(consumer.getName());
+      if (groupName != null)
       {
-         consumer = createConsumer(consumerName, capabilities);
-         justCreated = true;
+         addConsumerToGroupNamed(groupName, groupName, true, false);
       }
 
-      try
+      return consumer;
+   }
+
+   public Consumer addConsumerToGroupNamed(String consumerName, String groupName, boolean createGroupIfNeeded, boolean createConsumerIfNeeded) throws RegistrationException
+   {
+      // check with the policy if we allow the group
+      policy.validateConsumerGroupName(groupName);
+
+      // check with policy if we allow the consumer
+      policy.validateConsumerName(consumerName);
+
+      ConsumerGroupSPI group = (ConsumerGroupSPI)getConsumerGroup(groupName);
+      if (group == null)
       {
-         // todo: maybe should validate before creating the consumer? pb is this would cause the validation method to be more complex...
-         policy.validateRegistrationDataFor(registrationProperties, consumer);
+         if (createGroupIfNeeded)
+         {
+            group = (ConsumerGroupSPI)createConsumerGroup(groupName);
+         }
+         else
+         {
+            throw new NoSuchRegistrationException("There is no existing ConsumerGroup named '" + groupName + "'.");
+         }
       }
-      catch (Exception e)
+
+      String identity = policy.getConsumerIdentityFrom(consumerName, Collections.EMPTY_MAP);
+      ConsumerSPI consumer = getOrCreateConsumer(identity, createConsumerIfNeeded, consumerName);
+
+      group.addConsumer(consumer);
+      consumer.setGroup(group);
+
+      persistenceManager.save(group);
+      return persistenceManager.save(consumer);
+   }
+
+   public ConsumerGroup createConsumerGroup(String groupName) throws RegistrationException
+   {
+      // check with the policy if we allow the group
+      policy.validateConsumerGroupName(groupName);
+
+      return persistenceManager.createConsumerGroup(groupName);
+   }
+
+   public void removeConsumer(String identity) throws RegistrationException, NoSuchRegistrationException
+   {
+      ConsumerSPI consumer = getOrCreateConsumer(identity, false, null);
+
+      ConsumerGroupSPI group = (ConsumerGroupSPI)getConsumerGroup(consumer.getGroup().getName());
+      if (group != null)
       {
-         if (justCreated)
+         group.removeConsumer(consumer);
+
+         // if the group is now empty, destroy it
+         if (group.isEmpty())
          {
-            group.removeConsumer(id);
+            persistenceManager.removeConsumerGroup(group.getName());
          }
+         else
+         {
+            persistenceManager.save(group);
+         }
+      }
 
-         throw new RegistrationException("Registration data not valid" + (justCreated ? "." : " for consumer '"
-            + consumerName + "' (id: '" + id + "')"), e);
+      // cascade delete the registrations
+      for (Iterator i = new ArrayList(consumer.getRegistrations()).iterator(); i.hasNext();)
+      {
+         removeRegistration((Registration)i.next());
       }
 
-      Registration registration = consumer.addRegistration(null); // todo: replace by registrationProperties
+      // let the registry do the actual deletion
+      persistenceManager.removeConsumer(identity);
+   }
 
-      String handle = policy.createRegistrationHandleFor(registration.getId());
-      // registration.setRegistrationHandle(handle); // todo: add registration handle support to Registration
-      return registration;
+   public void removeConsumer(Consumer consumer) throws RegistrationException, NoSuchRegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
+
+      removeConsumer(consumer.getIdentity());
    }
 
-   public Consumer createConsumer(String name, ConsumerCapabilities capabilities) throws RegistrationException, InvalidConsumerDataException
+   public Consumer getConsumerByIdentity(String identity) throws RegistrationException
    {
-      String id = policy.getOrCreateIdentifierForConsumerWith(name, capabilities);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "identity", null);
+      return persistenceManager.getConsumerByIdentity(identity);
+   }
 
-      String groupId = policy.getGroupIdentifierFor(id); // todo: retrieve group from id and add the consumer to the group
+   public Consumer getConsumerFor(String registrationHandle) throws RegistrationException
+   {
+      return (Consumer)getConsumerOrRegistration(registrationHandle, true);
+   }
 
-      ConsumerGroup group = registry.getGroup("default");
+   public Registration getRegistration(String registrationHandle) throws RegistrationException
+   {
+      return (Registration)getConsumerOrRegistration(registrationHandle, false);
+   }
 
-      return group.addConsumer(id); // todo: add capabilities and group?
+   public void removeRegistration(String registrationHandle) throws RegistrationException, NoSuchRegistrationException
+   {
+      Registration registration = getRegistration(registrationHandle);
+      if (registration == null)
+      {
+         throw new NoSuchRegistrationException("There is no Registration with handle '" + registrationHandle + "'");
+      }
+      removeRegistration(registration);
    }
 
-   public void removeConsumer(String id) throws RegistrationException, NoSuchRegistrationException
+   public void removeRegistration(Registration registration) throws RegistrationException, NoSuchRegistrationException
    {
-      // todo: add group support
-      ConsumerGroup group = registry.getGroup("default");
-      group.removeConsumer(id);
+      ParameterValidation.throwIllegalArgExceptionIfNull(registration, "Registration");
+      String handle = registration.getRegistrationHandle();
+      ConsumerSPI consumer = (ConsumerSPI)getConsumerFor(handle);
+
+      if (consumer == null)
+      {
+         throw new NoSuchRegistrationException("Could not locate a Consumer for Registration with handle '" + handle
+            + "' (id: '" + registration.getId() + "')");
+      }
+
+      consumer.removeRegistration(registration);
+      registrations.remove(registration.getRegistrationHandle());
+      persistenceManager.removeRegistration(registration.getId());
+      persistenceManager.save(consumer);
    }
 
-   public Consumer getConsumer(String id) throws RegistrationException
+   public ConsumerGroup getConsumerGroup(String groupName) throws RegistrationException
    {
-      ConsumerGroup group = registry.getGroup("default");
-      return group.getConsumer(id);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName, "ConsumerGroup name", null);
+      return persistenceManager.getConsumerGroup(groupName);
    }
 
-   public Consumer getConsumerFor(String registrationHandle) throws RegistrationException
+   private ConsumerSPI getOrCreateConsumer(String identity, boolean createConsumerIfNeeded, String consumerName)
+      throws RegistrationException
    {
-      // chris: don't think that the registration id should actually be exposed...
-      return registry.getRegistration(registrationHandle).getConsumer();
+      ConsumerSPI consumer = (ConsumerSPI)getConsumerByIdentity(identity);
+      if (consumer == null)
+      {
+         if (createConsumerIfNeeded)
+         {
+            consumer = (ConsumerSPI)createConsumer(consumerName);
+         }
+         else
+         {
+            throw new NoSuchRegistrationException("There is no Consumer named '" + consumerName + "'.");
+         }
+      }
+      return consumer;
    }
 
-   public void removeRegistration(String registrationHandle) throws RegistrationException, NoSuchRegistrationException
+   private Object getConsumerOrRegistration(String registrationHandle, boolean getConsumer)
    {
-      // chris: don't think that the registration id should actually be exposed...
-      registry.removeRegistration(registrationHandle);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationHandle, "registration handle", null);
+      // this particular implementations uses a map though it could delegate to the registry and make a DB query to retrieve the info
+      ConsumerRegistration cr = (ConsumerRegistration)registrations.get(registrationHandle);
+
+      if (cr != null)
+      {
+         return (getConsumer ? (Object)cr.consumer : cr.registration);
+      }
+      else
+      {
+         return null;
+      }
    }
+
+   private static class ConsumerRegistration
+   {
+      private Registration registration;
+      private Consumer consumer;
+
+
+      public ConsumerRegistration(Registration registration, Consumer consumer)
+      {
+         this.registration = registration;
+         this.consumer = consumer;
+      }
+   }
 }

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationMetaData.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,58 +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.                   *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.api;
-
-import javax.xml.namespace.QName;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public interface RegistrationMetaData
-{
-
-   boolean requiresRegistration();
-
-   void setRequiresRegistration(boolean requiresRegistration);
-
-   boolean fullServiceDescriptionRequiresRegistration();
-
-   void setFullServiceDescriptionRequiresRegistration(boolean fullServiceDescriptionRequiresRegistration);
-
-   Map getRegistrationProperties();
-
-   void addRegistrationProperty(RegistrationPropertyDescription propertyDescription);
-
-   void removeRegistrationProperty(String propertyName);
-
-   void removeRegistrationProperty(QName propertyName);
-
-   void clearRegistrationProperties();
-
-   boolean acceptValueFor(Object value, QName propertyName);
-
-   boolean acceptValueFor(Object value, String propertyName);
-}

Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPersistenceManager.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPersistenceManager.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPersistenceManager.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.api;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPersistenceManager
+{
+   /**
+    * Creates a Consumer with the specified identity and name (which might be the same, depending on the policy)
+    *
+    * @param identity the Consumer's identity
+    * @param name     the Consumer's name
+    * @return
+    * @throws RegistrationException
+    */
+   Consumer createConsumer(String identity, String name) throws RegistrationException;
+
+   /**
+    * Retrieves the ConsumerGroup identified by the specified name.
+    *
+    * @param name the name of the group to be retrieved
+    * @return the ConsumerGroup identified by the specified name
+    * @throws RegistrationException
+    */
+   ConsumerGroup getConsumerGroup(String name) throws RegistrationException;
+
+   /**
+    * Creates a new ConsumerGroup with the associated name.
+    *
+    * @param name the name of the ConsumerGroup to be created
+    * @return a new ConsumerGroup with the associated name
+    * @throws RegistrationException
+    */
+   ConsumerGroup createConsumerGroup(String name) throws RegistrationException;
+
+   void removeConsumerGroup(String name) throws RegistrationException;
+
+   void removeConsumer(String identity) throws RegistrationException;
+
+   void removeRegistration(String id) throws RegistrationException;
+
+   Consumer getConsumerByIdentity(String identity) throws RegistrationException;
+
+   Registration addRegistrationFor(String consumerIdentity, Map registrationProperties) throws RegistrationException;
+
+   ConsumerGroup save(ConsumerGroup group);
+
+   Registration save(Registration registration);
+
+   Consumer save(Consumer consumer);
+
+   Collection getConsumerGroups();
+
+   Registration getRegistration(String registrationId);
+}

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPolicy.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPolicy.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPolicy.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -32,13 +32,18 @@
  */
 public interface RegistrationPolicy
 {
-   String getOrCreateIdentifierForConsumerWith(String name, ConsumerCapabilities capabilities)
+   void validateRegistrationDataFor(Map registrationProperties, String consumerIdentity)
+      throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException;
+
+   String createRegistrationHandleFor(String registrationId);
+
+   String getGroupNameFor(String consumerName);
+
+   String getConsumerIdentityFrom(String consumerName, Map registrationProperties)
       throws IllegalArgumentException, InvalidConsumerDataException;
 
-   void validateRegistrationDataFor(Map registrationProperties, Consumer consumer)
-      throws IllegalArgumentException, InvalidConsumerDataException, DuplicateRegistrationException;
+   void validateConsumerName(String consumerName)
+      throws IllegalArgumentException, RegistrationException;
 
-   String createRegistrationHandleFor(String registrationId);
-
-   String getGroupIdentifierFor(String consumerIdentifier);
+   void validateConsumerGroupName(String groupName) throws IllegalArgumentException, RegistrationException;
 }

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerGroupImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerGroupImpl.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerGroupImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -22,37 +22,35 @@
  ******************************************************************************/
 package org.jboss.portal.wsrp.producer.registration.impl;
 
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.common.util.ParameterValidation;
 import org.jboss.portal.wsrp.producer.registration.api.Consumer;
 import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
 import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerGroupSPI;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerSPI;
 
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-import java.util.Iterator;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  * @version $Revision: 1.1 $
  */
-public class ConsumerGroupImpl implements ConsumerGroup
+public class ConsumerGroupImpl implements ConsumerGroupSPI
 {
 
    private String name;
    private Map consumers;
    private RegistrationStatus status;
-   final ConsumerRegistryImpl registry;
 
-   public ConsumerGroupImpl(String name, ConsumerRegistryImpl registry)
+   public ConsumerGroupImpl(String name)
    {
       this.name = name;
       this.consumers = new HashMap();
-      this.registry = registry;
    }
 
    public String getName()
@@ -60,6 +58,17 @@
       return name;
    }
 
+
+   public RegistrationStatus getStatus()
+   {
+      return status;
+   }
+
+   public void setStatus(RegistrationStatus status)
+   {
+      this.status = status;
+   }
+
    public Collection getConsumers() throws RegistrationException
    {
       return Collections.unmodifiableCollection(consumers.values());
@@ -67,36 +76,30 @@
 
    public Consumer getConsumer(String consumerName) throws IllegalArgumentException, RegistrationException
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(consumerName, "Consumer name");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "Consumer name", null);
       return (Consumer)consumers.get(consumerName);
    }
 
-   public Consumer addConsumer(String consumerName) throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException
+   public boolean isEmpty()
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(consumerName, "Consumer name");
-      if (consumers.containsKey(consumerName))
+      return consumers.isEmpty();
+   }
+
+   public void addConsumer(ConsumerSPI consumer) throws DuplicateRegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
+      if (consumers.containsKey(consumer.getName()))
       {
          throw new DuplicateRegistrationException();
       }
-      ConsumerImpl consumer = new ConsumerImpl(consumerName, this);
-      consumers.put(consumerName, consumer);
-      return consumer;
    }
 
-   public void removeConsumer(String consumerName) throws IllegalArgumentException, RegistrationException, NoSuchRegistrationException
+   public void removeConsumer(ConsumerSPI consumer) throws NoSuchRegistrationException
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(consumerName, "Consumer name");
-      ConsumerImpl consumer = (ConsumerImpl)consumers.remove(consumerName);
-      if (consumer == null)
+      ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
+      if (consumers.remove(consumer.getName()) == null)
       {
          throw new NoSuchRegistrationException();
       }
-
-      //
-      for (Iterator i = consumer.registrationIds.iterator(); i.hasNext();)
-      {
-         String regId = (String)i.next();
-         registry.registrations.remove(regId);
-      }
    }
 }

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -24,16 +24,17 @@
 package org.jboss.portal.wsrp.producer.registration.impl;
 
 import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.wsrp.core.RegistrationData;
-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;
 import org.jboss.portal.wsrp.producer.registration.api.Registration;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerGroupSPI;
+import org.jboss.portal.wsrp.producer.registration.spi.ConsumerSPI;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 /**
@@ -41,22 +42,24 @@
  * @version $Revision$
  * @since 2.6
  */
-public class ConsumerImpl implements Consumer
+public class ConsumerImpl implements ConsumerSPI
 {
 
    private String name;
-   Set registrationIds;
+   private String identity;
+   private Set registrations;
    private RegistrationStatus status;
-   private ConsumerGroupImpl group;
+   private ConsumerGroup group;
+   private ConsumerCapabilities capabilities;
 
-   public ConsumerImpl(String name, ConsumerGroupImpl group)
+   public ConsumerImpl(String identity, String name)
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(name, "Consumer name");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "Consumer");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "identity", "Consumer");
 
-      //
       this.name = name;
-      this.registrationIds = new HashSet();
-      this.group = group;
+      this.identity = identity;
+      registrations = new HashSet();
    }
 
    public String getName()
@@ -64,6 +67,21 @@
       return name;
    }
 
+   public String getIdentity()
+   {
+      return identity;
+   }
+
+   public ConsumerCapabilities getCapabilities()
+   {
+      return capabilities;
+   }
+
+   public void setCapabilities(ConsumerCapabilities capabilities)
+   {
+      this.capabilities = capabilities;
+   }
+
    public RegistrationStatus getStatus()
    {
       return status;
@@ -77,29 +95,26 @@
 
    public Collection getRegistrations() throws RegistrationException
    {
-      Set registrations = new HashSet();
-      for (Iterator i = registrationIds.iterator(); i.hasNext();)
-      {
-         String regId = (String)i.next();
-         registrations.add(group.registry.getRegistration(regId));
-      }
-      return registrations;
+      return Collections.unmodifiableSet(registrations);
    }
 
-   public Registration addRegistration(RegistrationData metaData) throws RegistrationException
+   public ConsumerGroup getGroup()
    {
-      Registration registration = group.registry.addRegistration(this, metaData);
-      registrationIds.add(registration.getId());
-      return registration;
+      return group;
    }
 
-   public ConsumerGroup getGroup()
+   public void addRegistration(Registration registration)
    {
-      return group;
+      registrations.add(registration);
    }
 
-   void removeRegistration(String registrationId)
+   public void removeRegistration(Registration registration)
    {
-      registrationIds.remove(registrationId);
+      registrations.remove(registrations);
    }
+
+   public void setGroup(ConsumerGroupSPI group)
+   {
+      this.group = group;
+   }
 }

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerRegistryImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerRegistryImpl.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerRegistryImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,147 +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.                   *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.impl;
-
-import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.producer.registration.ConsumerRegistry;
-import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class ConsumerRegistryImpl extends AbstractJBossService implements ConsumerRegistry
-{
-
-   long lastId;
-
-   private Map groups = new HashMap();
-
-   final Map registrations = new HashMap();
-
-   public Collection getGroups() throws RegistrationException
-   {
-      if (groups == null)
-      {
-         return Collections.EMPTY_LIST;
-      }
-      return Collections.unmodifiableCollection(groups.values());
-   }
-
-   public ConsumerGroup getGroup(String groupName) throws RegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(groupName, "Group name");
-      return (ConsumerGroup)groups.get(groupName);
-   }
-
-   public ConsumerGroup addGroup(String groupName) throws RegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(groupName, "Consumer name");
-      if (groups.containsKey(groupName))
-      {
-         throw new DuplicateRegistrationException("Consumer " + groupName + " is already registered");
-      }
-      ConsumerGroup group = new ConsumerGroupImpl(groupName, this);
-      groups.put(groupName, group);
-      return group;
-   }
-
-   public void removeGroup(String consumerName) throws RegistrationException, NoSuchRegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(consumerName, "Group name");
-
-      //
-      ConsumerGroupImpl group = (ConsumerGroupImpl)groups.remove(consumerName);
-      if (group == null)
-      {
-         throw new NoSuchRegistrationException("No registered consumer named '" + consumerName + "'");
-      }
-
-      // Cascade delete the registrations
-      for (Iterator i = new ArrayList(group.getConsumers()).iterator();i.hasNext();)
-      {
-         ConsumerImpl consumer = (ConsumerImpl)i.next();
-         group.removeConsumer(consumer.getName());
-      }
-   }
-
-   public Registration getRegistration(String registrationId) throws RegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(registrationId, "Registration id");
-      return (Registration)registrations.get(registrationId);
-   }
-
-   public void removeRegistration(String registrationId) throws RegistrationException, NoSuchRegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(registrationId, "Registration id");
-      RegistrationImpl reg = (RegistrationImpl)registrations.remove(registrationId);
-      if (reg == null)
-      {
-         throw new NoSuchRegistrationException();
-      }
-
-      // Destroy association
-      reg.consumer.removeRegistration(reg.id);
-      reg.consumer = null;
-   }
-
-   Registration addRegistration(ConsumerImpl consumer, RegistrationData metaData) throws RegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(metaData, "Registration meta data");
-
-      // todo
-
-      // allow the new registration only if the registration properties are different that existing registrations
-      // for this consumer...
-//      for (Iterator iterator = registrations.values().iterator(); iterator.hasNext();)
-//      {
-//         Registration registration = (Registration)iterator.next();
-//         if (registration.hasEqualProperties(props))
-//         {
-//            throw new RegistrationException("Consumer named '" + name
-//               + "' has already been registered with the same set of registration properties. Registration rejected!");
-//         }
-//      }
-
-      String id = "" + lastId++;
-      RegistrationImpl registration = new RegistrationImpl(id, consumer, RegistrationStatus.VALID, metaData);
-      registrations.put(id, registration);
-      return registration;
-   }
-}

Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -24,15 +24,12 @@
 package org.jboss.portal.wsrp.producer.registration.impl;
 
 import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.wsrp.core.Property;
-import org.jboss.portal.wsrp.core.RegistrationData;
 import org.jboss.portal.wsrp.producer.registration.api.Consumer;
 import org.jboss.portal.wsrp.producer.registration.api.Registration;
 import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
 
 import javax.xml.namespace.QName;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -44,26 +41,19 @@
 public class RegistrationImpl implements Registration
 {
 
-   final String id;
-   ConsumerImpl consumer;
+   private final String id;
+   private ConsumerImpl consumer;
    private RegistrationStatus status;
    private Map properties;
+   private String registrationHandle;
 
 
-   public RegistrationImpl(String id, ConsumerImpl consumer, RegistrationStatus status, RegistrationData data)
+   public RegistrationImpl(String id, ConsumerImpl consumer, RegistrationStatus status, Map properties)
    {
       this.id = id;
       this.consumer = consumer;
       this.status = status;
-      this.properties = new HashMap(7);
-
-      // Update state with data
-      Property[] props = data.getRegistrationProperties();
-      for (int i = 0; i < props.length; i++)
-      {
-         Property prop = props[i];
-         properties.put(prop.getName(), prop.getStringValue());
-      }
+      this.properties = properties;
    }
 
    public String getId()
@@ -71,6 +61,16 @@
       return id;
    }
 
+   public void setRegistrationHandle(String handle)
+   {
+      this.registrationHandle = handle;
+   }
+
+   public String getRegistrationHandle()
+   {
+      return registrationHandle;
+   }
+
    public Consumer getConsumer()
    {
       return consumer;
@@ -147,4 +147,5 @@
       ParameterValidation.throwIllegalArgExceptionIfNull(status, "RegistrationStatus");
       this.status = status;
    }
+
 }

Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationPersistenceManagerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationPersistenceManagerImpl.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationPersistenceManagerImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,161 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.impl;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPersistenceManagerImpl implements RegistrationPersistenceManager
+{
+   private long lastRegistrationId;
+   private Map consumers = new HashMap();
+   private Map groups = new HashMap();
+   private Map registrations = new HashMap();
+
+   public Consumer createConsumer(String identity, String name) throws RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "Consumer identity", null);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Consumer name", null);
+
+      ConsumerImpl consumer = new ConsumerImpl(identity, name);
+      consumers.put(identity, consumer);
+
+      return consumer;
+   }
+
+   public ConsumerGroup getConsumerGroup(String name) throws RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Group name", null);
+
+      return (ConsumerGroup)groups.get(name);
+   }
+
+   public ConsumerGroup createConsumerGroup(String name) throws RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Group name", null);
+
+      ConsumerGroupImpl group = new ConsumerGroupImpl(name);
+      groups.put(name, group);
+
+      return group;
+   }
+
+   public void removeConsumerGroup(String name) throws RegistrationException
+   {
+      ConsumerGroup group = getConsumerGroup(name);
+
+      if (group == null)
+      {
+         throw new RegistrationException("There is no ConsumerGroup named '" + name + "'.");
+      }
+
+      groups.remove(name);
+   }
+
+   public void removeConsumer(String identity) throws RegistrationException
+   {
+      Consumer consumer = getConsumerByIdentity(identity);
+
+      if (consumer == null)
+      {
+         throw new RegistrationException("There is no Consumer with identity '" + identity + "'.");
+      }
+
+      consumers.remove(identity);
+   }
+
+   public void removeRegistration(String id) throws RegistrationException
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   public Consumer getConsumerByIdentity(String identity) throws RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "Consumer identity", null);
+
+      return (Consumer)consumers.get(identity);
+   }
+
+   public Registration addRegistrationFor(String consumerIdentity, Map registrationProperties) throws RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity, "Consumer identity", null);
+      ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties, "Registration properties");
+
+      ConsumerImpl consumer = (ConsumerImpl)getConsumerByIdentity(consumerIdentity);
+      if (consumer == null)
+      {
+         throw new NoSuchRegistrationException("There is no Consumer with identity '" + consumerIdentity
+            + "' to a Registration to...");
+      }
+
+      RegistrationImpl registration = new RegistrationImpl("" + lastRegistrationId++, consumer,
+         RegistrationStatus.PENDING, registrationProperties);
+      consumer.addRegistration(registration);
+
+      registrations.put(registration.getId(), registration);
+
+      return registration;
+   }
+
+   public ConsumerGroup save(ConsumerGroup group)
+   {
+      return null;  //todo: implement
+   }
+
+   public Registration save(Registration registration)
+   {
+      return null;  //todo: implement
+   }
+
+   public Consumer save(Consumer consumer)
+   {
+      return null;  //todo: implement
+   }
+
+   public Collection getConsumerGroups()
+   {
+      return Collections.unmodifiableCollection(groups.values());
+   }
+
+   public Registration getRegistration(String registrationId)
+   {
+      return (Registration)registrations.get(registrationId);
+   }
+}

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,119 +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.                   *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.policies;
-
-import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.wsrp.core.Property;
-import org.jboss.portal.wsrp.core.RegistrationData;
-import org.jboss.portal.wsrp.producer.registration.ConsumerRegistry;
-import org.jboss.portal.wsrp.producer.registration.api.Consumer;
-import org.jboss.portal.wsrp.producer.registration.api.Registration;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationMetaData;
-import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
-import org.jboss.portal.wsrp.producer.registration.impl.ConsumerRegistryImpl;
-
-import javax.xml.namespace.QName;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class BasicRegistrationPolicy extends AbstractJBossService
-{
-
-   protected ConsumerRegistry consumerRegistry;
-   protected RegistrationMetaData metaData;
-
-   public BasicRegistrationPolicy()
-   {
-      consumerRegistry = new ConsumerRegistryImpl();
-      metaData = new RegistrationMetaDataImpl(false, true, false);
-   }
-
-   public Registration registerConsumerWith(RegistrationData registrationData) throws RegistrationException
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(registrationData, "RegistrationData");
-
-      //
-      String name = registrationData.getConsumerName();
-      ConsumerGroup group = consumerRegistry.getGroup("default");
-      Consumer consumer = group.getConsumer(name);
-
-      // A consumer already exists with that name, we need to check that we can allow a new registration
-      if (consumer == null)
-      {
-         consumer = group.addConsumer(name);
-      }
-
-      return consumer.addRegistration(registrationData);
-   }
-
-   public ConsumerRegistry getConsumerRegistry()
-   {
-      return consumerRegistry;
-   }
-
-   public void setConsumerRegistry(ConsumerRegistry consumerRegistry)
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(consumerRegistry, "ConsumerRegistry");
-      this.consumerRegistry = consumerRegistry;
-   }
-
-   private Map createRegistrationProperties(RegistrationData registrationData)
-   {
-      Property[] regProperties = registrationData.getRegistrationProperties();
-      Map properties = new HashMap(regProperties.length);
-
-      for (int i = 0; i < regProperties.length; i++)
-      {
-         Property property = regProperties[i];
-         // todo: should be more detailed here... use the language, allow other value types...
-         properties.put(new QName(property.getName()), property.getStringValue());
-      }
-
-      return properties;
-   }
-
-   private List getListFromArray(String[] array)
-   {
-      if (array == null)
-      {
-         return Collections.EMPTY_LIST;
-      }
-      return Arrays.asList(array);
-   }
-
-   public RegistrationMetaData getMetaData()
-   {
-      return metaData;
-   }
-}

Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java (from rev 5663, trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/BasicRegistrationPolicy.java	2006-11-15 19:20:40 UTC (rev 5663)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,139 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.policies;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.InvalidConsumerDataException;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Provides a default implementation of RegistrationPolicy.
+ *
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class DefaultRegistrationPolicy extends AbstractJBossService implements RegistrationPolicy
+{
+   private RegistrationManager manager;
+
+
+   public RegistrationManager getManager()
+   {
+      return manager;
+   }
+
+   public void setManager(RegistrationManager manager)
+   {
+      this.manager = manager;
+   }
+
+   /**
+    * @throws DuplicateRegistrationException if a Consumer with the same identity has already registered with the same
+    *                                        registration properties.
+    */
+   public void validateRegistrationDataFor(Map registrationProperties, String consumerIdentity)
+      throws IllegalArgumentException, RegistrationException, DuplicateRegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties, "Registration properties");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity, "Consumer identity", null);
+
+      Consumer consumer = manager.getConsumerByIdentity(consumerIdentity);
+      if (consumer != null)
+      {
+         // allow the new registration only if the registration properties are different that existing registrations
+         // for this consumer...
+         for (Iterator iterator = consumer.getRegistrations().iterator(); iterator.hasNext();)
+         {
+            Registration registration = (Registration)iterator.next();
+            if (registration.hasEqualProperties(registrationProperties))
+            {
+               throw new DuplicateRegistrationException("Consumer named '" + consumer.getName()
+                  + "' has already been registered with the same set of registration properties. Registration rejected!");
+            }
+         }
+      }
+      else
+      {
+         // check that values are consistent with ProducerRegistrationRequirement
+         // todo: implement
+      }
+   }
+
+   /** Simply returns the given registration id. */
+   public String createRegistrationHandleFor(String registrationId)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId, "Registration id", null);
+      return registrationId;
+   }
+
+   /** Doesn't support automatic ConsumerGroups so always return <code>null</code>. */
+   public String getGroupNameFor(String consumerName)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "Consumer name", null);
+      return null;
+   }
+
+   /** Simply returns the given consumer name, trusted (!) to be unique. */
+   public String getConsumerIdentityFrom(String consumerName, Map registrationProperties) throws IllegalArgumentException, InvalidConsumerDataException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "Consumer name", null);
+      return consumerName;
+   }
+
+   /** Rejects registration if a Consumer with the specified name already exists. */
+   public void validateConsumerName(String consumerName) throws IllegalArgumentException, RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "Consumer name", null);
+
+      Consumer consumer = manager.getConsumerByIdentity(getConsumerIdentityFrom(consumerName, Collections.EMPTY_MAP));
+      if (consumer != null)
+      {
+         throw new DuplicateRegistrationException("A Consumer named '" + consumerName + "' has already been registered.");
+      }
+   }
+
+   /** Rejects name if a ConsumerGroup with the specified name already exists. */
+   public void validateConsumerGroupName(String groupName) throws IllegalArgumentException, RegistrationException
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName, "ConsumerGroup name", null);
+
+      ConsumerGroup group = manager.getConsumerGroup(groupName);
+      if (group != null)
+      {
+         throw new DuplicateRegistrationException("A ConsumerGroup named '" + groupName + "' has already been registered.");
+      }
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/ProducerRegistrationRequirementsImpl.java (from rev 5651, trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java	2006-11-14 20:19:33 UTC (rev 5651)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/ProducerRegistrationRequirementsImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.policies;
+
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.wsrp.producer.registration.api.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ProducerRegistrationRequirementsImpl implements ProducerRegistrationRequirements
+{
+   private boolean requiresRegistration;
+   private boolean fullServiceDescriptionRequiresRegistration;
+
+   /** property name (QName) -> PropertyDescription */
+   private Map registrationProperties;
+
+   public ProducerRegistrationRequirementsImpl(boolean requiresMarshalling, boolean requiresRegistration, boolean fullServiceDescriptionRequiresRegistration)
+   {
+      this.requiresRegistration = requiresRegistration;
+      this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+      registrationProperties = new HashMap(7);
+   }
+
+   public boolean requiresRegistration()
+   {
+      return requiresRegistration;
+   }
+
+   public void setRequiresRegistration(boolean requiresRegistration)
+   {
+      this.requiresRegistration = requiresRegistration;
+   }
+
+   public boolean fullServiceDescriptionRequiresRegistration()
+   {
+      return fullServiceDescriptionRequiresRegistration;
+   }
+
+   public void setFullServiceDescriptionRequiresRegistration(boolean fullServiceDescriptionRequiresRegistration)
+   {
+      this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
+   }
+
+   public Map getRegistrationProperties()
+   {
+      return Collections.unmodifiableMap(registrationProperties);
+   }
+
+   public void addRegistrationProperty(RegistrationPropertyDescription propertyDescription)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "PropertyDescription");
+      registrationProperties.put(propertyDescription.getName(), propertyDescription);
+   }
+
+   public boolean acceptValueFor(Object value, QName propertyName)
+   {
+      QName type = getPropertyDescription(propertyName).getType();
+      // todo: decide if type is actually compatible with value...
+      return true;
+   }
+
+   public boolean acceptValueFor(Object value, String propertyName)
+   {
+      return acceptValueFor(value, new QName(propertyName));
+   }
+
+   private RegistrationPropertyDescription getPropertyDescription(QName propertyName)
+   {
+      return (RegistrationPropertyDescription)registrationProperties.get(propertyName);
+   }
+
+   public void removeRegistrationProperty(QName propertyName)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
+      registrationProperties.remove(propertyName);
+   }
+
+   public void clearRegistrationProperties()
+   {
+      registrationProperties.clear();
+   }
+
+   public void removeRegistrationProperty(String propertyName)
+   {
+      removeRegistrationProperty(new QName(propertyName));
+   }
+}


Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/ProducerRegistrationRequirementsImpl.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/RegistrationMetaDataImpl.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -1,118 +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.                   *
- ******************************************************************************/
-
-package org.jboss.portal.wsrp.producer.registration.policies;
-
-import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationMetaData;
-import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropertyDescription;
-
-import javax.xml.namespace.QName;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class RegistrationMetaDataImpl implements RegistrationMetaData
-{
-   private boolean requiresRegistration;
-   private boolean fullServiceDescriptionRequiresRegistration;
-
-   /** property name (QName) -> PropertyDescription */
-   private Map registrationProperties;
-
-   public RegistrationMetaDataImpl(boolean requiresMarshalling, boolean requiresRegistration, boolean fullServiceDescriptionRequiresRegistration)
-   {
-      this.requiresRegistration = requiresRegistration;
-      this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
-      registrationProperties = new HashMap(7);
-   }
-
-   public boolean requiresRegistration()
-   {
-      return requiresRegistration;
-   }
-
-   public void setRequiresRegistration(boolean requiresRegistration)
-   {
-      this.requiresRegistration = requiresRegistration;
-   }
-
-   public boolean fullServiceDescriptionRequiresRegistration()
-   {
-      return fullServiceDescriptionRequiresRegistration;
-   }
-
-   public void setFullServiceDescriptionRequiresRegistration(boolean fullServiceDescriptionRequiresRegistration)
-   {
-      this.fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration;
-   }
-
-   public Map getRegistrationProperties()
-   {
-      return Collections.unmodifiableMap(registrationProperties);
-   }
-
-   public void addRegistrationProperty(RegistrationPropertyDescription propertyDescription)
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(propertyDescription, "PropertyDescription");
-      registrationProperties.put(propertyDescription.getName(), propertyDescription);
-   }
-
-   public boolean acceptValueFor(Object value, QName propertyName)
-   {
-      QName type = getPropertyDescription(propertyName).getType();
-      // todo: decide if type is actually compatible with value...
-      return true;
-   }
-
-   public boolean acceptValueFor(Object value, String propertyName)
-   {
-      return acceptValueFor(value, new QName(propertyName));
-   }
-
-   private RegistrationPropertyDescription getPropertyDescription(QName propertyName)
-   {
-      return (RegistrationPropertyDescription)registrationProperties.get(propertyName);
-   }
-
-   public void removeRegistrationProperty(QName propertyName)
-   {
-      ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
-      registrationProperties.remove(propertyName);
-   }
-
-   public void clearRegistrationProperties()
-   {
-      registrationProperties.clear();
-   }
-
-   public void removeRegistrationProperty(String propertyName)
-   {
-      removeRegistrationProperty(new QName(propertyName));
-   }
-}

Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerGroupSPI.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerGroupSPI.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerGroupSPI.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.spi;
+
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationException;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ConsumerGroupSPI extends ConsumerGroup
+{
+   void addConsumer(ConsumerSPI consumer) throws DuplicateRegistrationException;
+
+   void removeConsumer(ConsumerSPI consumer) throws NoSuchRegistrationException;
+}

Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerSPI.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerSPI.java	2006-11-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/spi/ConsumerSPI.java	2006-11-17 06:30:31 UTC (rev 5670)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * 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.                   *
+ ******************************************************************************/
+
+package org.jboss.portal.wsrp.producer.registration.spi;
+
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ConsumerSPI extends Consumer
+{
+   void addRegistration(Registration registration);
+
+   void removeRegistration(Registration registration);
+
+   void setGroup(ConsumerGroupSPI group);
+}

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml	2006-11-17 06:30:31 UTC (rev 5670)
@@ -91,7 +91,7 @@
    </mbean>
 
    <!-- Registration policy -->
-   <mbean code="org.jboss.portal.wsrp.producer.registration.policies.BasicRegistrationPolicy"
+   <mbean code="org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy"
           name="portal.wsrp:service=RegistrationPolicy" xmbean-dd=""
           xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
       <xmbean/>

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-16 18:49:35 UTC (rev 5669)
+++ trunk/wsrp/src/resources/tests/test-wsrp-producer-sar/META-INF/jboss-service.xml	2006-11-17 06:30:31 UTC (rev 5670)
@@ -178,8 +178,8 @@
       <attribute name="RemotableByDefault">true</attribute>
    </mbean>
 
-   <!-- Use BasicRegistrationPolicy for registration -->
-   <mbean code="org.jboss.portal.wsrp.producer.registration.policies.BasicRegistrationPolicy"
+   <!-- Use DefaultRegistrationPolicy for registration -->
+   <mbean code="org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistrationPolicy"
           name="portal.wsrp:service=RegistrationPolicy" xmbean-dd=""
           xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
       <xmbean/>




More information about the jboss-svn-commits mailing list