Issue #2170: Add registration of Router to Notification Framework
Change-Id: Ib2bc29d82395a021cee3a8f98b894010303f06ad Former-commit-id:db0e9d40ec
[formerly312fcc2b2f
] [formerlydb0e9d40ec
[formerly312fcc2b2f
] [formerlyded9c782fc
[formerly 6ea46281b904c99c9b6c9f364293bec96be16f7d]]] Former-commit-id:ded9c782fc
Former-commit-id:3b4507cbe5
[formerlyb4fc76c03a
] Former-commit-id:3543625506
This commit is contained in:
parent
463ad8e8fa
commit
d357b534c4
1 changed files with 47 additions and 12 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue