Author: julien(a)jboss.com
Date: 2006-12-10 19:58:34 -0500 (Sun, 10 Dec 2006)
New Revision: 5787
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.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/RegistrationPersistenceManager.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/RegistrationManagerImpl.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
Log:
- started registration persistence manager implementation, not functional yet
- renamed consumer identity field to consumer id
- did some argument method renaming for consistency
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-12-10 21:28:02 UTC (rev 5786)
+++ trunk/core/build.xml 2006-12-11 00:58:34 UTC (rev 5787)
@@ -123,6 +123,7 @@
<path refid="jboss.portal-faces.classpath"/>
<path refid="jboss.portal-cms.classpath"/>
<path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-wsrp.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-federation.classpath"/>
@@ -352,6 +353,7 @@
<fileset dir="${jboss.portal-security.root}/lib"
includes="portal-security-lib.jar"/>
<fileset dir="${jboss.portal-samples.root}/lib"
includes="portal-samples-lib.jar"/>
<fileset dir="${jboss.portal-identity.root}/lib"
includes="portal-identity-lib.jar"/>
+ <fileset dir="${jboss.portal-wsrp.root}/lib"
includes="portal-wsrp-lib.jar"/>
<fileset dir="${ehcache.ehcache.lib}"
includes="ehcache.jar"/>
<fileset dir="${apache.collections.lib}"
includes="commons-collections.jar"/>
<fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumer.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -0,0 +1,213 @@
+/******************************************************************************
+ * 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.core.impl.portlet.state;
+
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerCapabilities;
+import org.jboss.portal.wsrp.producer.registration.api.DuplicateRegistrationException;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PersistentConsumer implements Consumer
+{
+
+ // Persistent fields
+
+ private String key;
+ private String persistentName;
+ private RegistrationStatus persistentStatus;
+ private String persistentAgent;
+
+ // Relationships
+
+ private Set relatedRegistrations;
+ private PersistentConsumerGroup relatedGroup;
+
+ /**
+ * Manager constructor.
+ *
+ * @param id
+ * @param name
+ */
+ PersistentConsumer(String id, String name)
+ {
+ this.key = id;
+ this.persistentName = name;
+ this.persistentStatus = RegistrationStatus.PENDING;
+ this.relatedRegistrations = new HashSet();
+ this.relatedGroup = null;
+ this.persistentAgent = null;
+ }
+
+ /**
+ * Hibernate constructor.
+ */
+ PersistentConsumer()
+ {
+ this.key = null;
+ this.persistentName = null;
+ this.persistentStatus = null;
+ this.relatedRegistrations = null;
+ this.relatedGroup = null;
+ this.persistentAgent = null;
+ }
+
+ // Hibernate
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+
+ public String getPersistentName()
+ {
+ return persistentName;
+ }
+
+ public void setPersistentName(String persistentName)
+ {
+ this.persistentName = persistentName;
+ }
+
+ public RegistrationStatus getPersistentStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setPersistentStatus(RegistrationStatus persistentStatus)
+ {
+ this.persistentStatus = persistentStatus;
+ }
+
+ public String getPersistentAgent()
+ {
+ return persistentAgent;
+ }
+
+ public void setPersistentAgent(String persistentAgent)
+ {
+ this.persistentAgent = persistentAgent;
+ }
+
+ public Set getRelatedRegistrations()
+ {
+ return relatedRegistrations;
+ }
+
+ public void setRelatedRegistrations(Set relatedRegistrations)
+ {
+ this.relatedRegistrations = relatedRegistrations;
+ }
+
+ public PersistentConsumerGroup getRelatedGroup()
+ {
+ return relatedGroup;
+ }
+
+ public void setRelatedGroup(PersistentConsumerGroup relatedGroup)
+ {
+ this.relatedGroup = relatedGroup;
+ }
+
+ //
+
+ public String getName()
+ {
+ return persistentName;
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ this.persistentStatus = status;
+ }
+
+ public Collection getRegistrations() throws RegistrationException
+ {
+ return Collections.unmodifiableSet(relatedRegistrations);
+ }
+
+ public ConsumerGroup getGroup()
+ {
+ return relatedGroup;
+ }
+
+ public String getId()
+ {
+ return key;
+ }
+
+ public ConsumerCapabilities getCapabilities()
+ {
+ return null;
+ }
+
+ public void setCapabilities(ConsumerCapabilities capabilities)
+ {
+
+ }
+
+ public void setGroup(ConsumerGroup group) throws RegistrationException,
DuplicateRegistrationException
+ {
+ if (this.relatedGroup != null)
+ {
+ this.relatedGroup.removeConsumer(this);
+ }
+
+ //
+ if (group != null)
+ {
+ group.addConsumer(this);
+ }
+ }
+
+ public String getConsumerAgent()
+ {
+ return persistentAgent;
+ }
+
+ public void setConsumerAgent(String consumerAgent) throws IllegalArgumentException,
IllegalStateException
+ {
+ this.persistentAgent = consumerAgent;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentConsumerGroup.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -0,0 +1,172 @@
+/******************************************************************************
+ * 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.core.impl.portlet.state;
+
+import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PersistentConsumerGroup implements ConsumerGroup
+{
+
+ // Persistent fields
+
+ private String persistentName;
+ private RegistrationStatus persistentStatus;
+
+ // Relationships
+
+ private Map relatedConsumers;
+
+ public PersistentConsumerGroup(String name)
+ {
+ this.persistentName = name;
+ this.relatedConsumers = new HashMap();
+ this.persistentStatus = RegistrationStatus.PENDING;
+ }
+
+ public PersistentConsumerGroup()
+ {
+ }
+
+ // Hibernate
+
+ public String getPersistentName()
+ {
+ return persistentName;
+ }
+
+ public void setPersistentName(String persistentName)
+ {
+ this.persistentName = persistentName;
+ }
+
+ public RegistrationStatus getPersistentStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setPersistentStatus(RegistrationStatus persistentStatus)
+ {
+ this.persistentStatus = persistentStatus;
+ }
+
+ public Map getRelatedConsumers()
+ {
+ return relatedConsumers;
+ }
+
+ public void setRelatedConsumers(Map relatedConsumers)
+ {
+ this.relatedConsumers = relatedConsumers;
+ }
+
+ //
+
+ public String getName()
+ {
+ return persistentName;
+ }
+
+ public Collection getConsumers() throws RegistrationException
+ {
+ return Collections.unmodifiableCollection(relatedConsumers.values());
+ }
+
+ public Consumer getConsumer(String consumerId) throws IllegalArgumentException,
RegistrationException
+ {
+ return (Consumer)relatedConsumers.get(consumerId);
+ }
+
+ public void addConsumer(Consumer consumer) throws RegistrationException
+ {
+ validateImplementation(consumer);
+
+ //
+ if (relatedConsumers.containsKey(consumer.getId()))
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ relatedConsumers.put(consumer.getId(), consumer);
+ }
+
+ public void removeConsumer(Consumer consumer) throws RegistrationException
+ {
+ validateImplementation(consumer);
+
+ //
+ if (relatedConsumers.remove(consumer.getId()) == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public boolean contains(Consumer consumer)
+ {
+ validateImplementation(consumer);
+ return relatedConsumers.containsKey(consumer.getId());
+ }
+
+ private PersistentConsumer validateImplementation(Consumer consumer) throws
IllegalArgumentException
+ {
+ if (consumer == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (consumer instanceof PersistentConsumer)
+ {
+ return (PersistentConsumer)consumer;
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public boolean isEmpty()
+ {
+ return relatedConsumers.isEmpty();
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ this.persistentStatus = status;
+ }
+}
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -0,0 +1,212 @@
+/******************************************************************************
+ * 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.core.impl.portlet.state;
+
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PersistentRegistration implements Registration
+{
+
+ // Persistent fields
+
+ private Long key;
+ private String persistentHandle;
+ private RegistrationStatus persistentStatus;
+ private Map persistentProperties;
+
+ // Relationships
+
+ private PersistentConsumer relatedConsumer;
+
+ /**
+ * Hibernate constructor.
+ */
+ PersistentRegistration()
+ {
+ this.key = null;
+ this.persistentHandle = null;
+ this.relatedConsumer = null;
+ this.persistentStatus = null;
+ }
+
+ PersistentRegistration(Map properties, RegistrationStatus status)
+ {
+ this.key = null;
+ this.persistentHandle = null;
+ this.relatedConsumer = null;
+ this.persistentStatus = status;
+ }
+
+ // Hibernate
+
+ public Long getKey()
+ {
+ return key;
+ }
+
+ public void setKey(Long key)
+ {
+ this.key = key;
+ }
+
+ public String getPersistentHandle()
+ {
+ return persistentHandle;
+ }
+
+ public void setPersistentHandle(String persistentHandle)
+ {
+ this.persistentHandle = persistentHandle;
+ }
+
+ public PersistentConsumer getRelatedConsumer()
+ {
+ return relatedConsumer;
+ }
+
+ public void setRelatedConsumer(PersistentConsumer relatedConsumer)
+ {
+ this.relatedConsumer = relatedConsumer;
+ }
+
+ public RegistrationStatus getPersistentStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setPersistentStatus(RegistrationStatus persistentStatus)
+ {
+ this.persistentStatus = persistentStatus;
+ }
+
+ public Map getPersistentProperties()
+ {
+ return persistentProperties;
+ }
+
+ public void setPersistentProperties(Map persistentProperties)
+ {
+ this.persistentProperties = persistentProperties;
+ }
+
+ //
+
+ public String getId()
+ {
+ if (key == null)
+ {
+ // If that ever happens it is a bug
+ throw new IllegalStateException("Transient registration object");
+ }
+ return key.toString();
+ }
+
+ public void setRegistrationHandle(String handle)
+ {
+ this.persistentHandle = handle;
+ }
+
+ public String getRegistrationHandle()
+ {
+ return persistentHandle;
+ }
+
+ public Consumer getConsumer()
+ {
+ return relatedConsumer;
+ }
+
+ public Map getProperties()
+ {
+ return null;
+ }
+
+ public void setPropertyValueFor(QName propertyName, Object value)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setPropertyValueFor(String propertyName, Object value)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean hasEqualProperties(Registration registration)
+ {
+ return false; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public boolean hasEqualProperties(Map properties)
+ {
+ return false; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public RegistrationStatus getStatus()
+ {
+ return persistentStatus;
+ }
+
+ public void setStatus(RegistrationStatus status)
+ {
+ this.persistentStatus = status;
+ }
+
+ public void clearAssociatedState()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void updateProperties(Map registrationProperties)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void removeProperty(QName propertyName)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void removeProperty(String propertyName)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Object getPropertyValueFor(QName propertyName)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public Object getPropertyValueFor(String propertyName)
+ {
+ return null; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentStateStore.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -33,15 +33,24 @@
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.producer.ProducerPersistenceManager;
import org.jboss.portal.portlet.state.producer.ProducerStateContext;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersistenceManager;
+import org.jboss.portal.wsrp.producer.registration.api.Consumer;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationException;
+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.NoSuchRegistrationException;
+import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
import javax.naming.InitialContext;
import java.util.Iterator;
+import java.util.Map;
+import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PersistentStateStore extends AbstractJBossService implements
ProducerPersistenceManager
+public class PersistentStateStore extends AbstractJBossService implements
ProducerPersistenceManager, RegistrationPersistenceManager
{
/** . */
@@ -229,4 +238,253 @@
throw new InvalidStateIdException(e, stateId);
}
}
+
+ // RegistrationPersistenceManager
***********************************************************************************
+
+
+ public Consumer createConsumer(String consumerId, String consumerName) throws
RegistrationException
+ {
+ if (consumerId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+ if (consumerName == null)
+ {
+ throw new IllegalArgumentException("No null consumer name accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumer consumer = new PersistentConsumer(consumerId, consumerName);
+ session.persist(consumer);
+
+ //
+ return consumer;
+ }
+
+ public ConsumerGroup getConsumerGroup(String name) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findGroupByName(session, name);
+ }
+
+ public ConsumerGroup createConsumerGroup(String name) throws RegistrationException
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ // Create and persist
+ PersistentConsumerGroup group = new PersistentConsumerGroup(name);
+ session.persist(session);
+
+ //
+ return group;
+ }
+
+ public void removeConsumerGroup(String name) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumerGroup group = getGroupByName(session, name);
+
+ //
+ session.delete(group);
+ }
+
+ public void removeConsumer(String consumerId) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentConsumer consumer = getConsumerById(session, consumerId);
+
+ //
+ session.delete(consumer);
+ }
+
+ public void removeRegistration(String registrationId) throws RegistrationException
+ {
+ if (registrationId == null)
+ {
+ throw new IllegalArgumentException("No null registration id
accepted");
+ }
+
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ PersistentRegistration registration = getRegistrationById(session,
registrationId);
+
+ // Get related consumer
+ PersistentConsumer consumer = registration.getRelatedConsumer();
+
+ // Destroy relationship
+ consumer.getRelatedRegistrations().remove(registration);
+ registration.setRelatedConsumer(null);
+
+ // Delete the registration
+ session.delete(registration);
+ }
+
+ public Consumer getConsumerById(String consumerId) throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findConsumerById(session, consumerId);
+ }
+
+ public Registration addRegistrationFor(String consumerId, Map registrationProperties)
throws RegistrationException
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ // Perform lookup
+ PersistentConsumer consumer = getConsumerById(session, consumerId);
+
+ // Create and persist registration
+ PersistentRegistration registration = new
PersistentRegistration(registrationProperties, RegistrationStatus.PENDING);
+ session.persist(registration);
+
+ // Build relationship
+ registration.setRelatedConsumer(consumer);
+ consumer.getRelatedRegistrations().add(registration);
+
+ //
+ return registration;
+ }
+
+ public Registration getRegistration(String registrationId)
+ {
+ // Get hibernate session
+ Session session = getCurrentSession();
+
+ //
+ return findRegistrationById(session, registrationId);
+ }
+
+ public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException
+ {
+ Consumer consumer = getConsumerById(consumerId);
+
+ // Build relationship
+ ConsumerGroup group = getConsumerGroup(groupName);
+ consumer.setGroup(group);
+
+ //
+ return consumer;
+ }
+
+ public Collection getConsumerGroups()
+ {
+ Session session = getCurrentSession();
+ Query query = session.createQuery("from PersistentConsumerGroup");
+ return query.list();
+ }
+
+ public Collection getConsumers()
+ {
+ Session session = getCurrentSession();
+ Query query = session.createQuery("from PersistentConsumer");
+ return query.list();
+ }
+
+ private PersistentRegistration getRegistrationById(Session session, String
registrationId) throws IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentRegistration registration = findRegistrationById(session,
registrationId);
+
+ //
+ if (registration == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a consumer with the id
" + registrationId);
+ }
+
+ //
+ return registration;
+ }
+
+ private PersistentRegistration findRegistrationById(Session session, String
registrationId) throws IllegalArgumentException
+ {
+ if (registrationId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+
+ try
+ {
+ // Parse the key
+ Long key = new Long(registrationId);
+
+ // Perform lookup
+ return (PersistentRegistration)session.get(PersistentRegistration.class, key);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new IllegalArgumentException("Bad registration id format " +
registrationId);
+ }
+ }
+
+ private PersistentConsumer getConsumerById(Session session, String consumerId) throws
IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentConsumer consumer = findConsumerById(session, consumerId);
+
+ //
+ if (consumer == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a consumer with the id
" + consumerId);
+ }
+
+ //
+ return consumer;
+ }
+
+ private PersistentConsumer findConsumerById(Session session, String consumerId) throws
IllegalArgumentException
+ {
+ if (consumerId == null)
+ {
+ throw new IllegalArgumentException("No null consumer id accepted");
+ }
+
+ //
+ return (PersistentConsumer)session.get(PersistentConsumer.class, consumerId);
+ }
+
+ private PersistentConsumerGroup getGroupByName(Session session, String groupName)
throws IllegalArgumentException, NoSuchRegistrationException
+ {
+ PersistentConsumerGroup group = findGroupByName(session, groupName);
+
+ //
+ if (group == null)
+ {
+ throw new NoSuchRegistrationException("Cant find a group with the name
" + groupName);
+ }
+
+ //
+ return group;
+ }
+
+ private PersistentConsumerGroup findGroupByName(Session session, String groupName)
throws IllegalArgumentException
+ {
+ if (groupName == null)
+ {
+ throw new IllegalArgumentException("No null group name accepted");
+ }
+
+ //
+ return (PersistentConsumerGroup)session.get(PersistentConsumerGroup.class,
groupName);
+ }
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGroupTestCase.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -72,7 +72,7 @@
assertEquals(1, group.getConsumers().size());
assertTrue(group.contains(c1));
assertEquals(group, c1.getGroup());
- assertEquals(c1, group.getConsumer(c1.getIdentity()));
+ assertEquals(c1, group.getConsumer(c1.getId()));
Consumer c2 = manager.createConsumer("c2");
group.addConsumer(c2);
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTestCase.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -94,6 +94,6 @@
public void testGetIdentity() throws Exception
{
- assertNotNull(consumer.getIdentity());
+ assertNotNull(consumer.getId());
}
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -122,7 +122,7 @@
Consumer consumer = manager.createConsumer(name);
assertNotNull(consumer);
assertEquals(name, consumer.getName());
- assertNotNull(consumer.getIdentity());
+ assertNotNull(consumer.getId());
assertNull(consumer.getGroup());
Collection consumers = manager.getConsumers();
@@ -293,7 +293,7 @@
String groupName = "group";
String consumerName = "consumer";
Consumer consumer = manager.addConsumerToGroupNamed(consumerName, groupName, true,
true);
- String consumerIdentity = consumer.getIdentity();
+ String consumerIdentity = consumer.getId();
Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
String handle = reg.getRegistrationHandle();
@@ -309,7 +309,7 @@
{
String consumerName = "consumer";
Consumer consumer = manager.createConsumer(consumerName);
- String consumerIdentity = consumer.getIdentity();
+ String consumerIdentity = consumer.getId();
Registration reg = manager.addRegistrationTo(consumerName, registrationProperties,
false);
String handle = reg.getRegistrationHandle();
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationPersistenceManagerTestCase.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -289,7 +289,7 @@
try
{
- manager.addRegistrationFor(consumer.getIdentity(), null);
+ manager.addRegistrationFor(consumer.getId(), null);
fail();
}
catch (IllegalArgumentException expected)
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Consumer.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -79,7 +79,7 @@
*
* @return this Consumer's identity.
*/
- String getIdentity();
+ String getId();
ConsumerCapabilities getCapabilities();
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/ConsumerGroup.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -53,13 +53,13 @@
/**
* Return the member Consumer associated with the given identifier
*
- * @param consumerIdentity the identity of the Consumer to be retrieved
+ * @param consumerId
* @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 consumerIdentity) throws IllegalArgumentException,
RegistrationException;
+ Consumer getConsumer(String consumerId) throws IllegalArgumentException,
RegistrationException;
void addConsumer(Consumer consumer) throws RegistrationException;
Modified:
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPersistenceManager.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -36,12 +36,10 @@
/**
* 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
+ * @param consumerId
+ * @param consumerName
*/
- Consumer createConsumer(String identity, String name) throws RegistrationException;
+ Consumer createConsumer(String consumerId, String consumerName) throws
RegistrationException;
/**
* Retrieves the ConsumerGroup identified by the specified name.
@@ -63,19 +61,27 @@
void removeConsumerGroup(String name) throws RegistrationException;
- void removeConsumer(String identity) throws RegistrationException;
+ void removeConsumer(String consumerId) throws RegistrationException;
- void removeRegistration(String id) throws RegistrationException;
+ void removeRegistration(String registrationId) throws RegistrationException;
- Consumer getConsumerByIdentity(String identity) throws RegistrationException;
+ /**
+ * Return an existing consumer from its id.
+ *
+ * @param consumerId the consumer id
+ * @return the consumer or null if it does not exist
+ * @throws IllegalArgumentException if the consumer id argument is null
+ * @throws RegistrationException
+ */
+ Consumer getConsumerById(String consumerId) throws IllegalArgumentException,
RegistrationException;
- Registration addRegistrationFor(String consumerIdentity, Map registrationProperties)
throws RegistrationException;
+ Registration addRegistrationFor(String consumerId, Map registrationProperties) throws
RegistrationException;
Collection getConsumerGroups();
Registration getRegistration(String registrationId);
- Consumer addConsumerToGroupNamed(String consumerIdentity, String groupName) throws
RegistrationException;
+ Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException;
Collection getConsumers();
}
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/RegistrationPolicy.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -39,7 +39,16 @@
String getGroupNameFor(String consumerName);
- String getConsumerIdentityFrom(String consumerName, Map registrationProperties)
+ /**
+ * Obtain a consumer id in function of the consumer name and registration properties.
+ *
+ * @param consumerName the consumer name
+ * @param registrationProperties the provided registration properties
+ * @return the consumer id
+ * @throws IllegalArgumentException
+ * @throws InvalidConsumerDataException
+ */
+ String getConsumerIdFrom(String consumerName, Map registrationProperties)
throws IllegalArgumentException, InvalidConsumerDataException;
void validateConsumerName(String consumerName)
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerGroupImpl.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -107,10 +107,10 @@
return Collections.unmodifiableCollection(consumers.values());
}
- public Consumer getConsumer(String consumerIdentity) throws IllegalArgumentException,
RegistrationException
+ public Consumer getConsumer(String consumerId) throws IllegalArgumentException,
RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity,
"Consumer name", null);
- return (Consumer)consumers.get(consumerIdentity);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer name", null);
+ return (Consumer)consumers.get(consumerId);
}
public boolean isEmpty()
@@ -121,7 +121,7 @@
public void addConsumer(Consumer consumer) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
- String identity = consumer.getIdentity();
+ String identity = consumer.getId();
if (consumers.containsKey(identity))
{
throw new DuplicateRegistrationException("ConsumerGroup named '" +
name
@@ -136,10 +136,10 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
- if (consumers.remove(consumer.getIdentity()) == null)
+ if (consumers.remove(consumer.getId()) == null)
{
throw new NoSuchRegistrationException("ConsumerGroup named '" +
name
- + "' does not contain a Consumer named '" +
consumer.getName() + "' (identity: '" + consumer.getIdentity()
+ + "' does not contain a Consumer named '" +
consumer.getName() + "' (identity: '" + consumer.getId()
+ "')");
}
@@ -150,6 +150,6 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
- return consumers.containsKey(consumer.getIdentity());
+ return consumers.containsKey(consumer.getId());
}
}
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/ConsumerImpl.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -103,7 +103,7 @@
return name;
}
- public String getIdentity()
+ public String getId()
{
return identity;
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -101,7 +101,7 @@
throws RegistrationException
{
// 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);
+ String identity = policy.getConsumerIdFrom(consumerName, registrationProperties);
// validate the registration information
policy.validateRegistrationDataFor(registrationProperties, identity);
@@ -126,7 +126,7 @@
// check with policy if we allow the consumer
policy.validateConsumerName(name);
- String identity = policy.getConsumerIdentityFrom(name, Collections.EMPTY_MAP);
+ String identity = policy.getConsumerIdFrom(name, Collections.EMPTY_MAP);
Consumer consumer = persistenceManager.createConsumer(identity, name);
@@ -170,7 +170,7 @@
}
}
- String identity = policy.getConsumerIdentityFrom(consumerName,
Collections.EMPTY_MAP);
+ String identity = policy.getConsumerIdFrom(consumerName, Collections.EMPTY_MAP);
try
{
getOrCreateConsumer(identity, createConsumerIfNeeded, consumerName);
@@ -218,13 +218,13 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(consumer,
"Consumer");
- removeConsumer(consumer.getIdentity());
+ removeConsumer(consumer.getId());
}
public Consumer getConsumerByIdentity(String identity) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity,
"identity", null);
- return persistenceManager.getConsumerByIdentity(identity);
+ return persistenceManager.getConsumerById(identity);
}
public Consumer getConsumerFor(String registrationHandle) throws
RegistrationException
Modified:
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-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationPersistenceManagerImpl.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -51,14 +51,14 @@
private Map groups = new HashMap();
private Map registrations = new HashMap();
- public Consumer createConsumer(String identity, String name) throws
RegistrationException
+ public Consumer createConsumer(String consumerId, String consumerName) throws
RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "Consumer
identity", null);
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Consumer
name", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
- ConsumerImpl consumer = new ConsumerImpl(identity, name);
+ ConsumerImpl consumer = new ConsumerImpl(consumerId, consumerName);
consumer.setStatus(RegistrationStatus.PENDING);
- consumers.put(identity, consumer);
+ consumers.put(consumerId, consumer);
return consumer;
}
@@ -94,46 +94,46 @@
}
}
- public void removeConsumer(String identity) throws RegistrationException
+ public void removeConsumer(String consumerId) throws RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "Consumer
identity", null);
- if (consumers.remove(identity) == null)
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
+ if (consumers.remove(consumerId) == null)
{
- throw new RegistrationException("There is no Consumer with identity
'" + identity + "'.");
+ throw new RegistrationException("There is no Consumer with identity
'" + consumerId + "'.");
}
}
- public void removeRegistration(String id) throws RegistrationException
+ public void removeRegistration(String registrationId) throws RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Registration
identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration identity", null);
- RegistrationImpl registration = (RegistrationImpl)registrations.get(id);
+ RegistrationImpl registration =
(RegistrationImpl)registrations.get(registrationId);
if (registration == null)
{
- throw new NoSuchRegistrationException("There is no Registration with id
'" + id + "'");
+ throw new NoSuchRegistrationException("There is no Registration with id
'" + registrationId + "'");
}
ConsumerImpl consumer = (ConsumerImpl)registration.getConsumer();
consumer.removeRegistration(registration);
- registrations.remove(id);
+ registrations.remove(registrationId);
}
- public Consumer getConsumerByIdentity(String identity) throws RegistrationException
+ public Consumer getConsumerById(String consumerId) throws RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, "Consumer
identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
- return (Consumer)consumers.get(identity);
+ return (Consumer)consumers.get(consumerId);
}
- public Registration addRegistrationFor(String consumerIdentity, Map
registrationProperties) throws RegistrationException
+ public Registration addRegistrationFor(String consumerId, Map registrationProperties)
throws RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties,
"Registration properties");
- ConsumerImpl consumer = (ConsumerImpl)getConsumerByIdentity(consumerIdentity);
+ ConsumerImpl consumer = (ConsumerImpl)getConsumerById(consumerId);
if (consumer == null)
{
- throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerIdentity
+ throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerId
+ "' to add a Registration to...");
}
@@ -146,9 +146,9 @@
return registration;
}
- public Consumer addConsumerToGroupNamed(String consumerIdentity, String groupName)
throws RegistrationException
+ public Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws
RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerIdentity,
"Consumer identity", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId,
"Consumer identity", null);
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(groupName,
"ConsumerGroup name", null);
ConsumerGroupImpl group = (ConsumerGroupImpl)getConsumerGroup(groupName);
@@ -158,10 +158,10 @@
+ "' to add a Consumer to...");
}
- ConsumerImpl consumer = (ConsumerImpl)getConsumerByIdentity(consumerIdentity);
+ ConsumerImpl consumer = (ConsumerImpl)getConsumerById(consumerId);
if (consumer == null)
{
- throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerIdentity
+ throw new NoSuchRegistrationException("There is no Consumer with identity
'" + consumerId
+ "' to add to ConsumerGroup named '" + groupName +
"'. Did you create it?");
}
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java 2006-12-10
21:28:02 UTC (rev 5786)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/policies/DefaultRegistrationPolicy.java 2006-12-11
00:58:34 UTC (rev 5787)
@@ -106,7 +106,7 @@
}
/** Simply returns the given consumer name, trusted (!) to be unique. */
- public String getConsumerIdentityFrom(String consumerName, Map registrationProperties)
throws IllegalArgumentException, InvalidConsumerDataException
+ public String getConsumerIdFrom(String consumerName, Map registrationProperties)
throws IllegalArgumentException, InvalidConsumerDataException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
return consumerName;
@@ -117,7 +117,7 @@
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
- Consumer consumer =
manager.getConsumerByIdentity(getConsumerIdentityFrom(consumerName,
Collections.EMPTY_MAP));
+ Consumer consumer = manager.getConsumerByIdentity(getConsumerIdFrom(consumerName,
Collections.EMPTY_MAP));
if (consumer != null)
{
throw new DuplicateRegistrationException("A Consumer named '" +
consumerName + "' has already been registered.");