Refactor odl-mdsal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / resources / OSGI-INF / blueprint / clustered-datastore.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
3            xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
4            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0">
5
6   <cm:property-placeholder persistent-id="org.opendaylight.controller.cluster.datastore.broker" update-strategy="none">
7     <cm:default-properties>
8       <cm:property name="max-data-broker-future-callback-queue-size" value="1000"/>
9       <cm:property name="max-data-broker-future-callback-pool-size" value="20"/>
10     </cm:default-properties>
11   </cm:property-placeholder>
12
13   <odl:static-reference id="schemaService" interface="org.opendaylight.mdsal.dom.api.DOMSchemaService" />
14
15   <reference id="classLoadingStrategy" interface="org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy" />
16
17   <!-- ActorSystemProvider -->
18
19   <bean id="bundleClassLoader" class="org.opendaylight.controller.cluster.akka.osgi.impl.BundleClassLoaderFactory"
20           factory-method="createClassLoader">
21     <argument ref="blueprintBundleContext" />
22   </bean>
23
24   <bean id="actorSystemProps" class="org.opendaylight.controller.cluster.akka.osgi.impl.QuarantinedMonitorActorPropsFactory"
25           factory-method="createProps">
26     <argument ref="blueprintBundleContext" />
27   </bean>
28
29   <bean id="akkaReader" class="org.opendaylight.controller.cluster.common.actor.FileAkkaConfigurationReader"/>
30   <bean id="akkaConfig" class="org.opendaylight.controller.cluster.akka.impl.AkkaConfigFactory"
31           factory-method="createAkkaConfig">
32     <argument ref="akkaReader" />
33   </bean>
34
35   <bean id="actorSystemProvider" class="org.opendaylight.controller.cluster.akka.impl.ActorSystemProviderImpl"
36           destroy-method="close">
37     <argument ref="bundleClassLoader" />
38     <argument ref="actorSystemProps"/>
39     <argument ref="akkaConfig"/>
40   </bean>
41
42   <service ref="actorSystemProvider" interface="org.opendaylight.controller.cluster.ActorSystemProvider"/>
43
44   <!-- Datastore properties -->
45   <cm:cm-properties id="datastoreProps" persistent-id="org.opendaylight.controller.cluster.datastore"/>
46
47   <!-- Distributed Config Datastore -->
48   <bean id="datastoreSnapshotRestore" class="org.opendaylight.controller.cluster.datastore.DatastoreSnapshotRestore"
49           factory-method="instance">
50     <argument value="./clustered-datastore-restore"/>
51   </bean>
52
53   <bean id="introspectorFactory" class="org.opendaylight.controller.cluster.datastore.DatastoreContextIntrospectorFactory">
54     <argument ref="schemaService"/>
55     <argument ref="classLoadingStrategy"/>
56   </bean>
57
58   <bean id="introspectorConfig" factory-ref="introspectorFactory" factory-method="newInstance">
59     <argument type="org.opendaylight.mdsal.common.api.LogicalDatastoreType" value="CONFIGURATION"/>
60   </bean>
61
62   <bean id="updaterConfig" class="org.opendaylight.controller.cluster.datastore.DatastoreContextPropertiesUpdater">
63     <cm:managed-properties persistent-id="org.opendaylight.controller.cluster.datastore" update-strategy="component-managed" update-method="update"/>
64     <argument ref="introspectorConfig"/>
65     <argument ref="datastoreProps"/>
66   </bean>
67
68   <bean id="configDatastore" class="org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory"
69           factory-method="createInstance" destroy-method="close">
70     <argument ref="schemaService"/>
71     <argument>
72       <bean factory-ref="introspectorConfig" factory-method="getContext" />
73     </argument>
74     <argument ref="datastoreSnapshotRestore"/>
75     <argument ref="actorSystemProvider"/>
76     <argument ref="introspectorConfig"/>
77     <argument ref="updaterConfig"/>
78   </bean>
79
80   <service ref="configDatastore" odl:type="distributed-config">
81     <interfaces>
82       <value>org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface</value>
83     </interfaces>
84   </service>
85
86   <!-- Distributed Operational Datastore -->
87   <bean id="fileModuleShardConfigProvider" class="org.opendaylight.controller.cluster.datastore.config.FileModuleShardConfigProvider">
88     <argument value="./configuration/initial/module-shards.conf"/>
89     <argument value="./configuration/initial/modules.conf"/>
90   </bean>
91
92   <bean id="configurationImpl" class="org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl">
93     <argument ref="fileModuleShardConfigProvider"/>
94   </bean>
95
96   <bean id="introspectorOper" factory-ref="introspectorFactory" factory-method="newInstance">
97     <argument type="org.opendaylight.mdsal.common.api.LogicalDatastoreType" value="OPERATIONAL"/>
98   </bean>
99
100   <bean id="updaterOper" class="org.opendaylight.controller.cluster.datastore.DatastoreContextPropertiesUpdater">
101     <cm:managed-properties persistent-id="org.opendaylight.controller.cluster.datastore" update-strategy="component-managed" update-method="update"/>
102     <argument ref="introspectorOper"/>
103     <argument ref="datastoreProps"/>
104   </bean>
105
106   <bean id="operDatastore" class="org.opendaylight.controller.cluster.datastore.DistributedDataStoreFactory"
107           factory-method="createInstance" destroy-method="close">
108     <argument ref="schemaService"/>
109     <argument>
110       <bean factory-ref="introspectorOper" factory-method="getContext" />
111     </argument>
112     <argument ref="datastoreSnapshotRestore"/>
113     <argument ref="actorSystemProvider"/>
114     <argument ref="introspectorOper"/>
115     <argument ref="updaterOper"/>
116     <argument ref="configurationImpl" />
117   </bean>
118
119   <service ref="operDatastore" odl:type="distributed-operational">
120     <interfaces>
121       <value>org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface</value>
122     </interfaces>
123   </service>
124
125   <!-- Concurrent DOMDataBroker -->
126
127   <bean id="listenableFutureExecutor" class="org.opendaylight.yangtools.util.concurrent.SpecialExecutors"
128           factory-method="newBlockingBoundedCachedThreadPool">
129     <argument value="${max-data-broker-future-callback-pool-size}"/>
130     <argument value="${max-data-broker-future-callback-queue-size}"/>
131     <argument value="CommitFutures"/>
132     <argument>
133     <!-- We should use a more specific class -->
134       <bean factory-ref="operDatastore" factory-method="getClass"/>
135     </argument>
136   </bean>
137
138   <bean id="commitStatsTracker" class="org.opendaylight.yangtools.util.DurationStatisticsTracker"
139           factory-method="createConcurrent"/>
140
141   <bean id="clusteredDOMDataBroker" class="org.opendaylight.controller.cluster.databroker.ConcurrentDOMDataBroker"
142           destroy-method="close">
143     <argument>
144       <map>
145         <entry key="CONFIGURATION" value-ref="configDatastore"/>
146         <entry key="OPERATIONAL" value-ref="operDatastore"/>
147       </map>
148     </argument>
149     <argument ref="listenableFutureExecutor"/>
150     <argument ref="commitStatsTracker"/>
151   </bean>
152
153   <service ref="clusteredDOMDataBroker" interface="org.opendaylight.mdsal.dom.api.DOMDataBroker"
154           odl:type="default"/>
155
156   <bean id="legacyDOMDataBroker" class="org.opendaylight.controller.sal.core.compat.LegacyDOMDataBrokerAdapter">
157     <argument ref="clusteredDOMDataBroker"/>
158   </bean>
159
160   <service ref="legacyDOMDataBroker" interface="org.opendaylight.controller.md.sal.dom.api.DOMDataBroker"
161           odl:type="default"/>
162
163   <!-- JMX beans for the data broker -->
164
165   <bean id="commitStatsMXBean" class="org.opendaylight.controller.cluster.datastore.jmx.mbeans.CommitStatsMXBeanImpl"
166           init-method="register" destroy-method="unregister">
167     <argument ref="commitStatsTracker"/>
168     <argument value="DOMDataBroker"/>
169   </bean>
170
171   <bean id="threadStatsMXBean" class="org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl"
172           factory-method="create" destroy-method="unregister">
173     <argument ref="listenableFutureExecutor"/>
174     <argument value="CommitFutureExecutorStats"/>
175     <argument value="DOMDataBroker"/>
176   </bean>
177
178   <!-- Distributed EntityOwnershipService -->
179   <cm:cm-properties id="strategiesProps" persistent-id="org.opendaylight.controller.cluster.entity.owner.selection.strategies" />
180
181   <bean id="selectionStrategyConfig" class="org.opendaylight.controller.cluster.datastore.entityownership.selectionstrategy.EntityOwnerSelectionStrategyConfigReader"
182           factory-method="loadStrategyWithConfig">
183     <argument ref="strategiesProps"/>
184   </bean>
185
186   <bean id="distributedEntityOwnershipService" class="org.opendaylight.controller.cluster.datastore.entityownership.DistributedEntityOwnershipService"
187           factory-method="start" destroy-method="close">
188     <argument>
189       <bean factory-ref="operDatastore" factory-method="getActorUtils"/>
190     </argument>
191     <argument ref="selectionStrategyConfig"/>
192   </bean>
193
194   <service ref="distributedEntityOwnershipService" interface="org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService"
195         odl:type="default"/>
196
197   <!-- CDS shard manager -->
198   <bean id="cdsNodeManager" class="org.opendaylight.controller.cluster.sharding.DistributedShardedDOMDataTree"
199           init-method="init">
200     <argument ref="actorSystemProvider"/>
201     <argument ref="operDatastore"/>
202     <argument ref="configDatastore"/>
203   </bean>
204
205   <service ref="cdsNodeManager" odl:type="default">
206     <interfaces>
207       <value>org.opendaylight.mdsal.dom.api.DOMDataTreeShardingService</value>
208       <value>org.opendaylight.mdsal.dom.api.DOMDataTreeService</value>
209       <value>org.opendaylight.controller.cluster.sharding.DistributedShardFactory</value>
210     </interfaces>
211   </service>
212
213 </blueprint>