Add config system API to recreate a module instance 78/38278/3
authorTom Pantelis <tpanteli@brocade.com>
Fri, 15 Apr 2016 19:19:50 +0000 (15:19 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 6 Jun 2016 01:54:49 +0000 (21:54 -0400)
commit6d35a41bd686db2a16769bf41dbc027cc833c1b6
tree706f6fe6bf7a97f1ab666ec65ffaac9091298a84
parentf6f461bc86012d3e44861eb4a97ce2eba8b4c05d
Add config system API to recreate a module instance

For the blueprint work, I need to be able to restart/recreate a
config module, ie close the previous instance and create a new instance,
when the corresponding service instance is recreated/re-advertised via
blueprint container restart.

The ConfigSubsystemFacade has no API to restart a config module. One
can push a new configuration but there has to be an actual change in
order for a new instance to be created otherwise it reuses the prior
instance.

Therefore I added a new EditStrategyType enum, recreate, with a
corresponding EditConfigStrategy class that forces re-creation of a
config module instance. This strategy calls a new
method, reCreateModule, on the ConfigTransactionController interface.

The decision logic to reuse or create a new instance is in the
AbstractModule class and generated derived classes. Therefore the
reCreateModule method sets a canReuseInstance flag on the real
AbstractModule instance. This is probably not the cleanest approach but
I wanted to avoid changing the Module interface as that looked to be too
invasive. The AbstractModule getInstance and canReuse methods check the
canReuseInstance override flag to determine if the old module/instance
can be reused.

Change-Id: I8cfb8408bae0127331676dcf32519b176f0a8844
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/api/ConfigTransactionController.java
opendaylight/config/config-api/src/main/java/org/opendaylight/controller/config/spi/AbstractModule.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/EditStrategyType.java
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/strategy/ReCreateEditConfigStrategy.java [new file with mode: 0644]
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ConfigTransactionControllerImpl.java
opendaylight/config/config-util/src/main/java/org/opendaylight/controller/config/util/ConfigTransactionJMXClient.java
opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/TestingConfigTransactionController.java