[gatein-commits] gatein SVN: r7734 - components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 12 10:52:32 EDT 2011
Author: chris.laprun at jboss.com
Date: 2011-10-12 10:52:32 -0400 (Wed, 12 Oct 2011)
New Revision: 7734
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/AbstractRegistrationPersistenceManager.java
components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java
Log:
- Moved implementation of internalCreate methods to AbstractRegistrationPersistenceManager.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/AbstractRegistrationPersistenceManager.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/AbstractRegistrationPersistenceManager.java 2011-10-12 12:34:21 UTC (rev 7733)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/AbstractRegistrationPersistenceManager.java 2011-10-12 14:52:32 UTC (rev 7734)
@@ -31,6 +31,7 @@
import org.gatein.registration.Registration;
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationPersistenceManager;
+import org.gatein.registration.RegistrationStatus;
import org.gatein.registration.spi.ConsumerGroupSPI;
import org.gatein.registration.spi.ConsumerSPI;
import org.gatein.registration.spi.RegistrationSPI;
@@ -44,6 +45,8 @@
*/
public abstract class AbstractRegistrationPersistenceManager implements RegistrationPersistenceManager
{
+ private long lastRegistrationId;
+
public Consumer createConsumer(String consumerId, String consumerName) throws RegistrationException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId, "Consumer identity", null);
@@ -180,13 +183,23 @@
protected abstract RegistrationSPI internalRemoveRegistration(String registrationId) throws RegistrationException;
- protected abstract RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException;
+ protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException
+ {
+ RegistrationSPI registrationSPI = newRegistrationSPI(consumer, registrationProperties);
+ registrationSPI.setPersistentKey("" + lastRegistrationId++);
+ return registrationSPI;
+ }
protected abstract void internalAddConsumer(ConsumerSPI consumer) throws RegistrationException;
protected abstract ConsumerSPI internalRemoveConsumer(String consumerId) throws RegistrationException;
- protected abstract ConsumerSPI internalCreateConsumer(String consumerId, String consumerName) throws RegistrationException;
+ protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName) throws RegistrationException
+ {
+ ConsumerSPI consumerSPI = newConsumerSPI(consumerId, consumerName);
+ consumerSPI.setPersistentKey(consumerId);
+ return consumerSPI;
+ }
protected abstract ConsumerSPI internalSaveChangesTo(Consumer consumer) throws RegistrationException;
@@ -196,7 +209,27 @@
protected abstract ConsumerGroupSPI internalRemoveConsumerGroup(String name) throws RegistrationException;
- protected abstract ConsumerGroupSPI internalCreateConsumerGroup(String name) throws RegistrationException;
+ protected ConsumerGroupSPI internalCreateConsumerGroup(String name) throws RegistrationException
+ {
+ ConsumerGroupSPI groupSPI = newConsumerGroupSPI(name);
+ groupSPI.setPersistentKey(name);
+ return groupSPI;
+ }
protected abstract ConsumerSPI getConsumerSPIById(String consumerId) throws RegistrationException;
+
+ public RegistrationSPI newRegistrationSPI(ConsumerSPI consumer, Map<QName, Object> registrationProperties)
+ {
+ return new RegistrationImpl(consumer, RegistrationStatus.PENDING, registrationProperties, this);
+ }
+
+ public ConsumerSPI newConsumerSPI(String consumerId, String consumerName)
+ {
+ return new ConsumerImpl(consumerId, consumerName);
+ }
+
+ public ConsumerGroupSPI newConsumerGroupSPI(String name)
+ {
+ return new ConsumerGroupImpl(name);
+ }
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java 2011-10-12 12:34:21 UTC (rev 7733)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/registration/impl/RegistrationPersistenceManagerImpl.java 2011-10-12 14:52:32 UTC (rev 7734)
@@ -28,12 +28,10 @@
import org.gatein.registration.ConsumerGroup;
import org.gatein.registration.Registration;
import org.gatein.registration.RegistrationException;
-import org.gatein.registration.RegistrationStatus;
import org.gatein.registration.spi.ConsumerGroupSPI;
import org.gatein.registration.spi.ConsumerSPI;
import org.gatein.registration.spi.RegistrationSPI;
-import javax.xml.namespace.QName;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -46,7 +44,6 @@
*/
public class RegistrationPersistenceManagerImpl extends AbstractRegistrationPersistenceManager
{
- private long lastRegistrationId;
private Map<String, ConsumerSPI> consumers = new HashMap<String, ConsumerSPI>();
private Map<String, ConsumerGroupSPI> groups = new HashMap<String, ConsumerGroupSPI>();
private Map<String, RegistrationSPI> registrations = new HashMap<String, RegistrationSPI>();
@@ -100,19 +97,6 @@
}
@Override
- protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException
- {
- RegistrationSPI registrationSPI = newRegistrationSPI(consumer, registrationProperties);
- registrationSPI.setPersistentKey("" + lastRegistrationId++);
- return registrationSPI;
- }
-
- public RegistrationSPI newRegistrationSPI(ConsumerSPI consumer, Map<QName, Object> registrationProperties)
- {
- return new RegistrationImpl(consumer, RegistrationStatus.PENDING, registrationProperties, this);
- }
-
- @Override
protected void internalAddConsumer(ConsumerSPI consumer) throws RegistrationException
{
consumers.put(consumer.getId(), consumer);
@@ -125,19 +109,6 @@
}
@Override
- protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName) throws RegistrationException
- {
- ConsumerSPI consumerSPI = newConsumerSPI(consumerId, consumerName);
- consumerSPI.setPersistentKey(consumerId);
- return consumerSPI;
- }
-
- public ConsumerSPI newConsumerSPI(String consumerId, String consumerName)
- {
- return new ConsumerImpl(consumerId, consumerName);
- }
-
- @Override
protected void internalAddConsumerGroup(ConsumerGroupSPI group) throws RegistrationException
{
groups.put(group.getName(), group);
@@ -150,19 +121,6 @@
}
@Override
- protected ConsumerGroupSPI internalCreateConsumerGroup(String name) throws RegistrationException
- {
- ConsumerGroupSPI groupSPI = newConsumerGroupSPI(name);
- groupSPI.setPersistentKey(name);
- return groupSPI;
- }
-
- public ConsumerGroupSPI newConsumerGroupSPI(String name)
- {
- return new ConsumerGroupImpl(name);
- }
-
- @Override
protected ConsumerSPI getConsumerSPIById(String consumerId) throws RegistrationException
{
return (ConsumerSPI)getConsumerById(consumerId);
More information about the gatein-commits
mailing list