Merge "Make neutron a simple osgi app"
authorMoiz Raja <moraja@cisco.com>
Thu, 4 Dec 2014 23:14:21 +0000 (23:14 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 4 Dec 2014 23:14:21 +0000 (23:14 +0000)
95 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/controller/config/yang/protocol/framework/NeverReconnectStrategyModuleTest.java
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/controller/config/yang/protocol/framework/ReconnectImmediatelyStrategyModuleTest.java
opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/controller/config/yang/protocol/framework/TimedReconnectStrategyModuleTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/test/DependentWiringTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/scheduledthreadpool/test/TwoInterfacesExportTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/test/SimpleConfigurationTest.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImpl.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModule.java
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackStatusListener.java
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImplTest.java
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleTest.java
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleWithInitialConfigurationTest.java
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackWithXmlConfigModuleTest.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModuleFactory.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/ImmediateEventExecutorModuleFactory.java
opendaylight/config/netty-event-executor-config/src/test/java/org/opendaylight/controller/config/yang/netty/eventexecutor/GlobalEventExecutorModuleTest.java
opendaylight/config/netty-event-executor-config/src/test/java/org/opendaylight/controller/config/yang/netty/eventexecutor/ImmediateEventExecutorModuleTest.java
opendaylight/config/netty-threadgroup-config/src/main/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModule.java
opendaylight/config/netty-threadgroup-config/src/test/java/org/opendaylight/controller/config/yang/netty/threadgroup/NettyThreadgroupModuleTest.java
opendaylight/config/pom.xml
opendaylight/md-sal/benchmark-data-store/src/main/java/org/opendaylight/controller/md/sal/dom/store/benchmark/InMemoryBrokerWriteTransactionBenchmark.java
opendaylight/md-sal/forwardingrules-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java
opendaylight/md-sal/mdsal-artifacts/pom.xml [new file with mode: 0644]
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/DefaultRuntimeCodeGenerator.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/codegen/impl/DefaultRuntimeCodeGeneratorTest.java [moved from opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java with 97% similarity]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomInmemoryDataBrokerModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMForwardedTransactionFactory.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/ConcurrentDOMDataBroker.java [moved from opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMConcurrentDataCommitCoordinator.java with 96% similarity]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerTransactionChainImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitExecutor.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMForwardedWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/SerializedDOMDataBroker.java [moved from opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitCoordinatorImpl.java with 82% similarity]
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMConcurrentDataCommitCoordinatorTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatPermCollector.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatRpcMsgManager.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManager.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatAbstractNotifyCommit.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitFlow.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitGroup.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitMeter.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatListenCommitQueue.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatNotifyCommitPort.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatNotifyCommitTable.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatPermCollectorImpl.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatRpcMsgManagerImpl.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/impl/StatisticsManagerImpl.java
opendaylight/md-sal/statistics-manager/src/test/java/test/mock/util/DataBrokerTestCustomizer.java
opendaylight/md-sal/topology-lldp-discovery/pom.xml
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java
opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/Main.java
opendaylight/netconf/netconf-testtool/src/main/java/org/opendaylight/controller/netconf/test/tool/NetconfDeviceSimulator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/MissingNameSpaceException.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/UnexpectedElementException.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/UnexpectedNamespaceException.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessage.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessageAdditionalHeader.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageHeader.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/SendErrorExceptionUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/HardcodedNamespaceResolver.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XMLNetconfUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfValidator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/NetconfUtilTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/mapping/AbstractLastNetconfOperationTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperationTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/mapping/AbstractSingletonNetconfOperationTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessageAdditionalHeaderTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessageTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageHeaderTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtilTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/SendErrorExceptionUtilTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtilTest.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/xml/XmlElementTest.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/startExi.xml
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/stopExi.xml

index 1030be5699c6895bebf5815f22aee86c5b939e81..8596412de8f652e50eebb1ff15e84173b329bbf7 100644 (file)
     <usermanager.version>0.5.0-SNAPSHOT</usermanager.version>
     <nsf.version>0.5.0-SNAPSHOT</nsf.version>
     <web.version>0.5.0-SNAPSHOT</web.version>
-    <xtend.dstdir>src/main/xtend-gen</xtend.dstdir>
     <yang-ext.version>2013.09.07.7-SNAPSHOT</yang-ext.version>
     <yang-jmx-generator.version>1.1.0-SNAPSHOT</yang-jmx-generator.version>
     <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>${mdsal.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>netconf-artifacts</artifactId>
       </dependency>
 
       <!-- md-sal -->
-      <dependency>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>org.eclipse.xtend.lib</artifactId>
-        <version>${xtend.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.glassfish.jersey.test-framework.providers</groupId>
         <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
         <artifactId>sal</artifactId>
         <version>${sal.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-api</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-broker-impl</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-config</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-util</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-broker-impl</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-common</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-common-api</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-common-impl</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-common-util</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-inmemory-datastore</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-compatibility</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-connector-api</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-dom-xsql</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-karaf-xsql</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-dom-xsql-config</artifactId>
-        <version>${mdsal.version}</version>
-        <classifier>config</classifier>
-        <type>xml</type>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-core-api</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-core-spi</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-netconf-connector</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-remote</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-rest-connector</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-rest-connector-config</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>md-sal-config</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-rest-docgen</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-restconf-broker</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-test-model</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-distributed-datastore</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>sal-clustering-commons</artifactId>
-            <version>${mdsal.version}</version>
-        </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-clustering-config</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-remoterpc-connector</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-
 
       <!-- SAL Extension bundles -->
       <dependency>
         <artifactId>web</artifactId>
         <version>${web.version}</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.md</groupId>
-        <artifactId>forwardingrules-manager</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.md</groupId>
-        <artifactId>inventory-manager</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.md</groupId>
-        <artifactId>statistics-manager</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.md</groupId>
-        <artifactId>topology-lldp-discovery</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.md</groupId>
-        <artifactId>topology-manager</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-flow-base</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-flow-service</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-flow-statistics</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-inventory</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.model</groupId>
-        <artifactId>model-topology</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.samples</groupId>
-        <artifactId>sample-toaster</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.samples</groupId>
-        <artifactId>sample-toaster-consumer</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
 
-      <dependency>
-        <groupId>org.opendaylight.controller.samples</groupId>
-        <artifactId>sample-toaster-provider</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.samples</groupId>
-        <artifactId>toaster-config</artifactId>
-        <version>${mdsal.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.yangtools</groupId>
         <artifactId>features-test</artifactId>
         <type>xml</type>
         <scope>runtime</scope>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.samples</groupId>
-        <artifactId>features-toaster</artifactId>
-        <version>${mdsal.version}</version>
-        <classifier>features</classifier>
-        <type>xml</type>
-        <scope>runtime</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>features-flow</artifactId>
-        <version>${mdsal.version}</version>
-        <classifier>features</classifier>
-        <type>xml</type>
-        <scope>runtime</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>com.sun.jersey.jersey-servlet</artifactId>
         <version>0.1.0-SNAPSHOT</version>
         <scope>test</scope>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-broker-impl</artifactId>
-        <version>${mdsal.version}</version>
-        <type>test-jar</type>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>sal-binding-it</artifactId>
-        <version>${mdsal.version}</version>
-        <scope>test</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>features-protocol-framework</artifactId>
         <scope>runtime</scope>
       </dependency>
       <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>features-mdsal</artifactId>
-        <version>${mdsal.version}</version>
-        <classifier>features</classifier>
-        <type>xml</type>
-        <scope>runtime</scope>
-      </dependency>
-    <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>features-netconf-connector</artifactId>
         <version>${mdsal.version}</version>
         <classifier>features</classifier>
         <type>xml</type>
         <scope>runtime</scope>
-    </dependency>
+      </dependency>
+
       <!-- JMH Benchmark dependencies -->
       <dependency>
         <groupId>org.openjdk.jmh</groupId>
           <artifactId>maven-clean-plugin</artifactId>
           <configuration>
             <filesets>
-              <fileset>
-                <directory>${xtend.dstdir}</directory>
-                <includes>
-                  <include>**</include>
-                </includes>
-              </fileset>
               <fileset>
                 <directory>${jmxGeneratorPath}</directory>
                 <includes>
                   <source>src/main/yang</source>
                   <source>${jmxGeneratorPath}</source>
                   <source>${salGeneratorPath}</source>
-                  <source>${xtend.dstdir}</source>
                 </sources>
               </configuration>
             </execution>
             </lifecycleMappingMetadata>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.eclipse.xtend</groupId>
-          <artifactId>xtend-maven-plugin</artifactId>
-          <version>${xtend.version}</version>
-          <executions>
-            <execution>
-              <goals>
-                <goal>compile</goal>
-              </goals>
-              <configuration>
-                <outputDirectory>${xtend.dstdir}</outputDirectory>
-              </configuration>
-            </execution>
-          </executions>
-        </plugin>
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
           <sourceDirectory>${project.basedir}</sourceDirectory>
           <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
-          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/xtend-gen\/,**\/protobuff\/</excludes>
+          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/protobuff\/</excludes>
         </configuration>
         <dependencies>
           <dependency>
index 1148c6bebe5f381d825be0003c6904b3b3e12153..77589ed81dbaaa602199282661194cd63f2b143f 100644 (file)
@@ -76,7 +76,7 @@ public class NeverReconnectStrategyModuleTest extends AbstractConfigTest {
         createInstance();
         final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
         assertBeanCount(1, FACTORY_NAME);
-        final NeverReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
+        final NeverReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(
                 transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME), NeverReconnectStrategyFactoryModuleMXBean.class);
         mxBean.setTimeout(200);
         final CommitStatus status = transaction.commit();
@@ -98,7 +98,7 @@ public class NeverReconnectStrategyModuleTest extends AbstractConfigTest {
     private static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final Integer timeout)
             throws InstanceAlreadyExistsException {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-        final NeverReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+        final NeverReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
                 NeverReconnectStrategyFactoryModuleMXBean.class);
         mxBean.setTimeout(timeout);
         mxBean.setExecutor(GlobalEventExecutorUtil.create(transaction));
index cfdf3bff28729e5f80a4c9811316eb04e2b1bcc6..7e3ed5b2dea9d3b25c11e05fbad40a79872b20c1 100644 (file)
@@ -75,7 +75,7 @@ public class ReconnectImmediatelyStrategyModuleTest extends AbstractConfigTest {
         createInstance();
         final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
         assertBeanCount(1, FACTORY_NAME);
-        final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
+        final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(
                 transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
                 ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
         mxBean.setReconnectTimeout(200);
@@ -97,7 +97,7 @@ public class ReconnectImmediatelyStrategyModuleTest extends AbstractConfigTest {
     private static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final Integer timeout)
             throws InstanceAlreadyExistsException {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-        final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+        final ReconnectImmediatelyStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
                 ReconnectImmediatelyStrategyFactoryModuleMXBean.class);
         mxBean.setReconnectTimeout(timeout);
         mxBean.setReconnectExecutor(GlobalEventExecutorUtil.create(transaction));
index 1c068a98e748e76e0404fc5b71c87d97e839f75d..ec8a9d6f29c7e66fd148b4510ea28e0c38240071 100644 (file)
@@ -117,7 +117,7 @@ public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
         createInstance();
         final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
         assertBeanCount(1, FACTORY_NAME);
-        final TimedReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(
+        final TimedReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(
                 transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME), TimedReconnectStrategyFactoryModuleMXBean.class);
         assertEquals(mxBean.getMinSleep(), new Long(100));
         mxBean.setMinSleep(200L);
@@ -149,7 +149,7 @@ public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
             final Integer connectTime, final Long minSleep, final BigDecimal sleepFactor, final Long maxSleep,
             final Long maxAttempts, final Long deadline) throws InstanceAlreadyExistsException {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, instanceName);
-        final TimedReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated,
+        final TimedReconnectStrategyFactoryModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated,
                 TimedReconnectStrategyFactoryModuleMXBean.class);
         mxBean.setConnectTime(connectTime);
         mxBean.setDeadline(deadline);
index 598e6bffee1820b92864b9afec75832779720341..fd8c8d1df0c7b1b250b0454f91c36b12d0cd1f25 100644 (file)
@@ -108,7 +108,7 @@ public class DependentWiringTest extends AbstractParallelAPSPTest {
 
         // test reported apsp number of threads
         TestingParallelAPSPConfigMXBean parallelAPSPRuntimeProxy = configRegistryClient
-                .newMBeanProxy(apspON, TestingParallelAPSPConfigMXBean.class);
+                .newMXBeanProxy(apspON, TestingParallelAPSPConfigMXBean.class);
         assertEquals(
                 (Integer) TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS,
                 parallelAPSPRuntimeProxy.getMaxNumberOfThreads());
index fcefd06e4da41f73c50b97d0b1e08ccfc324a3cc..0e6a54fdc9b1b9cee4d74fda75fa8154db8a9866 100644 (file)
@@ -15,10 +15,11 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import javax.annotation.Nullable;
-import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
 import javax.management.ObjectName;
+import javax.management.ReflectionException;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
@@ -37,20 +38,17 @@ public class TwoInterfacesExportTest extends AbstractScheduledTest {
 
     private void assertExists(@Nullable final ConfigTransactionJMXClient transaction,
             final String moduleName, final String instanceName)
-            throws InstanceNotFoundException {
+            throws InstanceNotFoundException, IntrospectionException, ReflectionException {
         if (transaction != null) {
             transaction.lookupConfigBean(moduleName, instanceName);
             // make a dummy call
-            configRegistryClient.newMBeanProxy(
-                    ObjectNameUtil.createTransactionModuleON(
-                            transaction.getTransactionName(), moduleName,
-                            instanceName), DynamicMBean.class).getMBeanInfo();
+            platformMBeanServer.getMBeanInfo(ObjectNameUtil.createTransactionModuleON(
+                    transaction.getTransactionName(), moduleName, instanceName));
         } else {
             configRegistryClient.lookupConfigBean(moduleName, instanceName);
             // make a dummy call
-            configRegistryClient.newMBeanProxy(
-                    ObjectNameUtil.createReadOnlyModuleON(moduleName,
-                            instanceName), DynamicMBean.class).getMBeanInfo();
+            platformMBeanServer.getMBeanInfo(ObjectNameUtil.createReadOnlyModuleON(moduleName,
+                    instanceName));
         }
     }
 
@@ -173,7 +171,7 @@ public class TwoInterfacesExportTest extends AbstractScheduledTest {
 
         ObjectName apspName = transaction.createModule(
                 TestingParallelAPSPModuleFactory.NAME, "apsp1");
-        TestingParallelAPSPConfigMXBean apspProxy = transaction.newMBeanProxy(
+        TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(
                 apspName, TestingParallelAPSPConfigMXBean.class);
         apspProxy.setThreadPool(scheduledName);
         apspProxy.setSomeParam("someParam");
@@ -190,7 +188,7 @@ public class TwoInterfacesExportTest extends AbstractScheduledTest {
 
         ObjectName apspName = transaction.createModule(
                 TestingParallelAPSPModuleFactory.NAME, "apsp1");
-        TestingParallelAPSPConfigMXBean apspProxy = transaction.newMBeanProxy(
+        TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(
                 apspName, TestingParallelAPSPConfigMXBean.class);
         apspProxy.setThreadPool(ObjectNameUtil.createReadOnlyModuleON(
                 TestingScheduledThreadPoolModuleFactory.NAME, scheduled1));
index 4ed10036f78e0262442a9986ef14aabbb85db42d..c20d3bfc04090bafbc1b4406c03453c7c353f225 100644 (file)
@@ -212,11 +212,9 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         ObjectName fixed1name = firstCommit();
 
         // 2, check that configuration was copied to platform
-        DynamicMBean dynamicMBean = configRegistryClient.newMBeanProxy(
-                ObjectNameUtil.withoutTransactionName(fixed1name),
-                DynamicMBean.class);
-        dynamicMBean.getMBeanInfo();
-        assertEquals(numberOfThreads, dynamicMBean.getAttribute("ThreadCount"));
+        ObjectName on = ObjectNameUtil.withoutTransactionName(fixed1name);
+        platformMBeanServer.getMBeanInfo(on);
+        assertEquals(numberOfThreads, platformMBeanServer.getAttribute(on, "ThreadCount"));
 
         // 3, shutdown fixed1 in new transaction
         assertFalse(TestingFixedThreadPool.allExecutors.get(0).isShutdown());
@@ -249,10 +247,10 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
 
         // dynamic config should be removed from platform
         try {
-            dynamicMBean.getMBeanInfo();
+            platformMBeanServer.getMBeanInfo(on);
             fail();
         } catch (Exception e) {
-            assertTrue(e.getCause() instanceof InstanceNotFoundException);
+            assertTrue(e instanceof InstanceNotFoundException);
         }
     }
 
index 087648cae7e2b6e80980caee648b124bcaae1179..9abf6450c3c2630da30e6cf023f3620e3a94d596 100644 (file)
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
 public class ContextSetterImpl implements ContextSetter, Closeable {
 
     private final LogbackStatusListener statusListener;
-    private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ContextSetterImpl.class);
+    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ContextSetterImpl.class);
 
     public ContextSetterImpl(final LogbackRuntimeRegistrator rootRuntimeBeanRegistratorWrapper) {
         statusListener = new LogbackStatusListener(rootRuntimeBeanRegistratorWrapper);
@@ -81,11 +81,11 @@ public class ContextSetterImpl implements ContextSetter, Closeable {
         Map<String, Appender<ILoggingEvent>> appendersMap = getAppenders(module, context);
 
         for (LoggerTO logger : module.getLoggerTO()) {
-            LOGGER.trace("Setting configuration for logger {}", logger.getLoggerName());
+            LOG.trace("Setting configuration for logger {}", logger.getLoggerName());
             final ch.qos.logback.classic.Logger logbackLogger = context.getLogger(logger.getLoggerName());
 
             Optional<Set<Appender<ILoggingEvent>>> appendersBefore = getAppendersBefore(loggersBefore, logbackLogger);
-            LOGGER.trace("Logger {}: Appenders registered before: {}", logger.getLoggerName(),
+            LOG.trace("Logger {}: Appenders registered before: {}", logger.getLoggerName(),
                     appendersBefore.isPresent() ? appendersBefore.get() : "NO APPENDERS BEFORE");
 
             logbackLogger.setLevel(Level.toLevel(logger.getLevel()));
@@ -101,7 +101,7 @@ public class ContextSetterImpl implements ContextSetter, Closeable {
             for (String appenderName : logger.getAppenders()) {
                 if (appendersMap.containsKey(appenderName)) {
                     logbackLogger.addAppender(appendersMap.get(appenderName));
-                    LOGGER.trace("Logger {}: Adding new appender: {}", logger.getLoggerName(), appenderName);
+                    LOG.trace("Logger {}: Adding new appender: {}", logger.getLoggerName(), appenderName);
                 } else {
                     throw new IllegalStateException("No appender " + appenderName
                             + " found. This error should have been discovered by validation");
@@ -116,7 +116,7 @@ public class ContextSetterImpl implements ContextSetter, Closeable {
             for (Appender<ILoggingEvent> appenderBefore : appendersBefore.get()) {
                 logbackLogger.detachAppender(appenderBefore);
                 appenderBefore.stop();
-                LOGGER.trace("Logger {}: Removing old appender: {}", logger.getLoggerName(),
+                LOG.trace("Logger {}: Removing old appender: {}", logger.getLoggerName(),
                         appenderBefore.getName());
             }
             loggersBefore.remove(logbackLogger);
index adc69fe31eb596797564ccfa46de81d5cdf264bc..0078120d8c59a6e681c25eefd56d10527555b0cd 100644 (file)
  */
 package org.opendaylight.controller.config.yang.logback.config;
 
+import com.google.common.collect.Sets;
 import java.util.Set;
-
 import org.opendaylight.controller.config.api.JmxAttribute;
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
 
-import com.google.common.collect.Sets;
-
 /**
 *
 */
index e8d161afbbafdac3020c86524c36f482bf362adf..8111136cfcdfedcd71a9316bf59c5c074e194cf8 100644 (file)
  */
 package org.opendaylight.controller.config.yang.logback.config;
 
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.core.status.StatusBase;
+import ch.qos.logback.core.status.StatusListener;
+import ch.qos.logback.core.status.StatusManager;
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-
 import org.slf4j.LoggerFactory;
 
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.status.StatusBase;
-import ch.qos.logback.core.status.StatusListener;
-import ch.qos.logback.core.status.StatusManager;
-
 public class LogbackStatusListener implements StatusListener, LogbackRuntimeMXBean, Closeable {
 
     private final List<StatusTO> receivedStatuses;
index 4ba4a02920e167b67c4b9ad75525f2f0ba605479..82bc5864869cce2c44548d20eaf06cfc28d2907b 100644 (file)
@@ -13,10 +13,15 @@ import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.Appender;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -25,14 +30,6 @@ import org.opendaylight.controller.config.api.DependencyResolver;
 import org.opendaylight.controller.config.api.ModuleIdentifier;
 import org.slf4j.LoggerFactory;
 
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.Appender;
-
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-
 public class ContextSetterImplTest {
 
     @Mock
@@ -154,4 +151,5 @@ public class ContextSetterImplTest {
         a.setEncoderPattern("%-4relative [%thread] %-5level %logger{35} - %msg%n");
         return a;
     }
+
 }
index 9e07cc68cb94effc1cf697777a235c58728af84e..d190f04e61e3595cd0ad4e7d079be933ffa9b97e 100644 (file)
@@ -148,7 +148,7 @@ public class LogbackModuleTest extends AbstractConfigTest {
         try {
             createBeans(
 
-            true, "target/rollingApp", "", "30MB", 1, 5, "target/%i.log", "rolling", "consoleName", "ALL", "logger1",
+                true, "target/rollingApp", "", "30MB", 1, 5, "target/%i.log", "rolling", "consoleName", "ALL", "logger1",
                     "DEBUG", "FixedWindowRollingPolicy", 0, "FileAppender").commit();
             fail();
         } catch (ValidationException e) {
index 37bfb6d9578920c62115fd4deebaf7dc8c2cf750..999d8346e6c4dc27d675c31d43b3d9ce3b8ba4ef 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.config.yang.logback.config;
 
+import static org.junit.Assert.assertEquals;
+
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
 import ch.qos.logback.classic.joran.JoranConfigurator;
@@ -15,6 +17,17 @@ import ch.qos.logback.core.joran.spi.JoranException;
 import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
 import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
 import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMX;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,20 +40,6 @@ import org.opendaylight.controller.config.util.ConfigTransactionClient;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.slf4j.LoggerFactory;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.JMX;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
 public class LogbackModuleWithInitialConfigurationTest extends AbstractConfigTest {
 
     private LogbackModuleFactory factory;
index 3c21e57f6e8aed1f298fd917bf434eda93d5647c..9fcd38976ea4f1a166cbd5dfc43ea6a31a8a81ac 100644 (file)
@@ -7,10 +7,21 @@
  */
 package org.opendaylight.controller.config.yang.logback.config;
 
+import static org.junit.Assert.assertEquals;
+
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMX;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
 import org.junit.Test;
@@ -21,18 +32,6 @@ import org.opendaylight.controller.config.manager.impl.factoriesresolver.Hardcod
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 import org.slf4j.LoggerFactory;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.JMX;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
 public class LogbackWithXmlConfigModuleTest extends AbstractConfigTest {
 
     private LogbackModuleFactory factory;
index 69ea51f3a50eb5f5c762054e0988bf2cb6ee8fbf..d3f43da4bfc42535c7b35da350414470c985f814 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.config.yang.netty.eventexecutor;
 import com.google.common.reflect.AbstractInvocationHandler;
 import com.google.common.reflect.Reflection;
 import io.netty.util.concurrent.EventExecutor;
-
 import java.lang.reflect.Method;
 import java.util.concurrent.TimeUnit;
 
index 1585bbf6de3752c77599a058bdd2b098303e8962..1ca57c637f562e834eb6f686a25613f5cff91542 100644 (file)
  */
 package org.opendaylight.controller.config.yang.netty.eventexecutor;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.osgi.framework.BundleContext;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 public class GlobalEventExecutorModuleFactory extends org.opendaylight.controller.config.yang.netty.eventexecutor.AbstractGlobalEventExecutorModuleFactory {
     public static final String SINGLETON_NAME = "singleton";
 
index b3ec67bbf5254ebc55fc09e3514254d2882e5e42..2a804eb40e039f8a1d46fa591a4239fa7fb1a43b 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.controller.config.yang.netty.eventexecutor;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.osgi.framework.BundleContext;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 public class ImmediateEventExecutorModuleFactory extends org.opendaylight.controller.config.yang.netty.eventexecutor.AbstractImmediateEventExecutorModuleFactory {
     public static final String SINGLETON_NAME = "singleton";
 
index e89d82a28fd6b3f8876e89724d254691bf90fad3..8fe3d7c24c2c6f8fb2001c12ba4b8d7bc03041b2 100644 (file)
@@ -8,6 +8,11 @@
 
 package org.opendaylight.controller.config.yang.netty.eventexecutor;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -17,12 +22,6 @@ import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 public class GlobalEventExecutorModuleTest extends AbstractConfigTest {
 
     private GlobalEventExecutorModuleFactory factory;
@@ -79,7 +78,7 @@ public class GlobalEventExecutorModuleTest extends AbstractConfigTest {
     private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName)
             throws InstanceAlreadyExistsException {
         ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
-        transaction.newMBeanProxy(nameCreated, GlobalEventExecutorModuleMXBean.class);
+        transaction.newMXBeanProxy(nameCreated, GlobalEventExecutorModuleMXBean.class);
         return nameCreated;
     }
 
index 54c87604a433298824fc33ae12a6dc11732dfa92..d280bcac585a76c6c8915d699466e2c2cefbdb91 100644 (file)
@@ -64,7 +64,7 @@ public class ImmediateEventExecutorModuleTest extends AbstractConfigTest {
     private ObjectName createInstance(ConfigTransactionJMXClient transaction, String instanceName)
             throws InstanceAlreadyExistsException {
         ObjectName nameCreated = transaction.createModule(factory.getImplementationName(), instanceName);
-        transaction.newMBeanProxy(nameCreated, ImmediateEventExecutorModuleMXBean.class);
+        transaction.newMXBeanProxy(nameCreated, ImmediateEventExecutorModuleMXBean.class);
         return nameCreated;
     }
 
index 06c9ae885d15e13625c42746f13940a944b83271..c5b726cd3c6bdc7bbb8a22dac88ab303449106b9 100644 (file)
 package org.opendaylight.controller.config.yang.netty.threadgroup;
 
 import io.netty.channel.nio.NioEventLoopGroup;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-
 import java.util.concurrent.TimeUnit;
+import org.opendaylight.controller.config.api.JmxAttributeValidationException;
 
 /**
 *
index 76134b025cf0c1a975338eb35c0644e8ba2d47db..ceefcda6def92db8f9eb027d08344283f6d83f55 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.controller.config.yang.netty.threadgroup;
 
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.ObjectName;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ConflictingVersionException;
@@ -16,10 +19,6 @@ import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ObjectName;
-
 public class NettyThreadgroupModuleTest extends AbstractConfigTest {
 
     private NettyThreadgroupModuleFactory factory;
index ad2607a8db013b15d57184ee11e6d122a2efb41d..fc447aa7f9a10fe03877e5bb8cb2da4e099836bb 100644 (file)
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
           <sourceDirectory>${project.basedir}</sourceDirectory>
           <includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/*.yang</includes>
-          <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/</excludes>
+          <!-- excluding logback-config, has several checkstyle warnings
+               regarding Logger/LoggerFactory, which couldn't be removed due necessity/intention
+               to use the particular implementation/library of Logger/LoggerFactory -->
+          <excludes>**\/logback-config\/,**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/</excludes>
         </configuration>
         <dependencies>
           <dependency>
index 276f4ec2d0b7f58ef204abe0c1a267a555f3ccfa..e6a16427037f39a5130252a6286490391049f9fc 100644 (file)
@@ -15,7 +15,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -47,7 +47,7 @@ public class InMemoryBrokerWriteTransactionBenchmark extends AbstractInMemoryBro
             LogicalDatastoreType.OPERATIONAL, (DOMStore)operStore,
             LogicalDatastoreType.CONFIGURATION, configStore);
 
-        domBroker = new DOMDataBrokerImpl(datastores, executor);
+        domBroker = new SerializedDOMDataBroker(datastores, executor);
         schemaContext = BenchmarkModel.createTestContext();
         configStore.onGlobalContextUpdated(schemaContext);
         operStore.onGlobalContextUpdated(schemaContext);
index 30704997f3de32ef759f55d147598e2a23e15824..de7d33e694443531901fec6da563f532ce9fd88b 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
diff --git a/opendaylight/md-sal/mdsal-artifacts/pom.xml b/opendaylight/md-sal/mdsal-artifacts/pom.xml
new file mode 100644 (file)
index 0000000..c765aa8
--- /dev/null
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+    Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v1.0 which accompanies this distribution,
+    and is available at http://www.eclipse.org/legal/epl-v10.html
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>mdsal-artifacts</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Core API/implementation -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-common</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-common-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-common-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-common-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-core-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-core-spi</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-broker-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-broker-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-config</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-connector-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-inmemory-datastore</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>md-sal-config</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- Test support -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-test-model</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-it</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-binding-broker-impl</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+                <scope>test</scope>
+            </dependency>
+
+            <!-- Features -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>features-mdsal</artifactId>
+                <version>${project.version}</version>
+                <classifier>features</classifier>
+                <type>xml</type>
+                <scope>runtime</scope>
+            </dependency>
+
+            <!-- FIXME: move this into netconf-artifacts -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-netconf-connector</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- FIXME: These below need splitting up -->
+
+            <!-- AD-SAL compatibility -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-compatibility</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- Base model augmentations -->
+            <dependency>
+                <groupId>org.opendaylight.controller.model</groupId>
+                <artifactId>model-inventory</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.model</groupId>
+                <artifactId>model-topology</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- Clustered implementation -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-clustering-commons</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-clustering-config</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-distributed-datastore</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-remoterpc-connector</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- OpenFlow stuff -->
+            <dependency>
+                <groupId>org.opendaylight.controller.md</groupId>
+                <artifactId>forwardingrules-manager</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.md</groupId>
+                <artifactId>inventory-manager</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.md</groupId>
+                <artifactId>statistics-manager</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.md</groupId>
+                <artifactId>topology-lldp-discovery</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.md</groupId>
+                <artifactId>topology-manager</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.model</groupId>
+                <artifactId>model-flow-base</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.model</groupId>
+                <artifactId>model-flow-service</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.model</groupId>
+                <artifactId>model-flow-statistics</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>features-flow</artifactId>
+                <version>${project.version}</version>
+                <classifier>features</classifier>
+                <type>xml</type>
+                <scope>runtime</scope>
+            </dependency>
+
+            <!-- RESTCONF -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-remote</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-rest-connector</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-rest-connector-config</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-restconf-broker</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-rest-docgen</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- Toaster -->
+            <dependency>
+                <groupId>org.opendaylight.controller.samples</groupId>
+                <artifactId>sample-toaster</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.samples</groupId>
+                <artifactId>sample-toaster-consumer</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.samples</groupId>
+                <artifactId>sample-toaster-provider</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.samples</groupId>
+                <artifactId>toaster-config</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller.samples</groupId>
+                <artifactId>features-toaster</artifactId>
+                <version>${project.version}</version>
+                <classifier>features</classifier>
+                <type>xml</type>
+                <scope>runtime</scope>
+            </dependency>
+
+            <!-- XSQL support -->
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-dom-xsql</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-karaf-xsql</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>sal-dom-xsql-config</artifactId>
+                <version>${project.version}</version>
+                <classifier>config</classifier>
+                <type>xml</type>
+            </dependency>
+
+        </dependencies>
+    </dependencyManagement>
+</project>
+
index d21f16c4782a8ba0eac0389fabccaf7e58728a02..6c87899eea5d1d401dface6628fa3f6921385091 100644 (file)
@@ -14,6 +14,8 @@
   <packaging>pom</packaging>
 
   <modules>
+    <module>mdsal-artifacts</module>
+
     <!-- Common APIs & Implementation -->
     <module>sal-common</module>
     <module>sal-common-api</module>
             </lifecycleMappingMetadata>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.eclipse.xtend</groupId>
-          <artifactId>xtend-maven-plugin</artifactId>
-          <version>${xtend.version}</version>
-        </plugin>
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
index ade3e1b8f6ba73376f5391a8db1da0f1d8c0dcb1..9346e223df1b0fcb5a0f298386a2912578503c30 100644 (file)
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.xtend</groupId>
-      <artifactId>org.eclipse.xtend.lib</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.javassist</groupId>
       <artifactId>javassist</artifactId>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/DefaultRuntimeCodeGenerator.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/DefaultRuntimeCodeGenerator.java
new file mode 100644 (file)
index 0000000..dfa164b
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.sal.binding.codegen.impl;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import java.lang.reflect.Method;
+import java.util.Map;
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtMethod;
+import javassist.NotFoundException;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeSpecification;
+import org.opendaylight.yangtools.sal.binding.generator.util.ClassGenerator;
+import org.opendaylight.yangtools.sal.binding.generator.util.MethodGenerator;
+import org.opendaylight.yangtools.util.ClassLoaderUtils;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.RpcImplementation;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
+
+final class DefaultRuntimeCodeGenerator extends AbstractRuntimeCodeGenerator {
+
+    DefaultRuntimeCodeGenerator(final ClassPool pool) {
+        super(pool);
+    }
+
+    @Override
+    protected <T extends RpcService> Supplier<T> directProxySupplier(final Class<T> serviceType) {
+        return new Supplier<T>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public T get() {
+                final String proxyName = RuntimeCodeSpecification.getDirectProxyName(serviceType);
+
+                final Class<?> potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(proxyName);
+                if (potentialClass != null) {
+                    try {
+                        return (T)potentialClass.newInstance();
+                    } catch (InstantiationException | IllegalAccessException e) {
+                        throw new IllegalStateException("Failed to instantiate class " + potentialClass.getName(), e);
+                    }
+                }
+
+                final CtClass supertype = utils.asCtClass(serviceType);
+                final String directProxyName = RuntimeCodeSpecification.getDirectProxyName(serviceType);
+
+                final CtClass createdCls;
+                try {
+                    createdCls = utils.createClass(directProxyName, supertype, new ClassGenerator() {
+                        @Override
+                        public void process(final CtClass cls) throws CannotCompileException {
+                            utils.field(cls, RuntimeCodeSpecification.DELEGATE_FIELD, serviceType);
+                            utils.implementsType(cls, utils.asCtClass(RpcImplementation.class));
+                            utils.implementMethodsFrom(cls, supertype, new MethodGenerator() {
+                                @Override
+                                public void process(final CtMethod method) throws CannotCompileException {
+                                    final StringBuilder sb = new StringBuilder("\n");
+                                    sb.append("{\n");
+                                    sb.append("    if (").append(RuntimeCodeSpecification.DELEGATE_FIELD).append(" == null) {\n");
+                                    sb.append("        throw new java.lang.IllegalStateException(\"No default provider is available\");\n");
+                                    sb.append("    }\n");
+                                    sb.append("    return ($r) ").append(RuntimeCodeSpecification.DELEGATE_FIELD).append('.').append(method.getName()).append("($$);\n");
+                                    sb.append("}\n");
+                                    method.setBody(sb.toString());
+                                }
+                            });
+
+                            // FIXME: copy this one...
+                            utils.implementMethodsFrom(cls, utils.asCtClass(RpcImplementation.class), new MethodGenerator() {
+                                @Override
+                                public void process(final CtMethod method) throws CannotCompileException {
+                                    final StringBuilder sb = new StringBuilder("\n");
+                                    sb.append("{\n");
+                                    sb.append("    throw new java.lang.IllegalStateException(\"No provider is processing supplied message\");\n");
+                                    sb.append("    return ($r) null;\n");
+                                    sb.append("}\n");
+                                    method.setBody(sb.toString());
+                                }
+                            });
+                        }
+                    });
+                } catch (CannotCompileException e) {
+                    throw new IllegalStateException("Failed to create class " + directProxyName, e);
+                }
+
+                final Class<?> c;
+                try {
+                    c = createdCls.toClass(serviceType.getClassLoader(), serviceType.getProtectionDomain());
+                } catch (CannotCompileException e) {
+                    throw new IllegalStateException(String.format("Failed to create class %s", createdCls), e);
+                }
+
+                try {
+                    return (T) c.newInstance();
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new IllegalStateException(String.format("Failed to instantiated class %s", c), e);
+                }
+            }
+        };
+    }
+
+    @Override
+    protected <T extends RpcService> Supplier<T> routerSupplier(final Class<T> serviceType, final RpcServiceMetadata metadata) {
+        return new Supplier<T>() {
+            @SuppressWarnings("unchecked")
+            @Override
+            public T get() {
+                final CtClass supertype = utils.asCtClass(serviceType);
+                final String routerName = RuntimeCodeSpecification.getRouterName(serviceType);
+                final Class<?> potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(routerName);
+                if (potentialClass != null) {
+                    try {
+                        return (T)potentialClass.newInstance();
+                    } catch (InstantiationException | IllegalAccessException e) {
+                        throw new IllegalStateException("Failed to instantiate class", e);
+                    }
+                }
+
+                final CtClass targetCls;
+                try {
+                    targetCls = utils.createClass(routerName, supertype, new ClassGenerator() {
+                        @Override
+                        public void process(final CtClass cls) throws CannotCompileException {
+                            utils.field(cls, RuntimeCodeSpecification.DELEGATE_FIELD, serviceType);
+                            //utils.field(cls, REMOTE_INVOKER_FIELD,iface);
+                            utils.implementsType(cls, utils.asCtClass(RpcImplementation.class));
+
+                            for (final Class<? extends BaseIdentity> ctx : metadata.getContexts()) {
+                                utils.field(cls, RuntimeCodeSpecification.getRoutingTableField(ctx), Map.class);
+                            }
+
+                            utils.implementMethodsFrom(cls, supertype, new MethodGenerator() {
+                                @Override
+                                public void process(final CtMethod method) throws CannotCompileException {
+                                    final int ptl;
+                                    try {
+                                        ptl = method.getParameterTypes().length;
+                                    } catch (NotFoundException e) {
+                                        throw new CannotCompileException(e);
+                                    }
+                                    final StringBuilder sb = new StringBuilder();
+
+                                    switch (ptl) {
+                                    case 0:
+                                        sb.append("return ($r) ").append(RuntimeCodeSpecification.DELEGATE_FIELD).append('.').append(method.getName()).append("($$);");
+                                        break;
+                                    case 1:
+                                        final RpcMetadata rpcMeta = metadata.getRpcMethod(method.getName());
+                                        final String rtGetter = rpcMeta.getInputRouteGetter().getName();
+                                        final String stName = supertype.getName();
+
+                                        sb.append('\n');
+                                        sb.append("{\n");
+                                        sb.append("    if ($1 == null) {\n");
+                                        sb.append("        throw new IllegalArgumentException(\"RPC input must not be null and must contain a value for field ").append(rtGetter).append("\");\n");
+                                        sb.append("    }\n");
+                                        sb.append("    if ($1.").append(rtGetter).append("() == null) {\n");
+                                        sb.append("        throw new IllegalArgumentException(\"Field ").append(rtGetter).append(" must not be null\");\n");
+                                        sb.append("    }\n");
+
+                                        sb.append("    final org.opendaylight.yangtools.yang.binding.InstanceIdentifier identifier = $1.").append(rtGetter).append("()");
+                                        if (rpcMeta.isRouteEncapsulated()) {
+                                            sb.append(".getValue()");
+                                        }
+                                        sb.append(";\n");
+
+                                        sb.append("    ").append(supertype.getName()).append(" instance = (").append(stName).append(") ").append(RuntimeCodeSpecification.getRoutingTableField(rpcMeta.getContext())).append(".get(identifier);\n");
+                                        sb.append("    if (instance == null) {\n");
+                                        sb.append("        instance = ").append(RuntimeCodeSpecification.DELEGATE_FIELD).append(";\n");
+                                        sb.append("    }\n");
+
+                                        sb.append("    if (instance == null) {\n");
+                                        sb.append("        throw new java.lang.IllegalStateException(\"No routable provider is processing routed message for \" + String.valueOf(identifier));\n");
+                                        sb.append("    }\n");
+                                        sb.append("    return ($r) instance.").append(method.getName()).append("($$);\n");
+                                        sb.append('}');
+                                        break;
+                                    default:
+                                        throw new CannotCompileException(String.format("Unsupported parameters length %s", ptl));
+                                    }
+
+                                    method.setBody(sb.toString());
+                                }
+                            });
+
+                            // FIXME: move this into a template class
+                            utils.implementMethodsFrom(cls, utils.asCtClass(RpcImplementation.class), new MethodGenerator() {
+                                @Override
+                                public void process(final CtMethod method) throws CannotCompileException {
+                                    final StringBuilder sb = new StringBuilder("\n");
+                                    sb.append("{\n");
+                                    sb.append("    throw new java.lang.IllegalStateException(\"No provider is processing supplied message\");\n");
+                                    sb.append("    return ($r) null;\n");
+                                    sb.append("}\n");
+
+                                    method.setBody(sb.toString());
+                                }
+                            });
+                        }
+                    });
+                } catch (CannotCompileException e) {
+                    throw new IllegalStateException("Failed to create class " + routerName, e);
+                }
+
+                final Class<?> c;
+                try {
+                    c = targetCls.toClass(serviceType.getClassLoader(), serviceType.getProtectionDomain());
+                } catch (CannotCompileException e) {
+                    throw new IllegalStateException(String.format("Failed to compile class %s", targetCls), e);
+                }
+
+                try {
+                    return (T)c.newInstance();
+                } catch (InstantiationException | IllegalAccessException e) {
+                    throw new IllegalStateException(String.format("Failed to instantiate class %s", c), e);
+                }
+            }
+        };
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected RuntimeGeneratedInvokerPrototype generateListenerInvoker(final Class<? extends NotificationListener> listenerType) {
+        final String invokerName = RuntimeCodeSpecification.getInvokerName(listenerType);
+        final CtClass targetCls;
+
+        // Builder for a set of supported types. Filled while the target class is being generated
+        final Builder<Class<? extends Notification>> b = ImmutableSet.builder();
+
+        try {
+            targetCls = utils.createClass(invokerName, getBrokerNotificationListener(), new ClassGenerator() {
+                @Override
+                public void process(final CtClass cls) throws CannotCompileException {
+                    utils.field(cls, RuntimeCodeSpecification.DELEGATE_FIELD, listenerType);
+                    utils.implementMethodsFrom(cls, getBrokerNotificationListener(), new MethodGenerator() {
+                        @Override
+                        public void process(final CtMethod method) throws CannotCompileException {
+                            final StringBuilder sb = new StringBuilder("\n");
+
+                            sb.append("{\n");
+
+                            for (Method m : listenerType.getMethods()) {
+                                if (BindingReflections.isNotificationCallback(m)) {
+                                    final Class<?> argType = m.getParameterTypes()[0];
+
+                                    // populates builder above
+                                    b.add((Class<? extends Notification>) argType);
+
+                                    sb.append("    if ($1 instanceof ").append(argType.getName()).append(") {\n");
+                                    sb.append("        ").append(RuntimeCodeSpecification.DELEGATE_FIELD).append('.').append(m.getName()).append("((").append(argType.getName()).append(") $1);\n");
+                                    sb.append("        return null;\n");
+                                    sb.append("    } else ");
+                                }
+                            }
+
+                            sb.append("    return null;\n");
+                            sb.append("}\n");
+                            method.setBody(sb.toString());
+                        }
+                    });
+                }
+            });
+        } catch (CannotCompileException e) {
+            throw new IllegalStateException("Failed to create class " + invokerName, e);
+        }
+
+        final Class<?> finalClass;
+        try {
+            finalClass = targetCls.toClass(listenerType.getClassLoader(), listenerType.getProtectionDomain());
+        } catch (CannotCompileException e) {
+            throw new IllegalStateException(String.format("Failed to compile class %s", targetCls), e);
+        }
+
+        return new RuntimeGeneratedInvokerPrototype(b.build(), (Class<? extends org.opendaylight.controller.sal.binding.api.NotificationListener<?>>) finalClass);
+    }
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
deleted file mode 100644 (file)
index 834eb4f..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.sal.binding.codegen.impl
-
-import java.util.Map
-import javassist.ClassPool
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yangtools.yang.binding.Notification
-import org.opendaylight.yangtools.yang.binding.RpcImplementation
-import org.opendaylight.yangtools.yang.binding.util.BindingReflections
-import org.opendaylight.yangtools.yang.binding.util.ClassLoaderUtils
-
-import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeCodeSpecification.*
-import org.opendaylight.yangtools.yang.binding.RpcService
-
-class RuntimeCodeGenerator extends AbstractRuntimeCodeGenerator {
-
-    new(ClassPool pool) {
-        super(pool)
-    }
-
-    override directProxySupplier(Class iface) {
-        return [|
-            val proxyName = iface.directProxyName;
-            val potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(proxyName)
-            if(potentialClass != null) {
-                return potentialClass.newInstance as RpcService;
-            }
-            val supertype = iface.asCtClass
-            val createdCls = createClass(iface.directProxyName, supertype) [
-                field(DELEGATE_FIELD, iface);
-                implementsType(RpcImplementation.asCtClass)
-                implementMethodsFrom(supertype) [
-                    body = '''
-                    {
-                        if(«DELEGATE_FIELD» == null) {
-                            throw new java.lang.IllegalStateException("No default provider is available");
-                        }
-                        return ($r) Â«DELEGATE_FIELD».«it.name»($$);
-                    }
-                    '''
-                ]
-                implementMethodsFrom(RpcImplementation.asCtClass) [
-                    body = '''
-                    {
-                        throw new java.lang.IllegalStateException("No provider is processing supplied message");
-                        return ($r) null;
-                    }
-                    '''
-                ]
-            ]
-            return createdCls.toClass(iface.classLoader).newInstance as RpcService
-        ]
-    }
-
-    override routerSupplier(Class iface, RpcServiceMetadata metadata) {
-        return [ |
-            val supertype = iface.asCtClass
-            val routerName = iface.routerName;
-            val potentialClass = ClassLoaderUtils.tryToLoadClassWithTCCL(routerName)
-            if(potentialClass != null) {
-                return potentialClass.newInstance as RpcService;
-            }
-
-            val targetCls = createClass(iface.routerName, supertype) [
-
-
-                field(DELEGATE_FIELD, iface)
-                //field(REMOTE_INVOKER_FIELD,iface);
-                implementsType(RpcImplementation.asCtClass)
-
-                for (ctx : metadata.contexts) {
-                    field(ctx.routingTableField, Map)
-                }
-                implementMethodsFrom(supertype) [
-                    if (parameterTypes.size === 1) {
-                        val rpcMeta = metadata.getRpcMethod(name);
-                        val bodyTmp = '''
-                        {
-                            if($1 == null) {
-                                throw new IllegalArgumentException("RPC input must not be null and must contain a value for field Â«rpcMeta.inputRouteGetter.name»");
-                            }
-                            if($1.«rpcMeta.inputRouteGetter.name»() == null) {
-                                throw new IllegalArgumentException("Field Â«rpcMeta.inputRouteGetter.name» must not be null");
-                            }
-                            final Â«InstanceIdentifier.name» identifier = $1.«rpcMeta.inputRouteGetter.name»()«IF rpcMeta.
-                            routeEncapsulated».getValue()«ENDIF»;
-                            Â«supertype.name» instance = («supertype.name») Â«rpcMeta.context.routingTableField».get(identifier);
-                            if(instance == null) {
-                               instance = Â«DELEGATE_FIELD»;
-                            }
-                            if(instance == null) {
-                                throw new java.lang.IllegalStateException("No routable provider is processing routed message for " + String.valueOf(identifier));
-                            }
-                            return ($r) instance.«it.name»($$);
-                        }'''
-                        body = bodyTmp
-                    } else if (parameterTypes.size === 0) {
-                        body = '''return ($r) Â«DELEGATE_FIELD».«it.name»($$);'''
-                    }
-                ]
-                implementMethodsFrom(RpcImplementation.asCtClass) [
-                    body = '''
-                    {
-                        throw new java.lang.IllegalStateException("No provider is processing supplied message");
-                        return ($r) null;
-                    }
-                    '''
-                ]
-            ]
-            return  targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance as RpcService
-        ];
-    }
-
-    override generateListenerInvoker(Class iface) {
-        val callbacks = iface.methods.filter[BindingReflections.isNotificationCallback(it)]
-
-        val supportedNotification = callbacks.map[parameterTypes.get(0) as Class<? extends Notification>].toSet;
-
-        val targetCls = createClass(iface.invokerName, brokerNotificationListener) [
-            field(DELEGATE_FIELD, iface)
-            implementMethodsFrom(brokerNotificationListener) [
-                body = '''
-                    {
-                        Â«FOR callback : callbacks SEPARATOR " else "»
-                            Â«val cls = callback.parameterTypes.get(0).name»
-                                if($1 instanceof Â«cls») {
-                                    Â«DELEGATE_FIELD».«callback.name»((«cls») $1);
-                                    return null;
-                                }
-                        Â«ENDFOR»
-                        return null;
-                    }
-                '''
-            ]
-        ]
-        val finalClass = targetCls.toClass(iface.classLoader, iface.protectionDomain)
-        return new RuntimeGeneratedInvokerPrototype(supportedNotification,
-            finalClass as Class<? extends org.opendaylight.controller.sal.binding.api.NotificationListener<?>>);
-    }
-}
index f037e679be72fbb037318708c98217325782dd66..4664b58d2a7d442e0ab20c59b32cedc7c1943696 100644 (file)
@@ -33,7 +33,7 @@ public class SingletonHolder {
 
     public static final ClassPool CLASS_POOL = ClassPool.getDefault();
     public static final JavassistUtils JAVASSIST = JavassistUtils.forClassPool(CLASS_POOL);
-    public static final org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator RPC_GENERATOR_IMPL = new org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator(
+    public static final org.opendaylight.controller.sal.binding.codegen.impl.DefaultRuntimeCodeGenerator RPC_GENERATOR_IMPL = new org.opendaylight.controller.sal.binding.codegen.impl.DefaultRuntimeCodeGenerator(
             CLASS_POOL);
     public static final RuntimeCodeGenerator RPC_GENERATOR = RPC_GENERATOR_IMPL;
     public static final NotificationInvokerFactory INVOKER_FACTORY = RPC_GENERATOR_IMPL.getInvokerFactory();
index d99ac6f2f0fe11d802c079ca92d9712dc1755a1d..38b36b33389f87d0e3101e81e79803b5d7591059 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCo
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.test.util.MockSchemaService;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.sal.binding.test;
+package org.opendaylight.controller.sal.binding.codegen.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -13,17 +13,14 @@ import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import javassist.ClassPool;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
-import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker;
 import org.opendaylight.controller.sal.binding.test.mock.BarListener;
@@ -41,14 +38,14 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class RuntimeCodeGeneratorTest {
+public class DefaultRuntimeCodeGeneratorTest {
 
     private RuntimeCodeGenerator codeGenerator;
     private NotificationInvokerFactory invokerFactory;
 
     @Before
     public void initialize() {
-        this.codeGenerator = new RuntimeCodeGenerator(ClassPool.getDefault());
+        this.codeGenerator = new DefaultRuntimeCodeGenerator(ClassPool.getDefault());
         this.invokerFactory = codeGenerator.getInvokerFactory();
     }
 
index 979f9aa73eaa6eba113a09fc28f56b5aaa6ccfe7..6ad93aa30cda301c009b11769ec3bd5977f876c1 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.broker.impl.compat.BackwardsCompatibleDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
@@ -144,7 +144,7 @@ public class BindingTestContext implements AutoCloseable {
                 .put(LogicalDatastoreType.CONFIGURATION, configStore)
                 .build();
 
-        newDOMDataBroker = new DOMDataBrokerImpl(newDatastores, executor);
+        newDOMDataBroker = new SerializedDOMDataBroker(newDatastores, executor);
 
         biCompatibleBroker = new BackwardsCompatibleDataBroker(newDOMDataBroker,mockSchemaService);
 
index 8f01a393c6eb28cb494fe89c063d5ab3085237be..fcbce6f8d7216d8e3568b8919f4c18d48a7ff99a 100644 (file)
@@ -15,10 +15,9 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException;
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
 import org.opendaylight.controller.md.sal.common.util.jmx.ThreadExecutorStatsMXBeanImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMConcurrentDataCommitCoordinator;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitExecutor;
+import org.opendaylight.controller.md.sal.dom.broker.impl.ConcurrentDOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.AbstractDOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.broker.impl.jmx.CommitStatsMXBeanImpl;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -85,14 +84,13 @@ public final class DomInmemoryDataBrokerModule extends
 
         final List<AbstractMXBean> mBeans = Lists.newArrayList();
 
-        DOMDataCommitExecutor commitCoordinator;
-        DurationStatisticsTracker commitStatsTracker = null;
+        final DurationStatisticsTracker commitStatsTracker;
+        final AbstractDOMDataBroker broker;
 
-        if(getAllowConcurrentCommits()) {
-            DOMConcurrentDataCommitCoordinator coordinator =
-                    new DOMConcurrentDataCommitCoordinator(listenableFutureExecutor);
-            commitStatsTracker = coordinator.getCommitStatsTracker();
-            commitCoordinator = coordinator;
+        if (getAllowConcurrentCommits()) {
+            final ConcurrentDOMDataBroker cdb = new ConcurrentDOMDataBroker(datastores, listenableFutureExecutor);
+            commitStatsTracker = cdb.getCommitStatsTracker();
+            broker = cdb;
         } else {
             /*
              * We use a single-threaded executor for commits with a bounded queue capacity. If the
@@ -105,13 +103,12 @@ public final class DomInmemoryDataBrokerModule extends
             ExecutorService commitExecutor = SpecialExecutors.newBoundedSingleThreadExecutor(
                     getMaxDataBrokerCommitQueueSize(), "WriteTxCommit");
 
-            DOMDataCommitCoordinatorImpl coordinator = new DOMDataCommitCoordinatorImpl(
+            SerializedDOMDataBroker sdb = new SerializedDOMDataBroker(datastores,
                     new DeadlockDetectingListeningExecutorService(commitExecutor,
                             TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER,
                             listenableFutureExecutor));
-
-            commitStatsTracker = coordinator.getCommitStatsTracker();
-            commitCoordinator = coordinator;
+            commitStatsTracker = sdb.getCommitStatsTracker();
+            broker = sdb;
 
             final AbstractMXBean commitExecutorStatsMXBean =
                     ThreadExecutorStatsMXBeanImpl.create(commitExecutor, "CommitExecutorStats",
@@ -121,8 +118,6 @@ public final class DomInmemoryDataBrokerModule extends
             }
         }
 
-        DOMDataBrokerImpl newDataBroker = new DOMDataBrokerImpl(datastores, commitCoordinator);
-
         if(commitStatsTracker != null) {
             final CommitStatsMXBeanImpl commitStatsMXBean = new CommitStatsMXBeanImpl(
                     commitStatsTracker, JMX_BEAN_TYPE);
@@ -137,7 +132,7 @@ public final class DomInmemoryDataBrokerModule extends
             mBeans.add(commitFutureStatsMXBean);
         }
 
-        newDataBroker.setCloseable(new AutoCloseable() {
+        broker.setCloseable(new AutoCloseable() {
             @Override
             public void close() {
                 for(AbstractMXBean mBean: mBeans) {
@@ -146,6 +141,6 @@ public final class DomInmemoryDataBrokerModule extends
             }
         });
 
-        return newDataBroker;
+        return broker;
     }
 }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java
new file mode 100644 (file)
index 0000000..b705bd6
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.sal.dom.broker.impl;
+
+import static com.google.common.base.Preconditions.checkState;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicLong;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
+import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractDOMDataBroker extends AbstractDOMForwardedTransactionFactory<DOMStore> implements DOMDataBroker, AutoCloseable {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractDOMDataBroker.class);
+
+    private final AtomicLong txNum = new AtomicLong();
+    private final AtomicLong chainNum = new AtomicLong();
+    private volatile AutoCloseable closeable;
+
+    protected AbstractDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores) {
+        super(datastores);
+    }
+
+    public void setCloseable(final AutoCloseable closeable) {
+        this.closeable = closeable;
+    }
+
+    @Override
+    public void close() {
+        super.close();
+
+        if(closeable != null) {
+            try {
+                closeable.close();
+            } catch(Exception e) {
+                LOG.debug("Error closing instance", e);
+            }
+        }
+    }
+
+    @Override
+    protected Object newTransactionIdentifier() {
+        return "DOM-" + txNum.getAndIncrement();
+    }
+
+    @Override
+    public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
+            final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
+
+        DOMStore potentialStore = getTxFactories().get(store);
+        checkState(potentialStore != null, "Requested logical data store is not available.");
+        return potentialStore.registerChangeListener(path, listener, triggeringScope);
+    }
+
+    @Override
+    public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
+        checkNotClosed();
+
+        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains = new EnumMap<>(LogicalDatastoreType.class);
+        for (Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
+            backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
+        }
+
+        final long chainId = chainNum.getAndIncrement();
+        LOG.debug("Transactoin chain {} created with listener {}, backing store chains {}", chainId, listener,
+                backingChains);
+        return new DOMDataBrokerTransactionChainImpl(chainId, backingChains, this, listener);
+    }
+}
index c1ac0e1a1fd7cbc0cce85f10ed934833a35823ec..08888c13cffec8b43da6efa8fb9703bcc9beb37c 100644 (file)
@@ -8,16 +8,19 @@
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
 import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
 import java.util.EnumMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionFactory;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
 
@@ -37,7 +40,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
  * @param <T>
  *            Type of {@link DOMStoreTransactionFactory} factory.
  */
-abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransactionFactory> implements DOMDataCommitImplementation, AutoCloseable {
+abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransactionFactory> implements AutoCloseable {
     @SuppressWarnings("rawtypes")
     private static final AtomicIntegerFieldUpdater<AbstractDOMForwardedTransactionFactory> UPDATER =
             AtomicIntegerFieldUpdater.newUpdater(AbstractDOMForwardedTransactionFactory.class, "closed");
@@ -56,6 +59,26 @@ abstract class AbstractDOMForwardedTransactionFactory<T extends DOMStoreTransact
      */
     protected abstract Object newTransactionIdentifier();
 
+    /**
+     * User-supplied implementation of {@link DOMDataWriteTransaction#submit()}
+     * for transaction.
+     *
+     * Callback invoked when {@link DOMDataWriteTransaction#submit()} is invoked
+     * on transaction created by this factory.
+     *
+     * @param transaction
+     *            Transaction on which {@link DOMDataWriteTransaction#commit()}
+     *            was invoked.
+     * @param cohorts
+     *            Iteratable of cohorts for subtransactions associated with
+     *            the transaction being committed.
+     * @return a CheckedFuture. if commit coordination on cohorts finished successfully,
+     *         nothing is returned from the Future, On failure,
+     *         the Future fails with a {@link TransactionCommitFailedException}.
+     */
+    protected abstract CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
+            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts);
+
     /**
      * Creates a new composite read-only transaction
      *
@@ -16,12 +16,15 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
@@ -35,14 +38,12 @@ import org.slf4j.LoggerFactory;
  *
  * @author Thomas Pantelis
  */
-public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor {
-
+public class ConcurrentDOMDataBroker extends AbstractDOMDataBroker {
+    private static final Logger LOG = LoggerFactory.getLogger(ConcurrentDOMDataBroker.class);
     private static final String CAN_COMMIT = "CAN_COMMIT";
     private static final String PRE_COMMIT = "PRE_COMMIT";
     private static final String COMMIT = "COMMIT";
 
-    private static final Logger LOG = LoggerFactory.getLogger(DOMConcurrentDataCommitCoordinator.class);
-
     private final DurationStatisticsTracker commitStatsTracker = DurationStatisticsTracker.createConcurrent();
 
     /**
@@ -56,7 +57,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
      */
     private final ExecutorService internalFutureCallbackExecutor = new SimpleSameThreadExecutor();
 
-    public DOMConcurrentDataCommitCoordinator(ExecutorService listenableFutureExecutor) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, ExecutorService listenableFutureExecutor) {
+        super(datastores);
         this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
     }
 
index 3f7db01c6b3e0c09065c9c279be46a923a93df5a..fb5e438571090710e1f77f2bc3a47126327783fe 100644 (file)
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
-import static com.google.common.base.Preconditions.checkState;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
-import java.util.EnumMap;
 import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class DOMDataBrokerImpl extends AbstractDOMForwardedTransactionFactory<DOMStore> implements DOMDataBroker,
-        AutoCloseable {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DOMDataBrokerImpl.class);
-
-    private final DOMDataCommitExecutor coordinator;
-    private final AtomicLong txNum = new AtomicLong();
-    private final AtomicLong chainNum = new AtomicLong();
-    private volatile AutoCloseable closeable;
-
-    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores,
-            final ListeningExecutorService executor) {
-        this(datastores, new DOMDataCommitCoordinatorImpl(executor));
-    }
-
-    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores,
-            final DOMDataCommitExecutor coordinator) {
-        super(datastores);
-        this.coordinator = Preconditions.checkNotNull(coordinator);
-    }
-
-    public void setCloseable(final AutoCloseable closeable) {
-        this.closeable = closeable;
-    }
-
-    @Override
-    public void close() {
-        super.close();
-
-        if(closeable != null) {
-            try {
-                closeable.close();
-            } catch(Exception e) {
-                LOG.debug("Error closing instance", e);
-            }
-        }
-    }
-
-    @Override
-    protected Object newTransactionIdentifier() {
-        return "DOM-" + txNum.getAndIncrement();
-    }
-
-    @Override
-    public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
-            final YangInstanceIdentifier path, final DOMDataChangeListener listener, final DataChangeScope triggeringScope) {
-
-        DOMStore potentialStore = getTxFactories().get(store);
-        checkState(potentialStore != null, "Requested logical data store is not available.");
-        return potentialStore.registerChangeListener(path, listener, triggeringScope);
-    }
-
-    @Override
-    public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) {
-        checkNotClosed();
-
-        final Map<LogicalDatastoreType, DOMStoreTransactionChain> backingChains = new EnumMap<>(LogicalDatastoreType.class);
-        for (Entry<LogicalDatastoreType, DOMStore> entry : getTxFactories().entrySet()) {
-            backingChains.put(entry.getKey(), entry.getValue().createTransactionChain());
-        }
-
-        final long chainId = chainNum.getAndIncrement();
-        LOG.debug("Transactoin chain {} created with listener {}, backing store chains {}", chainId, listener,
-                backingChains);
-        return new DOMDataBrokerTransactionChainImpl(chainId, backingChains, coordinator, listener);
-
-    }
-
-    @Override
-    public CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts) {
-        LOG.debug("Transaction: {} submitted with cohorts {}.", transaction.getIdentifier(), cohorts);
-        return coordinator.submit(transaction, cohorts);
+/**
+ * @deprecated Compatibility wrapper around {@link SerializedDOMDataBroker}.
+ */
+@Deprecated
+public final class DOMDataBrokerImpl extends SerializedDOMDataBroker {
+    public DOMDataBrokerImpl(final Map<LogicalDatastoreType, DOMStore> datastores, final ListeningExecutorService executor) {
+        super(datastores, executor);
     }
 }
index 0b1dd1c5e0df481773a598ab3d99fa814e448187..77387c761cd6b26efea4c05471eb9632c695c578 100644 (file)
@@ -45,7 +45,7 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
             AtomicReferenceFieldUpdater.newUpdater(DOMDataBrokerTransactionChainImpl.class, State.class, "state");
     private static final Logger LOG = LoggerFactory.getLogger(DOMDataBrokerTransactionChainImpl.class);
     private final AtomicLong txNum = new AtomicLong();
-    private final DOMDataCommitExecutor coordinator;
+    private final AbstractDOMDataBroker broker;
     private final TransactionChainListener listener;
     private final long chainId;
 
@@ -69,10 +69,10 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
      */
     public DOMDataBrokerTransactionChainImpl(final long chainId,
             final Map<LogicalDatastoreType, DOMStoreTransactionChain> chains,
-            final DOMDataCommitExecutor coordinator, final TransactionChainListener listener) {
+            final AbstractDOMDataBroker broker, final TransactionChainListener listener) {
         super(chains);
         this.chainId = chainId;
-        this.coordinator = Preconditions.checkNotNull(coordinator);
+        this.broker = Preconditions.checkNotNull(broker);
         this.listener = Preconditions.checkNotNull(listener);
     }
 
@@ -91,7 +91,7 @@ final class DOMDataBrokerTransactionChainImpl extends AbstractDOMForwardedTransa
         checkNotFailed();
         checkNotClosed();
 
-        final CheckedFuture<Void, TransactionCommitFailedException> ret = coordinator.submit(transaction, cohorts);
+        final CheckedFuture<Void, TransactionCommitFailedException> ret = broker.submit(transaction, cohorts);
 
         COUNTER_UPDATER.incrementAndGet(this);
         Futures.addCallback(ret, new FutureCallback<Void>() {
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitExecutor.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitExecutor.java
deleted file mode 100644 (file)
index dae14b5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.dom.broker.impl;
-
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-
-/**
- * Executor of Three Phase Commit coordination for
- * {@link DOMDataWriteTransaction} transactions.
- *
- * Implementations are responsible for executing implementation of three-phase
- * commit protocol on supplied {@link DOMStoreThreePhaseCommitCohort}s.
- *
- *
- */
-public interface DOMDataCommitExecutor {
-
-    /**
-     * Submits supplied transaction to be executed in context of provided
-     * cohorts.
-     *
-     * Transaction is used only as a context, cohorts should be associated with
-     * this transaction.
-     *
-     * @param tx
-     *            Transaction to be used as context for reporting
-     * @param cohort
-     *            DOM Store cohorts representing provided transaction, its
-     *            subtransactions.
-     * @return a CheckedFuture. if commit coordination on cohorts finished successfully,
-     *         nothing is returned from the Future, On failure,
-     *         the Future fails with a {@link TransactionCommitFailedException}.
-     *
-     */
-    CheckedFuture<Void,TransactionCommitFailedException> submit(DOMDataWriteTransaction tx,
-            Iterable<DOMStoreThreePhaseCommitCohort> cohort);
-
-}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataCommitImplementation.java
deleted file mode 100644 (file)
index 2f2b6e5..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.md.sal.dom.broker.impl;
-
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import com.google.common.util.concurrent.CheckedFuture;
-
-/**
- *
- * Implementation prototype of commit method for
- * {@link DOMForwardedWriteTransaction}.
- *
- */
-public interface DOMDataCommitImplementation {
-
-    /**
-     * User-supplied implementation of {@link DOMDataWriteTransaction#submit()}
-     * for transaction.
-     *
-     * Callback invoked when {@link DOMDataWriteTransaction#submit()} is invoked
-     * on transaction created by this factory.
-     *
-     * @param transaction
-     *            Transaction on which {@link DOMDataWriteTransaction#commit()}
-     *            was invoked.
-     * @param cohorts
-     *            Iteration of cohorts for subtransactions associated with
-     *            commited transaction.
-     *
-     */
-    CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
-            final Iterable<DOMStoreThreePhaseCommitCohort> cohorts);
-}
-
index 662d48afdb2c33681aa4815c64f2a6992ac6329b..833d60cb3e787338e0c7e726ac81592bcf1af87e 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 final class DOMForwardedReadWriteTransaction extends DOMForwardedWriteTransaction<DOMStoreReadWriteTransaction> implements DOMDataReadWriteTransaction {
     protected DOMForwardedReadWriteTransaction(final Object identifier,
             final Map<LogicalDatastoreType, DOMStoreReadWriteTransaction> backingTxs,
-            final DOMDataCommitImplementation commitImpl) {
+            final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
         super(identifier, backingTxs, commitImpl);
     }
 
index 8c84af11ff2ec7aa44eb5b5866de6c0203f14453..45e18ff2199838c2b9896bd4ef9663e07bafdcb1 100644 (file)
@@ -51,8 +51,8 @@ import org.slf4j.LoggerFactory;
 class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         AbstractDOMForwardedCompositeTransaction<LogicalDatastoreType, T> implements DOMDataWriteTransaction {
     @SuppressWarnings("rawtypes")
-    private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, DOMDataCommitImplementation> IMPL_UPDATER =
-            AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, DOMDataCommitImplementation.class, "commitImpl");
+    private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, AbstractDOMForwardedTransactionFactory> IMPL_UPDATER =
+            AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, AbstractDOMForwardedTransactionFactory.class, "commitImpl");
     @SuppressWarnings("rawtypes")
     private static final AtomicReferenceFieldUpdater<DOMForwardedWriteTransaction, Future> FUTURE_UPDATER =
             AtomicReferenceFieldUpdater.newUpdater(DOMForwardedWriteTransaction.class, Future.class, "commitFuture");
@@ -64,7 +64,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
      * the transaction is running -- which we flip atomically using
      * {@link #IMPL_UPDATER}.
      */
-    private volatile DOMDataCommitImplementation commitImpl;
+    private volatile AbstractDOMForwardedTransactionFactory<?> commitImpl;
 
     /**
      * Future task of transaction commit. It starts off as null, but is
@@ -79,7 +79,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
     private volatile Future<?> commitFuture;
 
     protected DOMForwardedWriteTransaction(final Object identifier,
-            final Map<LogicalDatastoreType, T> backingTxs, final DOMDataCommitImplementation commitImpl) {
+            final Map<LogicalDatastoreType, T> backingTxs, final AbstractDOMForwardedTransactionFactory<?> commitImpl) {
         super(identifier, backingTxs);
         this.commitImpl = Preconditions.checkNotNull(commitImpl, "commitImpl must not be null.");
     }
@@ -104,7 +104,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
 
     @Override
     public boolean cancel() {
-        final DOMDataCommitImplementation impl = IMPL_UPDATER.getAndSet(this, null);
+        final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         if (impl != null) {
             LOG.trace("Transaction {} cancelled before submit", getIdentifier());
             FUTURE_UPDATER.lazySet(this, CANCELLED_FUTURE);
@@ -121,6 +121,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         return future.cancel(false);
     }
 
+    @Deprecated
     @Override
     public ListenableFuture<RpcResult<TransactionStatus>> commit() {
         return AbstractDataTransaction.convertToLegacyCommitFuture(submit());
@@ -128,7 +129,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
 
     @Override
     public CheckedFuture<Void, TransactionCommitFailedException> submit() {
-        final DOMDataCommitImplementation impl = IMPL_UPDATER.getAndSet(this, null);
+        final AbstractDOMForwardedTransactionFactory<?> impl = IMPL_UPDATER.getAndSet(this, null);
         checkRunning(impl);
 
         final Collection<T> txns = getSubtransactions();
@@ -144,7 +145,7 @@ class DOMForwardedWriteTransaction<T extends DOMStoreWriteTransaction> extends
         return ret;
     }
 
-    private void checkRunning(final DOMDataCommitImplementation impl) {
+    private void checkRunning(final AbstractDOMForwardedTransactionFactory<?> impl) {
         Preconditions.checkState(impl != null, "Transaction %s is no longer running", getIdentifier());
     }
 }
@@ -11,9 +11,12 @@ import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
+import java.util.Map;
 import java.util.concurrent.RejectedExecutionException;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
@@ -21,22 +24,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- *
  * Implementation of blocking three phase commit coordinator, which which
  * supports coordination on multiple {@link DOMStoreThreePhaseCommitCohort}.
  *
- * This implementation does not support cancelation of commit,
+ * This implementation does not support cancellation of commit,
  *
  * In order to advance to next phase of three phase commit all subtasks of
  * previous step must be finish.
  *
  * This executor does not have an upper bound on subtask timeout.
- *
- *
  */
-public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
-
-    private static final Logger LOG = LoggerFactory.getLogger(DOMDataCommitCoordinatorImpl.class);
+public class SerializedDOMDataBroker extends AbstractDOMDataBroker {
+    private static final Logger LOG = LoggerFactory.getLogger(SerializedDOMDataBroker.class);
     private final DurationStatisticsTracker commitStatsTracker = DurationStatisticsTracker.createConcurrent();
     private final ListeningExecutorService executor;
 
@@ -47,7 +46,8 @@ public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
      *
      * @param executor
      */
-    public DOMDataCommitCoordinatorImpl(final ListeningExecutorService executor) {
+    public SerializedDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, final ListeningExecutorService executor) {
+        super(datastores);
         this.executor = Preconditions.checkNotNull(executor, "executor must not be null.");
     }
 
@@ -56,7 +56,7 @@ public class DOMDataCommitCoordinatorImpl implements DOMDataCommitExecutor {
     }
 
     @Override
-    public CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
+    protected CheckedFuture<Void,TransactionCommitFailedException> submit(final DOMDataWriteTransaction transaction,
             final Iterable<DOMStoreThreePhaseCommitCohort> cohorts) {
         Preconditions.checkArgument(transaction != null, "Transaction must not be null.");
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
index eb51db2398fdb1062735553c0d5bb8af43cacbc8..2f02f981ab198fe248a33a33ac90187b57064211 100644 (file)
@@ -44,7 +44,7 @@ public class DOMBrokerPerformanceTest {
     }
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
 
     private static <V> V measure(final String name, final Callable<V> callable) throws Exception {
         // TODO Auto-generated method stub
@@ -72,7 +72,7 @@ public class DOMBrokerPerformanceTest {
                 .put(OPERATIONAL, operStore) //
                 .build();
         ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @Test
index 80c42010338d65edb1ad8cabdf185c03ab50440c..c1d301c549b8cd1964f9b296cf9e13a3a2d29774 100644 (file)
@@ -48,7 +48,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class DOMBrokerTest {
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
     private ListeningExecutorService executor;
     private ExecutorService futureExecutor;
     private CommitExecutorService commitExecutor;
@@ -74,7 +74,7 @@ public class DOMBrokerTest {
         futureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 5, "FCB");
         executor = new DeadlockDetectingListeningExecutorService(commitExecutor,
                 TransactionCommitDeadlockException.DEADLOCK_EXCEPTION_SUPPLIER, futureExecutor);
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @After
index 25d7df17d16d3d95ce3560ffafb1c5e049a73108..efc461a0c2500a6a6e565d3ad271ef3a19b8a003 100644 (file)
@@ -10,10 +10,18 @@ package org.opendaylight.controller.md.sal.dom.broker.impl;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.SettableFuture;
+import com.google.common.util.concurrent.Uninterruptibles;
 import java.util.Arrays;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.SynchronousQueue;
@@ -27,15 +35,12 @@ import org.junit.Test;
 import org.mockito.InOrder;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-import com.google.common.util.concurrent.Uninterruptibles;
 
 /**
  * Unit tests for DOMConcurrentDataCommitCoordinator.
@@ -49,12 +54,16 @@ public class DOMConcurrentDataCommitCoordinatorTest {
     private final DOMStoreThreePhaseCommitCohort mockCohort2 = mock(DOMStoreThreePhaseCommitCohort.class);
     private final ThreadPoolExecutor futureExecutor =
             new ThreadPoolExecutor(0, 1, 5, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
-    private final DOMConcurrentDataCommitCoordinator coordinator =
-            new DOMConcurrentDataCommitCoordinator(futureExecutor);
+    private ConcurrentDOMDataBroker coordinator;
 
     @Before
     public void setup() {
         doReturn("tx").when(transaction).getIdentifier();
+
+        DOMStore store = new InMemoryDOMDataStore("OPER",
+            MoreExecutors.sameThreadExecutor());
+
+        coordinator = new ConcurrentDOMDataBroker(ImmutableMap.of(LogicalDatastoreType.OPERATIONAL, store), futureExecutor);
     }
 
     @After
@@ -76,7 +85,7 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         final CountDownLatch asyncCanCommitContinue = new CountDownLatch(1);
         Answer<ListenableFuture<Boolean>> asyncCanCommit = new Answer<ListenableFuture<Boolean>>() {
             @Override
-            public ListenableFuture<Boolean> answer(InvocationOnMock invocation) {
+            public ListenableFuture<Boolean> answer(final InvocationOnMock invocation) {
                 final SettableFuture<Boolean> future = SettableFuture.create();
                 if(doAsync) {
                     new Thread() {
@@ -110,12 +119,12 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         final AtomicReference<Throwable> caughtEx = new AtomicReference<>();
         Futures.addCallback(future, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(Void result) {
+            public void onSuccess(final Void result) {
                 doneLatch.countDown();
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(final Throwable t) {
                 caughtEx.set(t);
                 doneLatch.countDown();
             }
@@ -158,8 +167,8 @@ public class DOMConcurrentDataCommitCoordinatorTest {
         assertFailure(future, null, mockCohort1, mockCohort2, mockCohort3);
     }
 
-    private void assertFailure(CheckedFuture<Void, TransactionCommitFailedException> future,
-            Exception expCause, DOMStoreThreePhaseCommitCohort... mockCohorts)
+    private void assertFailure(final CheckedFuture<Void, TransactionCommitFailedException> future,
+            final Exception expCause, final DOMStoreThreePhaseCommitCohort... mockCohorts)
                     throws Exception {
         try {
             future.checkedGet(5, TimeUnit.SECONDS);
index 17f477bb0f3083921a13dd101e019357d6195052..03d39a2a62a33cf5b61f468401a338b77133d622 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class DOMTransactionChainTest {
 
     private SchemaContext schemaContext;
-    private DOMDataBrokerImpl domBroker;
+    private AbstractDOMDataBroker domBroker;
 
     @Before
     public void setupStore() {
@@ -54,7 +54,7 @@ public class DOMTransactionChainTest {
                 .build();
 
         ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
-        domBroker = new DOMDataBrokerImpl(stores, executor);
+        domBroker = new SerializedDOMDataBroker(stores, executor);
     }
 
     @Test
index 16ad28dd4fa9f439e201e59a9e66ff205c809d18..94d6dfa6515b76857358c98a2b4d8217ebfc4ecc 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.md.statistics.manager;
 
 import java.util.List;
 
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
@@ -112,7 +113,7 @@ public interface StatPermCollector extends Runnable, AutoCloseable {
      * It is call from collecting allStatistics methods as a future result for
      * Operational/DS statistic store call (does not matter in the outcome).
      */
-    void collectNextStatistics();
+    void collectNextStatistics(TransactionId xid);
 
     /**
      * Method returns true if collector has registered some active nodes
index 0576c2a64541aa6b2c90099cbd299967af74252d..62319ad5946cb561393bb7d1e1517429ade57967 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 import com.google.common.base.Optional;
+import com.google.common.util.concurrent.SettableFuture;
 
 /**
  * statistics-manager
@@ -77,7 +78,8 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param future - result every Device RPC call
      */
-    <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(Future<RpcResult<T>> future, D inputObj, NodeRef ref);
+    <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(
+            Future<RpcResult<T>> future, D inputObj, NodeRef ref, SettableFuture<TransactionId> resultTransId);
 
     /**
      * Method adds Notification which is marked as Multipart to the transaction cash
@@ -104,7 +106,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllGroupsStat(NodeRef nodeRef);
+    Future<TransactionId> getAllGroupsStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightGroupStatisticsService.getGroupDescription
@@ -112,7 +114,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllGroupsConfStats(NodeRef nodeRef);
+    Future<TransactionId> getAllGroupsConfStats(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightMeterStatisticsService.getGroupFeatures
@@ -128,7 +130,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllMetersStat(NodeRef nodeRef);
+    Future<TransactionId> getAllMetersStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightMeterStatisticsService.getAllMeterConfigStatistics
@@ -136,7 +138,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllMeterConfigStat(NodeRef nodeRef);
+    Future<TransactionId> getAllMeterConfigStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightMeterStatisticsService.getMeterFeatures
@@ -152,7 +154,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllFlowsStat(NodeRef nodeRef);
+    Future<TransactionId> getAllFlowsStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightFlowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows
@@ -169,7 +171,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllPortsStat(NodeRef nodeRef);
+    Future<TransactionId> getAllPortsStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightFlowTableStatisticsService.getFlowTablesStatistics
@@ -177,7 +179,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllTablesStat(NodeRef nodeRef);
+    Future<TransactionId> getAllTablesStat(NodeRef nodeRef);
 
     /**
      * Method wraps OpendaylightQueueStatisticsService.getAllQueuesStatisticsFromAllPorts
@@ -185,7 +187,7 @@ public interface StatRpcMsgManager extends Runnable, AutoCloseable {
      *
      * @param NodeRef nodeRef
      */
-    void getAllQueueStat(NodeRef nodeRef);
+    Future<TransactionId> getAllQueueStat(NodeRef nodeRef);
 
 }
 
index 831dc224d113ec364257e57a292d98b24b908cc3..751a68965dc69af4963cf8bd1197cce9590f056d 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.me
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
@@ -97,7 +98,7 @@ public interface StatisticsManager extends AutoCloseable, TransactionChainListen
       *
       * @param nodeIdent
       */
-     void collectNextStatistics(InstanceIdentifier<Node> nodeIdent);
+     void collectNextStatistics(InstanceIdentifier<Node> nodeIdent, TransactionId xid);
 
      /**
       * Method wraps {@link StatPermCollector}.connectedNodeRegistration to provide
index 6bc6a30f8fb806ebe9e3b15473f7160ccba7670d..3f0e5e430e5db9c8c72098241e2d6e6fa513812f 100644 (file)
@@ -84,9 +84,9 @@ public abstract class StatAbstractNotifyCommit<N extends NotificationListener> i
         return manager.isProvidedFlowNodeActive(nodeIdent);
     }
 
-    protected void notifyToCollectNextStatistics(final InstanceIdentifier<Node> nodeIdent) {
+    protected void notifyToCollectNextStatistics(final InstanceIdentifier<Node> nodeIdent, final TransactionId xid) {
         Preconditions.checkNotNull(nodeIdent, "FlowCapableNode ident can not be null!");
-        manager.collectNextStatistics(nodeIdent);
+        manager.collectNextStatistics(nodeIdent, xid);
     }
 
     /**
index 230425999e3215045ac632a4d291e8cd5507c943..e17c45dc767f5050c4113c4df96b2c6aaf170232 100644 (file)
@@ -216,7 +216,7 @@ public class StatListenCommitFlow extends StatAbstractListenCommit<Flow, Openday
                     }
                 }
                 /* Notification for continue collecting statistics */
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
index 5185ef0b821c51374ac1299e4b6bd295215e8a4f..944ccfab5fd4433c37665037101d86e988a9b56d 100644 (file)
@@ -137,7 +137,7 @@ public class StatListenCommitGroup extends StatAbstractListenCommit<Group, Opend
                 /* Delete all not presented Group Nodes */
                 deleteAllNotPresentNode(fNodeIdent, tx, Collections.unmodifiableList(existGroupKeys));
                 /* Notification for continue collecting statistics */
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
@@ -247,8 +247,8 @@ public class StatListenCommitGroup extends StatAbstractListenCommit<Group, Opend
                     }
                     statGroupCommit(((GroupStatisticsUpdated) notif).getGroupStats(), nodeIdent, tx);
                 }
-                if (notifGroup.isPresent()) {
-                    notifyToCollectNextStatistics(nodeIdent);
+                if ( ! notifGroup.isPresent()) {
+                    notifyToCollectNextStatistics(nodeIdent, transId);
                 }
             }
         });
index d6988a6f2b8dac73197afc80b082fab023e4c9a7..2d5be71dcf914e41f0d8b9d61db9d5d7429ad67d 100644 (file)
@@ -137,7 +137,7 @@ public class StatListenCommitMeter extends StatAbstractListenCommit<Meter, Opend
                 /* Delete all not presented Meter Nodes */
                 deleteAllNotPresentedNodes(fNodeIdent, tx, Collections.unmodifiableList(existMeterKeys));
                 /* Notification for continue collecting statistics */
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
@@ -247,8 +247,8 @@ public class StatListenCommitMeter extends StatAbstractListenCommit<Meter, Opend
                     }
                     statMeterCommit(((MeterStatisticsUpdated) notif).getMeterStats(), nodeIdent, tx);
                 }
-                if (notifMeter.isPresent()) {
-                    notifyToCollectNextStatistics(nodeIdent);
+                if ( ! notifMeter.isPresent()) {
+                    notifyToCollectNextStatistics(nodeIdent, transId);
                 }
             }
         });
index f5c5689b7bcbe162178ff44e42c2742ecd3574c6..77d7c7d312345a74451fc45c4c1f972ed23fd9c0 100644 (file)
@@ -137,7 +137,7 @@ public class StatListenCommitQueue extends StatAbstractListenCommit<Queue, Opend
                 /* Delete all not presented Group Nodes */
                 deleteAllNotPresentedNodes(nodeIdent, tx, Collections.unmodifiableMap(existQueueKeys));
                 /* Notification for continue collecting statistics */
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
index fb124376b6be0875e1396559966e8c3da178a852..131de73f9ded30b75c1d039a9a9d5a9ab22def47 100644 (file)
@@ -105,7 +105,7 @@ public class StatNotifyCommitPort extends StatAbstractNotifyCommit<OpendaylightP
                 statPortCommit(portStats, nodeIdent, trans);
                 /* Notification for continue collecting statistics - Port statistics are still same size
                  * and they are small - don't need to wait for whole apply operation*/
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
index b41bd4973c99d3391509384edf7a7c49fbbf95cf..53bca87034e263bf0b4b73eb07bb6579dbf63043 100644 (file)
@@ -105,7 +105,7 @@ public class StatNotifyCommitTable extends StatAbstractNotifyCommit<Opendaylight
                 statTableCommit(tableStats, nodeIdent, trans);
                 /* Notification for continue collecting statistics - Tables statistics are still same size
                  * and they are small - don't need to wait to whole apply operation */
-                notifyToCollectNextStatistics(nodeIdent);
+                notifyToCollectNextStatistics(nodeIdent, transId);
             }
         });
     }
index ff1778e8aa9900c0512c6888d8580c92b4c75482..9dd70b5c2837287285feb7b6a54180d0e6866a5f 100644 (file)
@@ -6,12 +6,14 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 
 import org.opendaylight.controller.md.statistics.manager.StatPermCollector;
 import org.opendaylight.controller.md.statistics.manager.StatisticsManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
@@ -40,7 +42,7 @@ public class StatPermCollectorImpl implements StatPermCollector {
 
     private final static Logger LOG = LoggerFactory.getLogger(StatPermCollectorImpl.class);
 
-    private final static long STAT_COLLECT_TIME_OUT = 30000L;
+    private final static long STAT_COLLECT_TIME_OUT = 3000L;
 
     private final ExecutorService statNetCollectorServ;
     private final StatisticsManager manager;
@@ -51,12 +53,14 @@ public class StatPermCollectorImpl implements StatPermCollector {
 
     private final Object statCollectorLock = new Object();
     private final Object statNodeHolderLock = new Object();
+    private final Object transNotifyLock = new Object();
 
     private Map<InstanceIdentifier<Node>, StatNodeInfoHolder> statNodeHolder =
             Collections.<InstanceIdentifier<Node>, StatNodeInfoHolder> emptyMap();
 
     private volatile boolean wakeMe = false;
     private volatile boolean finishing = false;
+    private TransactionId actualTransactionId;
 
     public StatPermCollectorImpl(final StatisticsManager manager, final long minReqNetInterv, final int nr,
             final int maxNodeForCollectors) {
@@ -77,7 +81,7 @@ public class StatPermCollectorImpl implements StatPermCollector {
     public void close() {
         statNodeHolder = Collections.<InstanceIdentifier<Node>, StatNodeInfoHolder> emptyMap();
         finishing = true;
-        collectNextStatistics();
+        collectNextStatistics(actualTransactionId);
         statNetCollectorServ.shutdown();
     }
 
@@ -134,7 +138,7 @@ public class StatPermCollectorImpl implements StatPermCollector {
                     }
                     if (statNodeHolder.isEmpty()) {
                         finishing = true;
-                        collectNextStatistics();
+                        collectNextStatistics(actualTransactionId);
                         statNetCollectorServ.shutdown();
                     }
                     return true;
@@ -172,12 +176,14 @@ public class StatPermCollectorImpl implements StatPermCollector {
     }
 
     @Override
-    public void collectNextStatistics() {
-        if (wakeMe) {
-            synchronized (statCollectorLock) {
-                if (wakeMe) {
-                    LOG.trace("STAT-COLLECTOR is notified to conntinue");
-                    statCollectorLock.notify();
+    public void collectNextStatistics(final TransactionId xid) {
+        if (checkTransactionId(xid)) {
+            if (wakeMe) {
+                synchronized (statCollectorLock) {
+                    if (wakeMe) {
+                        LOG.trace("STAT-COLLECTOR is notified to conntinue");
+                        statCollectorLock.notify();
+                    }
                 }
             }
         }
@@ -186,6 +192,8 @@ public class StatPermCollectorImpl implements StatPermCollector {
     @Override
     public void run() {
         try {
+            // sleep 5 second before collecting all statistics cycles is important
+            // for loading all Nodes to Operational/DS
             Thread.sleep(5000);
         }
         catch (final InterruptedException e1) {
@@ -234,6 +242,7 @@ public class StatPermCollectorImpl implements StatPermCollector {
             } catch (final InterruptedException e) {
                 LOG.warn("statCollector has been interrupted waiting stat Response sleep", e);
             } finally {
+                setActualTransactionId(null);
                 wakeMe = false;
             }
         }
@@ -249,49 +258,54 @@ public class StatPermCollectorImpl implements StatPermCollector {
                 if ( ! isProvidedFlowNodeActive(nodeEntity.getKey())) {
                     break;
                 }
-                switch (statMarker) {
-                case PORT_STATS:
-                    LOG.trace("STAT-MANAGER-collecting PORT-STATS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllPortsStat(actualNodeRef);
-                    waitingForNotification();
-                    break;
-                case QUEUE_STATS:
-                    LOG.trace("STAT-MANAGER-collecting QUEUE-STATS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllQueueStat(actualNodeRef);
-                    waitingForNotification();
-                    break;
-                case TABLE_STATS:
-                    LOG.trace("STAT-MANAGER-collecting TABLE-STATS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllTablesStat(actualNodeRef);
-                    waitingForNotification();
-                    break;
-                case GROUP_STATS:
-                    LOG.trace("STAT-MANAGER-collecting GROUP-STATS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllGroupsConfStats(actualNodeRef);
-                    waitingForNotification();
-                    manager.getRpcMsgManager().getAllGroupsStat(actualNodeRef);
-                    waitingForNotification();
-                    break;
-                case METER_STATS:
-                    LOG.trace("STAT-MANAGER-collecting METER-STATS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllMeterConfigStat(actualNodeRef);
-                    waitingForNotification();
-                    manager.getRpcMsgManager().getAllMetersStat(actualNodeRef);
-                    waitingForNotification();
-                    break;
-                case FLOW_STATS:
-                    LOG.trace("STAT-MANAGER-collecting FLOW-STATS-ALL_FLOWS for NodeRef {}", actualNodeRef);
-                    manager.getRpcMsgManager().getAllFlowsStat(actualNodeRef);
-                    waitingForNotification();
-                    LOG.trace("STAT-MANAGER-collecting FLOW-AGGREGATE-STATS for NodeRef {}", actualNodeRef);
-                    for (short i = 0; i < maxTables; i++) {
-                        final TableId tableId = new TableId(i);
-                        manager.getRpcMsgManager().getAggregateFlowStat(actualNodeRef, tableId);
+                try {
+                    switch (statMarker) {
+                    case PORT_STATS:
+                        LOG.trace("STAT-MANAGER-collecting PORT-STATS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllPortsStat(actualNodeRef).get());
+                        waitingForNotification();
+                        break;
+                    case QUEUE_STATS:
+                        LOG.trace("STAT-MANAGER-collecting QUEUE-STATS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllQueueStat(actualNodeRef).get());
+                        waitingForNotification();
+                        break;
+                    case TABLE_STATS:
+                        LOG.trace("STAT-MANAGER-collecting TABLE-STATS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllTablesStat(actualNodeRef).get());
+                        waitingForNotification();
+                        break;
+                    case GROUP_STATS:
+                        LOG.trace("STAT-MANAGER-collecting GROUP-STATS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllGroupsConfStats(actualNodeRef).get());
+                        waitingForNotification();
+                        setActualTransactionId(manager.getRpcMsgManager().getAllGroupsStat(actualNodeRef).get());
+                        waitingForNotification();
+                        break;
+                    case METER_STATS:
+                        LOG.trace("STAT-MANAGER-collecting METER-STATS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllMeterConfigStat(actualNodeRef).get());
+                        waitingForNotification();
+                        setActualTransactionId(manager.getRpcMsgManager().getAllMetersStat(actualNodeRef).get());
+                        waitingForNotification();
+                        break;
+                    case FLOW_STATS:
+                        LOG.trace("STAT-MANAGER-collecting FLOW-STATS-ALL_FLOWS for NodeRef {}", actualNodeRef);
+                        setActualTransactionId(manager.getRpcMsgManager().getAllFlowsStat(actualNodeRef).get());
+                        waitingForNotification();
+                        LOG.trace("STAT-MANAGER-collecting FLOW-AGGREGATE-STATS for NodeRef {}", actualNodeRef);
+                        for (short i = 0; i < maxTables; i++) {
+                            final TableId tableId = new TableId(i);
+                            manager.getRpcMsgManager().getAggregateFlowStat(actualNodeRef, tableId);
+                        }
+                        break;
+                    default:
+                        /* Exception for programmers in implementation cycle */
+                        throw new IllegalStateException("Not implemented ASK for " + statMarker);
                     }
-                    break;
-                default:
-                    /* Exception for programmers in implementation cycle */
-                    throw new IllegalStateException("Not implemented ASK for " + statMarker);
+                } catch (InterruptedException | ExecutionException ex) {
+                    LOG.warn("Unexpected RPC exception by call RPC Future!", ex);
+                    continue;
                 }
             }
         }
@@ -333,5 +347,17 @@ public class StatPermCollectorImpl implements StatPermCollector {
         }
         return true;
     }
+
+    private boolean checkTransactionId(final TransactionId xid) {
+        synchronized (transNotifyLock) {
+            return actualTransactionId != null && actualTransactionId.equals(xid);
+        }
+    }
+
+    private void setActualTransactionId(final TransactionId transactionId) {
+        synchronized (transNotifyLock) {
+            actualTransactionId = transactionId;
+        }
+    }
 }
 
index 176e52708b0a9a7c8ce91710ad2631285904a283..4870223c0ff4506e01cb9614b4ef209981ab85fd 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
@@ -82,7 +83,6 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
 
     private final Cache<String, TransactionCacheContainer<? super TransactionAware>> txCache;
 
-    private final long maxLifeForRequest = 50; /* 50 second */
     private final int queueCapacity = 5000;
 
     private final OpendaylightGroupStatisticsService groupStatsService;
@@ -97,7 +97,7 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
     private volatile boolean finishing = false;
 
     public StatRpcMsgManagerImpl (final StatisticsManager manager,
-            final RpcConsumerRegistry rpcRegistry, final long minReqNetMonitInt) {
+            final RpcConsumerRegistry rpcRegistry, final long maxNodeForCollector) {
         Preconditions.checkArgument(manager != null, "StatisticManager can not be null!");
         Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
         groupStatsService = Preconditions.checkNotNull(
@@ -120,7 +120,9 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 "OpendaylightQueueStatisticsService can not be null!");
 
         statsRpcJobQueue = new LinkedBlockingQueue<>(queueCapacity);
-        txCache = CacheBuilder.newBuilder().expireAfterWrite(maxLifeForRequest, TimeUnit.SECONDS)
+        /* nr. 7 is here nr. of possible statistic which are waiting for notification
+         *      - check it in StatPermCollectorImpl method collectStatCrossNetwork */
+        txCache = CacheBuilder.newBuilder().expireAfterWrite((maxNodeForCollector * 7), TimeUnit.SECONDS)
                 .maximumSize(10000).build();
     }
 
@@ -163,7 +165,8 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
 
     @Override
     public <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(
-            final Future<RpcResult<T>> future, final D inputObj, final NodeRef nodeRef) {
+            final Future<RpcResult<T>> future, final D inputObj, final NodeRef nodeRef,
+            final SettableFuture<TransactionId> resultTransId) {
 
         Futures.addCallback(JdkFutureAdapters.listenInPoolThread(future),
                 new FutureCallback<RpcResult<? extends TransactionAware>>() {
@@ -174,6 +177,9 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 if (id == null) {
                     LOG.warn("No protocol support");
                 } else {
+                    if (resultTransId != null) {
+                        resultTransId.set(id);
+                    }
                     final NodeKey nodeKey = nodeRef.getValue().firstKeyOf(Node.class, NodeKey.class);
                     final String cacheKey = buildCacheKey(id, nodeKey.getId());
                     final TransactionCacheContainer<? super TransactionAware> container =
@@ -264,8 +270,9 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
     }
 
     @Override
-    public void getAllGroupsStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllGroupsStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllGroupStat = new RpcJobsQueue() {
 
             @Override
@@ -274,16 +281,18 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetAllGroupStatisticsInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(groupStatsService
-                        .getAllGroupStatistics(builder.build()), null, nodeRef);
+                        .getAllGroupStatistics(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllGroupStat);
+        return result;
     }
 
     @Override
-    public void getAllMetersStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllMetersStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllMeterStat = new RpcJobsQueue() {
 
             @Override
@@ -292,16 +301,18 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetAllMeterStatisticsInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(meterStatsService
-                        .getAllMeterStatistics(builder.build()), null, nodeRef);
+                        .getAllMeterStatistics(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllMeterStat);
+        return result;
     }
 
     @Override
-    public void getAllFlowsStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllFlowsStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllFlowStat = new RpcJobsQueue() {
 
             @Override
@@ -310,11 +321,12 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(flowStatsService
-                        .getAllFlowsStatisticsFromAllFlowTables(builder.build()), null, nodeRef);
+                        .getAllFlowsStatisticsFromAllFlowTables(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllFlowStat);
+        return result;
     }
 
     @Override
@@ -334,7 +346,7 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 tbuilder.setId(tableId.getValue());
                 tbuilder.setKey(new TableKey(tableId.getValue()));
                 registrationRpcFutureCallBack(flowStatsService
-                        .getAggregateFlowStatisticsFromFlowTableForAllFlows(builder.build()), tbuilder.build(), nodeRef);
+                        .getAggregateFlowStatisticsFromFlowTableForAllFlows(builder.build()), tbuilder.build(), nodeRef, null);
                 return null;
             }
         };
@@ -342,8 +354,9 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
     }
 
     @Override
-    public void getAllPortsStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllPortsStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllPortsStat = new RpcJobsQueue() {
 
             @Override
@@ -351,17 +364,20 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 final GetAllNodeConnectorsStatisticsInputBuilder builder =
                         new GetAllNodeConnectorsStatisticsInputBuilder();
                 builder.setNode(nodeRef);
-                registrationRpcFutureCallBack(portStatsService
-                        .getAllNodeConnectorsStatistics(builder.build()), null, nodeRef);
+                final Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> rpc =
+                        portStatsService.getAllNodeConnectorsStatistics(builder.build());
+                registrationRpcFutureCallBack(rpc, null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllPortsStat);
+        return result;
     }
 
     @Override
-    public void getAllTablesStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllTablesStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllTableStat = new RpcJobsQueue() {
 
             @Override
@@ -370,16 +386,18 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetFlowTablesStatisticsInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(flowTableStatsService
-                        .getFlowTablesStatistics(builder.build()), null, nodeRef);
+                        .getFlowTablesStatistics(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllTableStat);
+        return result;
     }
 
     @Override
-    public void getAllQueueStat(final NodeRef nodeRef) {
+    public Future<TransactionId>  getAllQueueStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllQueueStat = new RpcJobsQueue() {
 
             @Override
@@ -388,16 +406,18 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetAllQueuesStatisticsFromAllPortsInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(queueStatsService
-                        .getAllQueuesStatisticsFromAllPorts(builder.build()), null, nodeRef);
+                        .getAllQueuesStatisticsFromAllPorts(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(getAllQueueStat);
+        return result;
     }
 
     @Override
-    public void getAllMeterConfigStat(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllMeterConfigStat(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue qetAllMeterConfStat = new RpcJobsQueue() {
 
             @Override
@@ -406,11 +426,12 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetAllMeterConfigStatisticsInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(meterStatsService
-                        .getAllMeterConfigStatistics(builder.build()), null, nodeRef);
+                        .getAllMeterConfigStatistics(builder.build()), null, nodeRef, result);
                 return null;
             }
         };
         addGetAllStatJob(qetAllMeterConfStat);
+        return result;
     }
 
     @Override
@@ -423,7 +444,7 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 /* RPC input */
                 final GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder();
                 input.setNode(nodeRef);
-                registrationRpcFutureCallBack(groupStatsService.getGroupFeatures(input.build()), null, nodeRef);
+                registrationRpcFutureCallBack(groupStatsService.getGroupFeatures(input.build()), null, nodeRef, null);
                 return null;
             }
         };
@@ -440,7 +461,7 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                 /* RPC input */
                 final GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder();
                 input.setNode(nodeRef);
-                registrationRpcFutureCallBack(meterStatsService.getMeterFeatures(input.build()), null, nodeRef);
+                registrationRpcFutureCallBack(meterStatsService.getMeterFeatures(input.build()), null, nodeRef, null);
                 return null;
             }
         };
@@ -448,8 +469,9 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
     }
 
     @Override
-    public void getAllGroupsConfStats(final NodeRef nodeRef) {
+    public Future<TransactionId> getAllGroupsConfStats(final NodeRef nodeRef) {
         Preconditions.checkArgument(nodeRef != null, "NodeRef can not be null!");
+        final SettableFuture<TransactionId> result = SettableFuture.create();
         final RpcJobsQueue getAllGropConfStat = new RpcJobsQueue() {
 
             @Override
@@ -458,12 +480,13 @@ public class StatRpcMsgManagerImpl implements StatRpcMsgManager {
                         new GetGroupDescriptionInputBuilder();
                 builder.setNode(nodeRef);
                 registrationRpcFutureCallBack(groupStatsService
-                        .getGroupDescription(builder.build()), null, nodeRef);
+                        .getGroupDescription(builder.build()), null, nodeRef, result);
 
                 return null;
             }
         };
         addGetAllStatJob(getAllGropConfStat);
+        return result;
     }
 
     public class TransactionCacheContainerImpl<T extends TransactionAware> implements TransactionCacheContainer<T> {
index edf9fad433f6af8244948fc181dfce97b3d24177..1d03e38c165c0a51e3a257730792389abd4d42a5 100644 (file)
@@ -8,8 +8,15 @@
 
 package org.opendaylight.controller.md.statistics.manager.impl;
 
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.ThreadFactory;
+
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
@@ -28,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.me
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
@@ -39,14 +47,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.ThreadFactory;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
 
 /**
 * statistics-manager
@@ -90,8 +92,8 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable {
 
    private final StatisticsManagerConfig statManagerConfig;
 
-   public StatisticsManagerImpl (final DataBroker dataBroker, StatisticsManagerConfig statManagerconfig) {
-       this.statManagerConfig = Preconditions.checkNotNull(statManagerconfig);
+   public StatisticsManagerImpl (final DataBroker dataBroker, final StatisticsManagerConfig statManagerconfig) {
+       statManagerConfig = Preconditions.checkNotNull(statManagerconfig);
        this.dataBroker = Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
        ThreadFactory threadFact;
        threadFact = new ThreadFactoryBuilder().setNameFormat("odl-stat-rpc-oper-thread-%d").build();
@@ -105,7 +107,7 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable {
    public void start(final NotificationProviderService notifService,
            final RpcConsumerRegistry rpcRegistry) {
        Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry can not be null !");
-       rpcMsgManager = new StatRpcMsgManagerImpl(this, rpcRegistry, statManagerConfig.getMinRequestNetMonitorInterval());
+       rpcMsgManager = new StatRpcMsgManagerImpl(this, rpcRegistry, statManagerConfig.getMaxNodesForCollector());
        statCollectors = Collections.emptyList();
        nodeRegistrator = new StatNodeRegistrationImpl(this, dataBroker, notifService);
        flowListeningCommiter = new StatListenCommitFlow(this, dataBroker, notifService);
@@ -247,10 +249,10 @@ public class StatisticsManagerImpl implements StatisticsManager, Runnable {
    }
 
    @Override
-   public void collectNextStatistics(final InstanceIdentifier<Node> nodeIdent) {
+   public void collectNextStatistics(final InstanceIdentifier<Node> nodeIdent, final TransactionId xid) {
        for (final StatPermCollector collector : statCollectors) {
            if (collector.isProvidedFlowNodeActive(nodeIdent)) {
-               collector.collectNextStatistics();
+               collector.collectNextStatistics(xid);
            }
        }
    }
index 30704997f3de32ef759f55d147598e2a23e15824..de7d33e694443531901fec6da563f532ce9fd88b 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompati
 import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataBrokerImpl;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.spi.data.DOMStore;
@@ -68,7 +68,7 @@ public class DataBrokerTestCustomizer {
     }
 
     public DOMDataBroker createDOMDataBroker() {
-        return new DOMDataBrokerImpl(getDatastores(), getCommitCoordinatorExecutor());
+        return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
     }
 
     public ListeningExecutorService getCommitCoordinatorExecutor() {
index e6a9a75337a50635cf4a132cfd5f2fa93bb2e734..cc684a58b2815dac30e68780902880e4f5ff66ab 100644 (file)
@@ -14,7 +14,6 @@
     <bundle.plugin.version>2.4.0</bundle.plugin.version>
     <guava.version>14.0.1</guava.version>
     <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
-    <xtend.version>2.4.3</xtend.version>
   </properties>
   <dependencies>
     <dependency>
index 732b8fa1caa572e590ee090c2d04bec511bfd774..9bafe9760ae202cd8c75adfd0aa8a27aafae42ae 100644 (file)
@@ -36,7 +36,7 @@ public class NetconfClientSession extends AbstractNetconfSession<NetconfClientSe
             final Collection<String> capabilities) {
         super(sessionListener, channel, sessionId);
         this.capabilities = capabilities;
-        LOG.debug("Client Session {} created", toString());
+        LOG.debug("Client Session {} created", this);
     }
 
     public Collection<String> getServerCapabilities() {
index e36d58591e2ad8a1b2f757ca475ec7f41aa392ae..e441c709ccabcdcc9a9659a0ca96add3c21a27f1 100644 (file)
@@ -147,7 +147,7 @@ public final class Main {
 
         void validate() {
             checkArgument(deviceCount > 0, "Device count has to be > 0");
-            checkArgument(startingPort > 1024, "Starting port has to be > 1024");
+            checkArgument(startingPort > 1023, "Starting port has to be > 1023");
 
             if(schemasDir != null) {
                 checkArgument(schemasDir.exists(), "Schemas dir has to exist");
@@ -167,6 +167,10 @@ public final class Main {
         final NetconfDeviceSimulator netconfDeviceSimulator = new NetconfDeviceSimulator();
         try {
             final List<Integer> openDevices = netconfDeviceSimulator.start(params);
+            if (openDevices.size() == 0) {
+                LOG.error("Failed to start any simulated devices, exiting...");
+                System.exit(1);
+            }
             if(params.distroFolder != null) {
                 final ConfigGenerator configGenerator = new ConfigGenerator(params.distroFolder, openDevices);
                 final List<File> generated = configGenerator.generate(params.ssh, params.generateConfigBatchSize, params.generateConfigsTimeout, params.generateConfigsAddress);
index adcdea6073860b5f6b660faa356baf9cf7455df4..c6cad90355705961ca72e6cd64da36ff41780e14 100644 (file)
@@ -30,6 +30,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.management.ManagementFactory;
+import java.net.BindException;
 import java.net.Inet4Address;
 import java.net.InetSocketAddress;
 import java.net.URI;
@@ -185,6 +186,10 @@ public class NetconfDeviceSimulator implements Closeable {
         final PEMGeneratorHostKeyProvider keyPairProvider = getPemGeneratorHostKeyProvider();
 
         for (int i = 0; i < params.deviceCount; i++) {
+            if (currentPort > 65535) {
+                LOG.warn("Port cannot be greater than 65535, stopping further attempts.");
+                break;
+            }
             final InetSocketAddress address = getAddress(currentPort);
 
             final ChannelFuture server;
@@ -197,14 +202,17 @@ public class NetconfDeviceSimulator implements Closeable {
                     final SshProxyServer sshServer = new SshProxyServer(minaTimerExecutor, nettyThreadgroup, nioExecutor);
                     sshServer.bind(getSshConfiguration(bindingAddress, tcpLocalAddress));
                     sshWrappers.add(sshServer);
-                } catch (final Exception e) {
-                    LOG.warn("Cannot start simulated device on {}, skipping", address, e);
+                } catch (final BindException e) {
+                    LOG.warn("Cannot start simulated device on {}, port already in use. Skipping.", address);
                     // Close local server and continue
                     server.cancel(true);
                     if(server.isDone()) {
                         server.channel().close();
                     }
                     continue;
+                } catch (final IOException e) {
+                    LOG.warn("Cannot start simulated device on {} due to IOException.", address, e);
+                    break;
                 } finally {
                     currentPort++;
                 }
@@ -242,6 +250,8 @@ public class NetconfDeviceSimulator implements Closeable {
 
         if(openDevices.size() == params.deviceCount) {
             LOG.info("All simulated devices started successfully from port {} to {}", params.startingPort, currentPort - 1);
+        } else if (openDevices.size() == 0) {
+            LOG.warn("No simulated devices started.");
         } else {
             LOG.warn("Not all simulated devices started successfully. Started devices ar on ports {}", openDevices);
         }
index 0269bcccb989492e69b616fc955545ca49509f31..5fd53dce55639e0b5c8a811e11ab4b7b2a637117 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.netconf.util;
 
 import com.google.common.base.Preconditions;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
@@ -19,7 +18,7 @@ import org.w3c.dom.Document;
 
 public final class NetconfUtil {
 
-    private static final Logger logger = LoggerFactory.getLogger(NetconfUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfUtil.class);
 
     private NetconfUtil() {}
 
@@ -30,7 +29,7 @@ public final class NetconfUtil {
         if (element.getName().equals(XmlNetconfConstants.OK)) {
             return response;
         }
-        logger.warn("Can not load last configuration. Operation failed.");
+        LOG.warn("Can not load last configuration. Operation failed.");
         throw new IllegalStateException("Can not load last configuration. Operation failed: "
                 + XmlUtil.toString(response));
     }
index 6cc5006aba4ba7f9266935564911905d9b364b58..d2a6d2b58d237069ae67bd3c6a514ea5bfd090f6 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.netconf.util.exception;
 
 import java.util.Collections;
 import java.util.Map;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 
 public class MissingNameSpaceException extends NetconfDocumentedException {
index 7b5f52e3967178c8e30da453a06662994e054093..6d7c7ca7c434a884411822f2065096083cbe812e 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.netconf.util.exception;
 
 import java.util.Collections;
 import java.util.Map;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 
 public class UnexpectedElementException extends NetconfDocumentedException {
index 582fd23e16e7576c4b4c0622216f4db6f505f10f..4a19390b362f9358aff0db32d6e705b4bba16bbd 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.netconf.util.exception;
 
 import java.util.Collections;
 import java.util.Map;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 
 public class UnexpectedNamespaceException extends NetconfDocumentedException {
index 15223cb60ba994472cdedc939a6586f569471593..5cd17a2331e293c23d064c9acd535e021de43c8e 100644 (file)
@@ -8,11 +8,12 @@
 
 package org.opendaylight.controller.netconf.util.messages;
 
-import org.opendaylight.controller.netconf.api.NetconfMessage;
-
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
 import java.util.Set;
-
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.exception.MissingNameSpaceException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
@@ -20,10 +21,6 @@ import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-
 /**
  * NetconfMessage that can carry additional header with session metadata. See {@link org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader}
  */
index fa26455c9875d7245429ef72f2ce11b57c56acac..ac8a557d9ae359c8d5425f88ae7385905eaf9552 100644 (file)
@@ -8,10 +8,9 @@
 
 package org.opendaylight.controller.netconf.util.messages;
 
-import java.nio.ByteBuffer;
-
 import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
+import java.nio.ByteBuffer;
 
 /**
  * Netconf message header is used only when chunked framing mechanism is
index c532b7f9a6f235a0eebc7dc4a53bc10f2208dbc4..61b23202c3a134c27d975279e2f29f7d7eefefa0 100644 (file)
@@ -23,7 +23,7 @@ import org.w3c.dom.Document;
 
 public final class NetconfMessageUtil {
 
-    private static final Logger logger = LoggerFactory.getLogger(NetconfMessageUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfMessageUtil.class);
 
     private NetconfMessageUtil() {}
 
@@ -70,7 +70,7 @@ public final class NetconfMessageUtil {
                 try {
                     return input.getTextContent().trim();
                 } catch (NetconfDocumentedException e) {
-                    logger.trace("Error fetching inpit text content becauese {}",e);
+                    LOG.trace("Error fetching input text content",e);
                     return null;
                 }
             }
index 6604834fe42c02b3b3188fd7cd7f85c7b887ff3d..fe5ed03320cdd3b921e0c6d056d89b4d3381a58c 100644 (file)
@@ -9,14 +9,12 @@
 package org.opendaylight.controller.netconf.util.messages;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
-
-import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.slf4j.Logger;
@@ -27,20 +25,20 @@ import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 
 public final class SendErrorExceptionUtil {
-    private static final Logger logger = LoggerFactory.getLogger(SendErrorExceptionUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SendErrorExceptionUtil.class);
 
     private SendErrorExceptionUtil() {}
 
     public static void sendErrorMessage(final NetconfSession session,
             final NetconfDocumentedException sendErrorException) {
-        logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+        LOG.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
         final Document errorDocument = createDocument(sendErrorException);
         ChannelFuture f = session.sendMessage(new NetconfMessage(errorDocument));
         f.addListener(new SendErrorVerifyingListener(sendErrorException));
     }
 
     public static void sendErrorMessage(Channel channel, NetconfDocumentedException sendErrorException) {
-        logger.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
+        LOG.trace("Sending error {}", sendErrorException.getMessage(), sendErrorException);
         final Document errorDocument = createDocument(sendErrorException);
         ChannelFuture f = channel.writeAndFlush(new NetconfMessage(errorDocument));
         f.addListener(new SendErrorVerifyingListener(sendErrorException));
@@ -49,7 +47,7 @@ public final class SendErrorExceptionUtil {
     public static void sendErrorMessage(NetconfSession session, NetconfDocumentedException sendErrorException,
             NetconfMessage incommingMessage) {
         final Document errorDocument = createDocument(sendErrorException);
-        logger.trace("Sending error {}", XmlUtil.toString(errorDocument));
+        LOG.trace("Sending error {}", XmlUtil.toString(errorDocument));
         tryToCopyAttributes(incommingMessage.getDocument(), errorDocument, sendErrorException);
         ChannelFuture f = session.sendMessage(new NetconfMessage(errorDocument));
         f.addListener(new SendErrorVerifyingListener(sendErrorException));
@@ -76,7 +74,7 @@ public final class SendErrorExceptionUtil {
                 rpcReply.setAttributeNode((Attr) errorDocument.importNode(attr, true));
             }
         } catch (final Exception e) {
-            logger.warn("Unable to copy incomming attributes to {}, returned rpc-error might be invalid for client",
+            LOG.warn("Unable to copy incomming attributes to {}, returned rpc-error might be invalid for client",
                     sendErrorException, e);
         }
     }
index c77e0d7da25dc112e54489fbae42bf317a3f2b3f..64aeebd54205c658cad64589994a436282cbdb5b 100644 (file)
@@ -16,7 +16,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public final class NetconfConfigUtil {
-    private static final Logger logger = LoggerFactory.getLogger(NetconfConfigUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfConfigUtil.class);
 
     private static final String PREFIX_PROP = "netconf.";
 
@@ -48,7 +48,7 @@ public final class NetconfConfigUtil {
         try {
             return Long.parseLong(timeoutString);
         } catch (final NumberFormatException e) {
-            logger.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e);
+            LOG.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e);
             return DEFAULT_TIMEOUT_MILLIS;
         }
     }
@@ -89,7 +89,7 @@ public final class NetconfConfigUtil {
             try {
                 return Optional.of(parseAddress(address, port));
             } catch (final RuntimeException e) {
-                logger.warn("Unable to parse {} netconf address from {}:{}, fallback to default",
+                LOG.warn("Unable to parse {} netconf address from {}:{}, fallback to default",
                         infixProp, address, port, e);
             }
         }
index 23fe7cdf41e1b5cc9266f53a3f8694316311daa1..87ecb2de090ec8813d0bd0215cde1ade3bfcddd9 100644 (file)
@@ -8,14 +8,12 @@
 
 package org.opendaylight.controller.netconf.util.xml;
 
+import com.google.common.collect.ImmutableMap;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
-
 import javax.xml.namespace.NamespaceContext;
 
-import com.google.common.collect.ImmutableMap;
-
 // http://www.ibm.com/developerworks/library/x-nmspccontext/
 public class HardcodedNamespaceResolver implements NamespaceContext {
     private final Map<String/* prefix */, String/* namespace */> prefixesToNamespaces;
index e7ce4541559943e86983e2e83285ff0d0b9c18e6..eaaf320b023c454f5638a0f2138d262c312d0d1d 100644 (file)
@@ -12,7 +12,6 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 
 public final class XMLNetconfUtil {
index 3c63204881aa9ea0ef3e0909ad302e73187d5b31..e17cad977ce13dd254b996ebb9a31122fe6a87e0 100644 (file)
@@ -40,7 +40,7 @@ public final class XmlElement {
     public static final String DEFAULT_NAMESPACE_PREFIX = "";
 
     private final Element element;
-    private static final Logger logger = LoggerFactory.getLogger(XmlElement.class);
+    private static final Logger LOG = LoggerFactory.getLogger(XmlElement.class);
 
     private XmlElement(Element element) {
         this.element = element;
@@ -132,7 +132,7 @@ public final class XmlElement {
 
     public void checkNamespace(String expectedNamespace) throws UnexpectedNamespaceException, MissingNameSpaceException {
         if (!getNamespace().equals(expectedNamespace))
-       {
+        {
             throw new UnexpectedNamespaceException(String.format("Unexpected namespace %s should be %s",
                     getNamespace(),
                     expectedNamespace),
@@ -405,7 +405,7 @@ public final class XmlElement {
             try {
                 sb.append(", namespace='").append(getNamespace()).append('\'');
             } catch (MissingNameSpaceException e) {
-                logger.trace("Missing namespace for element.");
+                LOG.trace("Missing namespace for element.");
             }
         }
         sb.append('}');
index 8108c8e7402fac29469cf7804efd96e1dc6455df..bdab8c6209184d1262542bcd1b25b7d171157919 100644 (file)
@@ -8,19 +8,16 @@
 
 package org.opendaylight.controller.netconf.util.xml;
 
+import com.google.common.base.Preconditions;
 import java.io.IOException;
 import java.io.InputStream;
-
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.Validator;
-
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Preconditions;
-
 public final class XmlNetconfValidator {
 
     private static final Schema SCHEMA;
index 9e227ee05d6d9839c1f547ec5b53f1ff5b9f9a67..68c4d9fdab62413378eb2332ada310df601bf48e 100644 (file)
@@ -10,14 +10,12 @@ package org.opendaylight.controller.netconf.util.xml;
 
 import com.google.common.base.Charsets;
 import com.google.common.base.Optional;
-
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
-
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
@@ -35,7 +33,6 @@ import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
-
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -124,7 +121,7 @@ public final class XmlUtil {
     public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
                                                                  String namespace, String contentWithoutPrefix) {
 
-       return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.<String>absent());
+        return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.<String>absent());
     }
 
     public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
index 47d0d4c7ccc56294d85e753f603e6c8bd951f2c0..dc175c57337205c27f76b03cd55c8af9ecf774fd 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.netconf.util;
 
-import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
+import static org.hamcrest.CoreMatchers.containsString;
+
 import org.junit.Test;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.w3c.dom.Document;
index 62633dd3f25c45d704ab624f5e8d161ecc99c9f5..a6d1d5b999bcfa0757ec12b5aa13db0f2485d400 100644 (file)
@@ -8,6 +8,11 @@
 
 package org.opendaylight.controller.netconf.util.mapping;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
@@ -17,11 +22,6 @@ import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
 public class AbstractLastNetconfOperationTest {
     class LastNetconfOperationImplTest extends  AbstractLastNetconfOperation  {
 
index ea4a6e61f23aecd32e2a4261438d5e46f416d328..c7f6321e2c2c22d6c5893af56e76817790ca7323 100644 (file)
@@ -8,6 +8,11 @@
 
 package org.opendaylight.controller.netconf.util.mapping;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
 import java.io.IOException;
 import org.junit.Before;
 import org.junit.Test;
@@ -21,11 +26,6 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
 public class AbstractNetconfOperationTest {
 
     class NetconfOperationImpl extends AbstractNetconfOperation {
index d1310de3e20999857cc1f5829e42c853621f9be4..911b73f097ffad0c24af495e3cc39ce113bba617 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.netconf.util.mapping;
 
+import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
@@ -15,8 +17,6 @@ import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import static org.junit.Assert.assertEquals;
-
 public class AbstractSingletonNetconfOperationTest {
     class SingletonNCOperationImpl extends AbstractSingletonNetconfOperation {
 
index 95c91243af7a9e4b135f388c085e2543601c5bb0..5e50eb93fb1f62d43799a5bb510b07c4f52a22ff 100644 (file)
@@ -8,11 +8,11 @@
 
 package org.opendaylight.controller.netconf.util.messages;
 
+import static org.junit.Assert.assertEquals;
+
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-
 public class NetconfHelloMessageAdditionalHeaderTest {
 
 
index 5a9d07f6b1689455eae43a6dff82f6c5984803b7..4e157186ff911fed6a974709e703566080ffaa5d 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.netconf.util.messages;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+
 import com.google.common.base.Optional;
 import java.util.Set;
 import org.junit.Before;
index d5ff3380d28b7493b1b7e18962fc1bdbc4505e16..05c31be3957b712a0418187efdad7546088b553e 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.netconf.util.messages;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+
 import com.google.common.base.Charsets;
 import org.junit.Test;
 
index 2af34e957e2505917117ac0bc758e86ed3ee8aad..12769f5ed371473680ee2e3c5bb1dfec49866b95 100644 (file)
@@ -8,15 +8,15 @@
 
 package org.opendaylight.controller.netconf.util.messages;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Collection;
 import org.junit.Test;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
 import org.w3c.dom.Document;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 public class NetconfMessageUtilTest {
     @Test
     public void testNetconfMessageUtil() throws Exception {
index c8d562cb9c645879bbdaa868d227b675367e3e76..20287741b9fd57532a8fb4007ae320c517f34540 100644 (file)
@@ -8,6 +8,12 @@
 
 package org.opendaylight.controller.netconf.util.messages;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.util.concurrent.GenericFutureListener;
@@ -19,9 +25,6 @@ import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
 import org.w3c.dom.Document;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
 public class SendErrorExceptionUtilTest {
 
     NetconfSession netconfSession;
index ebee41145ab1d77c2296bf21ded57c83b172d98e..1a701057aa0ac8a4b2addc87af37b58582b24a46 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+
 import com.google.common.base.Optional;
 import io.netty.channel.local.LocalAddress;
 import java.net.InetSocketAddress;
index 457dda3080fa48adb18e170ba1e36d01d10513f6..e1331b1380935e86bad9fa962060e8c02210ce24 100644 (file)
@@ -8,23 +8,20 @@
 
 package org.opendaylight.controller.netconf.util.test;
 
+import com.google.common.base.Charsets;
+import com.google.common.base.Preconditions;
+import com.google.common.io.CharStreams;
+import com.google.common.io.InputSupplier;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-
 import javax.xml.parsers.ParserConfigurationException;
-
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import com.google.common.io.CharStreams;
-import com.google.common.io.InputSupplier;
-
 public class XmlFileLoader {
 
     public static NetconfMessage xmlFileToNetconfMessage(final String fileName) throws IOException, SAXException,
index a88de956e2f336704ce9af6895b9cf7285ce7f2b..22210a394e6a344cdb66df27af19662777c65b59 100644 (file)
@@ -17,6 +17,7 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import com.google.common.base.Optional;
 import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
@@ -25,8 +26,6 @@ import org.opendaylight.controller.netconf.util.exception.MissingNameSpaceExcept
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import com.google.common.base.Optional;
-
 public class XmlElementTest {
 
     private final String elementAsString = "<top xmlns=\"namespace\" xmlns:a=\"attrNamespace\" a:attr1=\"value1\" attr2=\"value2\">" +
index 5e94ac6110ca73d84817222f566cf965ff01d62d..0af445f17dea163739f22bf5e7bfd91242768045 100644 (file)
@@ -6,4 +6,4 @@
 <lexical-values/>
 </fidelity>
 </start-exi>
-</rpc>
+</rpc>
\ No newline at end of file
index 170c753993f174d5aeeba66ca7e157ec5a7ad757..7f1fe849e81e41ee7585660395e5443f451f0483 100644 (file)
@@ -1,3 +1,3 @@
 <rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <stop-exi xmlns="urn:ietf:params:xml:ns:netconf:exi:1.0"/>
-</rpc>
+</rpc>
\ No newline at end of file