org.jboss.portal.registration
Interface RegistrationPolicy

All Known Implementing Classes:
DefaultRegistrationPolicy

public interface RegistrationPolicy

An interface allowing users of the Registration service to customize different aspects of how Consumers are handled. Methods of this interface are used by RegistrationManager to make appropriate decisions. Implementations of this interface MUST provide a no-argument constructor for instantiation from the class name.

Since:
2.6
Version:
$Revision: 9177 $
Author:
Chris Laprun

Method Summary
 java.lang.String createRegistrationHandleFor(java.lang.String registrationId)
          Generates a registration handle based on the database identity of the Registration.
 java.lang.String getAutomaticGroupNameFor(java.lang.String consumerName)
          Determines the ConsumerGroup name to which the Consumer associated with the specified name should be assigned with or null if the Consumer should not be automatically assigned to a ConsumerGroup.
 java.lang.String getConsumerIdFrom(java.lang.String consumerName, java.util.Map registrationProperties)
          Obtains a consumer identity which uniquely identifies a Consumer in function of the consumer name and registration properties.
 RegistrationManager getManager()
          Retrieves the RegistrationManager with which this RegistrationPolicy is associated.
 void setExpectations(java.util.Map<javax.xml.namespace.QName,? extends PropertyDescription> registrationPropertyDescriptions)
          Define what the expectations are as far as acceptable registration properties go.
 void setManager(RegistrationManager manager)
          Associates this RegistrationPolicy with the specified RegistrationManager.
 void validateConsumerGroupName(java.lang.String groupName)
          Determines if the specified ConsumerGroup name is acceptable.
 void validateConsumerName(java.lang.String consumerName)
          Determines if the specified Consumer name is acceptable.
 void validateRegistrationDataFor(java.util.Map registrationProperties, java.lang.String consumerIdentity)
          Examines and determines whether the given registration properties are adequate for the Consumer associated with the given identity.
 

Method Detail

validateRegistrationDataFor

void validateRegistrationDataFor(java.util.Map registrationProperties,
                                 java.lang.String consumerIdentity)
                                 throws java.lang.IllegalArgumentException,
                                        RegistrationException
Examines and determines whether the given registration properties are adequate for the Consumer associated with the given identity. This method is called before a Registration is created and thus allows users to decide whether or not to reject a given registration if not satisfied with the given registration properties.

Parameters:
registrationProperties - a Map containing the registration properties in the form of property name (QName) - property value (Object) mappings
consumerIdentity - the Consumer identity (as returned by getConsumerIdFrom(String, java.util.Map)) for which the registration properties must be ascertained
Throws:
java.lang.IllegalArgumentException - if any of the registration properties is invalid for the specified Consumer
RegistrationException - if an exception occured in the registration service

createRegistrationHandleFor

java.lang.String createRegistrationHandleFor(java.lang.String registrationId)
                                             throws java.lang.IllegalArgumentException
Generates a registration handle based on the database identity of the Registration. This allows users to customize the registration handle format if they want to prevent exposure of database-related data.

Parameters:
registrationId - the database identity of the Registration for which a handle is required.
Returns:
a registration handle for the Registration associated with the specified identifier.
Throws:
java.lang.IllegalArgumentException - if the specified registration identity if null or empty

getAutomaticGroupNameFor

java.lang.String getAutomaticGroupNameFor(java.lang.String consumerName)
                                          throws java.lang.IllegalArgumentException
Determines the ConsumerGroup name to which the Consumer associated with the specified name should be assigned with or null if the Consumer should not be automatically assigned to a ConsumerGroup. This method is called during the Consumer creation process to see if the Consumer should be automatically added to a ConsumerGroup.

Parameters:
consumerName - the name of the Consumer being created
Returns:
the name of the ConsumerGroup the Consumer must be automatically added to or null if the Consumer will not be automatically to a ConsumerGroup at creation
Throws:
java.lang.IllegalArgumentException - if the specified Consumer name if null or empty

getConsumerIdFrom

java.lang.String getConsumerIdFrom(java.lang.String consumerName,
                                   java.util.Map registrationProperties)
                                   throws java.lang.IllegalArgumentException,
                                          InvalidConsumerDataException
Obtains a consumer identity which uniquely identifies a Consumer in function of the consumer name and registration properties. This is potentially necessary because Consumer names are not guaranteed to be unique (even though the specification states that they should).

Parameters:
consumerName - the consumer name
registrationProperties - a Map containing the registration properties in the form of property name (QName) - property value (Object) mappings. Producer implementations might use the registration properties to provide secure Consumer identity.
Returns:
the consumer identity
Throws:
InvalidConsumerDataException - if the Policy examines the specified registration properties to determine the Consumer identity and decides that they are not in a proper state
java.lang.IllegalArgumentException - if the specified Consumer name if null or empty

validateConsumerName

void validateConsumerName(java.lang.String consumerName)
                          throws java.lang.IllegalArgumentException,
                                 RegistrationException
Determines if the specified Consumer name is acceptable. This method is called before a Consumer is created and before a unique Consumer identity is created. This is in particular used if the Policy mandates that Consumer names must be unique.

Parameters:
consumerName - the name of the Consumer as passed during the registration process
Throws:
java.lang.IllegalArgumentException - if the specified Consumer name if null or empty
RegistrationException - if an exception occurred in the Registration service

validateConsumerGroupName

void validateConsumerGroupName(java.lang.String groupName)
                               throws java.lang.IllegalArgumentException,
                                      RegistrationException
Determines if the specified ConsumerGroup name is acceptable. This method is called before a ConsumerGroup is created.

Parameters:
groupName - the name of the ConsumerGroup to be created
Throws:
java.lang.IllegalArgumentException - if the specified ConsumerGroup name if null or empty
RegistrationException - if an exception occurred in the Registration service

getManager

RegistrationManager getManager()
Retrieves the RegistrationManager with which this RegistrationPolicy is associated.

Returns:
the RegistrationManager with which this RegistrationPolicy is associated.

setManager

void setManager(RegistrationManager manager)
Associates this RegistrationPolicy with the specified RegistrationManager. This method should not be called directly by client code as it used in the wiring process of the Registration service.

Parameters:
manager - the RegistrationManager with which this RegistrationPolicy should be associated.

setExpectations

void setExpectations(java.util.Map<javax.xml.namespace.QName,? extends PropertyDescription> registrationPropertyDescriptions)
Define what the expectations are as far as acceptable registration properties go.

Parameters:
registrationPropertyDescriptions - a map of containing the description of expected registrations
Since:
2.6.3