uklance / tapestry-cometd

A push library for Tapestry5 based on CometD
17 stars 3 forks source link

Reusable Authorizers and SubscriptionListeners #49

Closed uklance closed 12 years ago

uklance commented 12 years ago

Currently, Authorizer and SubscriptionListener both have a getTopic() method. This method should be extracted into AuthorizerContribution and SubscriptionListenerContribution classes. This would allow us to re-use Authorizers and SubscriptionListeners on multiple topics. It also opens up the possibility of providing a few out-of-the-box implementations. One such implementation might be an AuthorizerChain (since contributions are not ordered).

When fixing this issue, swap from OrderedConfiguration/List to UnorderedConfiguration/Collection as this is currently incorrect (since TopicMatchers does not maintain ordering).

public interface AuthorizerContribution {
   Authorizer getAuthorizer();
   String getTopic();
}
public interface SubscriptionListenerContribution {
   SubscriptionListener getSubscriptionListener();
   String getTopic();
}