Issue #2170: Add registration of Router to Notification Framework

Change-Id: Ib2bc29d82395a021cee3a8f98b894010303f06ad

Former-commit-id: 6b2c2ac57c [formerly db0e9d40ec] [formerly 312fcc2b2f] [formerly ded9c782fc [formerly 312fcc2b2f [formerly 6ea46281b904c99c9b6c9f364293bec96be16f7d]]]
Former-commit-id: ded9c782fc
Former-commit-id: 8c2b99ce5979cc67fe016129fe2f3a8f2ec3736d [formerly b4fc76c03a]
Former-commit-id: 3b4507cbe5
This commit is contained in:
Richard Peter 2013-12-12 13:47:37 -06:00
parent 6a35407957
commit c137c98511

View file

@ -181,20 +181,55 @@ public class PluginNotifier {
*/
public synchronized void register(PluginNotifierConfig config,
boolean rebuildTree) throws InvalidNotificationConfigException {
register(config, null, rebuildTree);
}
/**
* Register the given PluginNotifierConfig.
*
* @param config
* @param router
* The INotificationRouter to use for this config. If null, will
* use the default based on the config format.
* @return
*/
public synchronized void register(PluginNotifierConfig config,
INotificationRouter router)
throws InvalidNotificationConfigException {
register(config, router, true);
}
/**
* Register the given PluginNotifierConfig.
*
* @param config
* @param router
* The INotificationRouter to use for this config. If null, will
* use the default based on the config format.
* @param rebuildTree
* Whether or not to rebuild the internal tree. If many things
* are being registered can improve performance to only build
* tree once at the end.
* @return
*/
public synchronized void register(PluginNotifierConfig config,
INotificationRouter router, boolean rebuildTree)
throws InvalidNotificationConfigException {
validate(config);
INotificationRouter router = null;
switch (config.getFormat()) {
case DATAURI:
router = new DataUriRouter(config);
break;
case PDO:
router = new PdoRouter(config);
break;
default:
throw new InvalidNotificationConfigException(
"No INotificationRouter registered for format: "
+ config.getFormat());
if (router == null) {
switch (config.getFormat()) {
case DATAURI:
router = new DataUriRouter(config);
break;
case PDO:
router = new PdoRouter(config);
break;
default:
throw new InvalidNotificationConfigException(
"No INotificationRouter registered for format: "
+ config.getFormat());
}
}
Map<String, RequestConstraint>[] metadataMaps = config.getMetadataMap();