Issue #2170: Add registration of Router to Notification Framework
Change-Id: Ib2bc29d82395a021cee3a8f98b894010303f06ad Former-commit-id: 6ea46281b904c99c9b6c9f364293bec96be16f7d
This commit is contained in:
parent
607b5edb69
commit
ded9c782fc
1 changed files with 47 additions and 12 deletions
|
@ -181,20 +181,55 @@ public class PluginNotifier {
|
||||||
*/
|
*/
|
||||||
public synchronized void register(PluginNotifierConfig config,
|
public synchronized void register(PluginNotifierConfig config,
|
||||||
boolean rebuildTree) throws InvalidNotificationConfigException {
|
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);
|
validate(config);
|
||||||
|
|
||||||
INotificationRouter router = null;
|
if (router == null) {
|
||||||
switch (config.getFormat()) {
|
switch (config.getFormat()) {
|
||||||
case DATAURI:
|
case DATAURI:
|
||||||
router = new DataUriRouter(config);
|
router = new DataUriRouter(config);
|
||||||
break;
|
break;
|
||||||
case PDO:
|
case PDO:
|
||||||
router = new PdoRouter(config);
|
router = new PdoRouter(config);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidNotificationConfigException(
|
throw new InvalidNotificationConfigException(
|
||||||
"No INotificationRouter registered for format: "
|
"No INotificationRouter registered for format: "
|
||||||
+ config.getFormat());
|
+ config.getFormat());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, RequestConstraint>[] metadataMaps = config.getMetadataMap();
|
Map<String, RequestConstraint>[] metadataMaps = config.getMetadataMap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue