Update to MD-SAL APIs 68/1768/3
authorTony Tkacik <ttkacik@cisco.com>
Wed, 9 Oct 2013 10:51:17 +0000 (12:51 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 9 Oct 2013 15:24:08 +0000 (15:24 +0000)
Introduced new Common APIs from which Binding-Aware and Binding-Independent
APIs are derived, this allows to maintain similar contract between
sal-binding-api and sal-dom-api which provides different access to MD SAL.

 - Fixed typos in YANG models
 - Bumped version of YANG Maven Plugin to 0.5.9-SNAPSHOT which now enforces
   valid YANG models
 - Removed OFPort.yang - Part of that model should be part of flow-node-inventory.yang
 - Removed spaces and tabs from various files
 - Updated implementations to adhere to new API definitions.

Change-Id: I5661a76398e8c8d82250de532aef6e5d268123e8
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
93 files changed:
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-management/pom.xml [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-management/src/main/yang/flow-config.yang [moved from opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-config.yang with 50% similarity]
opendaylight/md-sal/model/model-flow-service/src/main/yang/meter-service.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/statistics-types.yang
opendaylight/md-sal/model/model-inventory/src/main/yang/OFPort.yang [deleted file]
opendaylight/md-sal/model/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareBroker.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/BindingAwareProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataBrokerService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataChangeEvent.java [deleted file]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataChangeListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java [deleted file]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModification.java [deleted file]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModificationTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataValidator.java [deleted file]
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/RuntimeDataProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountService.java
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeHelper.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/BrokerImplClassLoader.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BrokerActivator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/OsgiProviderContext.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcServiceRegistrationImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/_DataBrokerImpl.xtend [deleted file]
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/DelegateProxy.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRouter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/RpcRoutingTable.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/package-info.java [deleted file]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/Grouping.java
opendaylight/md-sal/sal-common-api/pom.xml
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/TransactionStatus.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChange.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeEvent.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangePublisher.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataCommitHandler.java [moved from opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataCommitHandler.java with 60% similarity]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModificationTransactionFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvisionService.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataReader.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationSubscriptionService.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/MutableRoutingTable.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChange.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutedRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutingTable.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/pom.xml [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java [new file with mode: 0644]
opendaylight/md-sal/sal-compability/pom.xml
opendaylight/md-sal/sal-dom-api/pom.xml
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractConsumer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractProvider.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataBrokerService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataChangeListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataModificationTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataProviderService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountService.java [new file with mode: 0644]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationPublishService.java [moved from opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationProviderService.java with 90% similarity]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/notify/NotificationService.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ConsumerContextImpl.xtend
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerModule.java [deleted file]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataConsumerServiceImpl.xtend [new file with mode: 0644]
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/ProviderContextImpl.xtend
opendaylight/md-sal/sal-dom-spi/pom.xml
opendaylight/md-sal/samples/toaster-it/pom.xml
opendaylight/md-sal/samples/toaster-it/src/test/java/org/opendaylight/controller/sample/toaster/it/ToasterTest.java
opendaylight/md-sal/samples/toaster-provider/pom.xml
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java

index e259296..f718621 100644 (file)
           <artifactId>sal-core-spi</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-binding-api</artifactId>
           <artifactId>concepts</artifactId>
           <version>${concepts.version}</version>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.yangtools</groupId>
+          <artifactId>concepts</artifactId>
+          <version>0.1.1-SNAPSHOT</version>
+        </dependency>
 
         <!-- config
         <dependency>
     <dependency>
      <groupId>org.opendaylight.yangtools</groupId>
      <artifactId>yang-binding</artifactId>
+     <version>0.6.0-SNAPSHOT</version>
     </dependency>
     <dependency>
      <groupId>org.opendaylight.yangtools</groupId>
index e0f60e4..b335b32 100644 (file)
@@ -152,12 +152,14 @@ module opendaylight-group-types {
             }
             
             uses group-types;
-            type capabilities {
-                enum select-weight;
-                enum select-liveness;
-                enum chaining;
-                enum chaining-checks;
-            }   
+            leaf capabilities { 
+                type enumeration {
+                    enum select-weight;
+                    enum select-liveness;
+                    enum chaining;
+                    enum chaining-checks;
+                }   
+            }
 
             leaf-list max-groups {
                 type uint32;
diff --git a/opendaylight/md-sal/model/model-flow-management/pom.xml b/opendaylight/md-sal/model/model-flow-management/pom.xml
new file mode 100644 (file)
index 0000000..1a0c370
--- /dev/null
@@ -0,0 +1,36 @@
+<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">
+
+    <parent>
+        <artifactId>model-parent</artifactId>
+        <groupId>org.opendaylight.controller.model</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <scm>
+      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+    </scm>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>model-flow-management</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>model-flow-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>model-inventory</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>opendaylight-l2-types</artifactId>
+            <version>2013.08.27.0</version>
+        </dependency>
+    </dependencies>
+    <packaging>bundle</packaging>
+</project>
@@ -1,14 +1,23 @@
-module sal-flow-config {
+module flow-management {
     namespace "urn:opendaylight:flow:config";
     prefix flow-cfg;
 
-    import sal-flow {prefix flow;}
+    import yang-ext {prefix ext;}
+    import opendaylight-inventory {prefix inv;}
+    import opendaylight-flow-types {prefix flow;}
 
     revision "2013-08-19" {
         description "Initial revision of flow service";
     }
 
 
+    grouping flow-entry {
+        leaf node {
+            type inv:node-ref;
+        }
+        uses flow:flow;
+    }
+
     container flows {
         list flow {
             key "id";
@@ -16,11 +25,7 @@ module sal-flow-config {
             leaf id {
                 type string;
             }
-            uses flow:node-flow;
-            /**
-                container match;
-            
-            **/
+            uses flow:flow-entry;
         }
     }
 }
\ No newline at end of file
index f9cbd64..efc2582 100644 (file)
@@ -11,7 +11,7 @@ module sal-meter {
         description "Initial revision of meter service";
     }        
     
-    metering node-meter {
+    grouping node-meter {
         leaf node {
             type inv:node-ref;
         }
@@ -20,7 +20,7 @@ module sal-meter {
     }
 
     /** Base configuration structure **/
-    metering meter-update {
+    grouping meter-update {
         container original-meter {
             uses meter-type:meter;
         }
index f5c07ed..de91ffd 100644 (file)
@@ -4,7 +4,7 @@ module opendaylight-statistics-types {
 
     import ietf-yang-types {prefix yang;}
     import opendaylight-inventory {prefix inv;}
-    import opendaylight-port-inventory {prefix port-inv;}
+    //import opendaylight-port-inventory {prefix port-inv;}
     
     revision "2013-09-25" {
         description "Initial revision of flow service";
@@ -61,8 +61,4 @@ module opendaylight-statistics-types {
             }
         }
     }
-    
-    grouping ofp-port-description {
-        uses port-inv:ofp-port;
-    }
 }
\ No newline at end of file
diff --git a/opendaylight/md-sal/model/model-inventory/src/main/yang/OFPort.yang b/opendaylight/md-sal/model/model-inventory/src/main/yang/OFPort.yang
deleted file mode 100644 (file)
index a16926e..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-module opendaylight-port-inventory {
-    namespace "urn:opendaylight:port:inventory";
-    prefix portInv;
-
-    import yang-ext {prefix ext;}
-    import ietf-inet-types {prefix inet;}
-    import ietf-yang-types {prefix yang;}
-    import opendaylight-inventory {prefix inv;}
-
-    revision "2013-09-25" {
-        description "Initial revision of Port Inventory model";
-    }
-
-    typedef node-connector-Id {
-        type instance-identifier;
-    }
-    
-    grouping ofp-port-config {
-        leaf port-config {
-            type enumeration {
-                enum OFPPC_PORT_DOWN;
-                enum OFFPC_NO_RECV;
-                enum OFFPC_NO_FWD;
-                enum OFPPC_NO_PACKET_IN;
-            }
-        }
-    }
-    
-    grouping ofp-port-state {
-        leaf port-state {
-            type enumeration {
-                enum OFPPS_LINK_DOWN;
-                enum OFPPS_BLOCKED;
-                enum OFFPS_LIVE;
-            }
-        }
-    }
-    
-    grouping ofp-port-features {
-        leaf port-features {
-            type enumeration {
-                enum OFPPF_10MB_HD;
-                enum OFPPF_10MB_FD;
-                enum OFPPF_100MB_HD;
-                enum OFPPF_100MB_FD;
-                enum OFPPF_1GB_HD;
-                enum OFPPF_1GB_FD;
-                enum OFPPF_10GB_FD;
-                enum OFPPF_40GB_FD;
-                enum OFPPF_100GB_FD;
-                enum OFPPF_1TB_FD;
-                enum OFPPF_OTHER;
-                enum OFPPF_COPPER;
-                enum OFPPF_FIBER;
-                enum OFPPF_AUTOENG;
-                enum OFPPF_PAUSE;
-                enum OFPPF_PAUSE_ASYM;
-            }
-        }
-    }
-    
-    grouping common-port {
-        leaf port_no {
-            type node-connector-Id;
-        }
-        
-        leaf-list hw_addr {
-            type uint8;
-            description "MAC Address of the port";
-            max-elements 6;
-        }
-        
-        leaf config {
-            type uint32;
-            description "Bit map of OFPPC_* flags"            
-        }
-        
-        leaf advertised {
-            type uint32;
-            description "Features being advertised by the port"            
-        }
-    }
-    
-    grouping ofp-port {
-        key "port-order";
-        leaf port-order {
-            type uint32;
-        }      
-        
-        uses common-port;
-        
-        leaf name {
-            type string;
-            description "Human readable name of the port";
-            length 16;
-        }
-        
-        leaf state {
-            type uint32;
-            description "Bit map of OFPPS_* flags"            
-        }
-        
-        leaf curr {
-            type uint32;
-            description "Bit map of OFPPF_* flags"            
-        }       
-        
-        leaf supported {
-            type uint32;
-            description "Features supported by the port"            
-        }
-        
-        leaf peer {
-            type uint32;
-            description "Features advertised by peer"            
-        }
-        
-        leaf curr_speed {
-            type uint32;
-            description "Current port bit rate in kbps"            
-        }
-        
-        leaf max_speed {
-            type uint32;
-            description "Max port bit rate in kbps"            
-        }
-    }    
-    
-    grouping ofp-port-mod {
-        key "port-mod-order";
-        leaf port-mod-order {
-            type uint32;
-        }    
-        
-        uses group-port;
-        
-        leaf mask {
-            type uint32;
-            description "Bitmap of OFPPC_* flags to be changed"
-        }        
-    }
-}
\ No newline at end of file
index 268cc6f..23c25ea 100644 (file)
@@ -15,7 +15,6 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.opendaylight.controller.model</groupId>
     <artifactId>model-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>
@@ -28,7 +27,7 @@
         <module>model-flow-base</module>
         <module>model-flow-service</module>
         <module>model-flow-statistics</module>
-        <!-- <module>model-topology-bgp</module> -->
+        <module>model-flow-management</module>
     </modules>
 
     <build>
@@ -36,7 +35,6 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>${bundle.plugin.version}</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-binding</artifactId>
-            <version>${yang.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-common</artifactId>
-            <version>${yang.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>ietf-inet-types</artifactId>
-            <version>2010.09.24.0</version>
+            <version>2010.09.24.2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>ietf-yang-types</artifactId>
-            <version>2010.09.24.0</version>
+            <version>2010.09.24.2-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>yang-ext</artifactId>
-            <version>2013.09.07.0</version>
+            <version>2013.09.07.1-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
index 1ef55c6..54fd037 100644 (file)
     </scm>
 
     <modules>
+        <!--  Common APIs & Implementation -->
         <module>sal-common</module>
+        <module>sal-common-api</module>
+        <module>sal-common-impl</module>
         <module>sal-common-util</module>
+
         <!-- Binding Independent -->
         <module>sal-dom-api</module>
         <module>sal-dom-broker</module>
         <module>sal-dom-spi</module>
+
         <!-- Binding Aware -->
         <module>sal-binding-api</module>
         <module>sal-binding-broker</module>
+
         <!-- Samples -->
         <module>samples</module>
+
         <!-- Base Models -->
         <module>model</module>
+
         <!-- Compability Packages -->
         <module>sal-compability</module>
+
         <!-- Connectors -->
         <module>sal-connector-api</module>
         <module>sal-rest-connector</module>
@@ -45,8 +54,9 @@
 
         <!-- Dependency Versions -->
         <slf4j.version>1.7.2</slf4j.version>
-        <yang.version>0.5.8</yang.version>
-        <yang.codegen.version>0.5.8</yang.codegen.version>
+        <yang.version>0.5.9-SNAPSHOT</yang.version>
+        <yang.binding.version>0.6.0-SNAPSHOT</yang.binding.version>
+        <yang.codegen.version>0.6.0-SNAPSHOT</yang.codegen.version>
         <guava.version>14.0.1</guava.version>
         <osgi.core.version>5.0.0</osgi.core.version>
         <junit.version>4.8.1</junit.version>
                 <enabled>true</enabled>
             </releases>
         </pluginRepository>
+        <pluginRepository>
+            <id>opendaylight-snapshot</id>
+            <name>opendaylight-snapshot</name>
+            <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
+        </pluginRepository>
         <pluginRepository>
             <id>opendaylight.release</id>
             <name>opendaylight.release</name>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-binding</artifactId>
-                <version>${yang.version}</version>
+                <version>${yang.binding.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
                     <version>${bundle.plugin.version}</version>
                     <extensions>true</extensions>
-                    <executions>
+                    <!--executions>
                         <execution>
                             <id>bundle-manifest</id>
                             <phase>process-classes</phase>
                                 <goal>manifest</goal>
                             </goals>
                         </execution>
-                    </executions>
+                    </executions-->
                     <configuration>
                         <instructions>
                             <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
                         <manifestLocation>${project.basedir}/META-INF</manifestLocation>
                     </configuration>
                 </plugin>
-                <plugin>
-                    <artifactId>maven-jar-plugin</artifactId>
-                    <configuration>
-                        <archive>
-                            <!-- Bundle OSGi Manifest created by maven-bundle-plugin into jar file -->
-                            <manifestFile>${project.basedir}/META-INF/MANIFEST.MF</manifestFile>
-                        </archive>
-                    </configuration>
-                </plugin>
                 <plugin>
                     <groupId>org.eclipse.xtend</groupId>
                     <artifactId>xtend-maven-plugin</artifactId>
index 4c154c5..c1dccdf 100644 (file)
             <version>1.0-SNAPSHOT</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
index 3c95ed8..f6c9df2 100644 (file)
@@ -1,5 +1,13 @@
+/*
+ * 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.api;
 
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -8,21 +16,59 @@ public abstract class AbstractBindingAwareConsumer implements BindingAwareConsum
 
     @Override
     public final void start(BundleContext context) throws Exception {
+        startImpl(context);
         ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
         BindingAwareBroker broker = context.getService(brokerRef);
         broker.registerConsumer(this, context);
-        startImpl(context);
+        //context.ungetService(brokerRef);
     }
 
-    @Deprecated
+    /**
+     * Called when this bundle is started (before
+     * {@link #onSessionInitiated(ProviderContext)} so the Framework can perform
+     * the bundle-specific activities necessary to start this bundle. This
+     * method can be used to register services or to allocate any resources that
+     * this bundle needs.
+     * 
+     * <p>
+     * This method must complete and return to its caller in a timely manner.
+     * 
+     * @param context
+     *            The execution context of the bundle being started.
+     * @throws Exception
+     *             If this method throws an exception, this bundle is marked as
+     *             stopped and the Framework will remove this bundle's
+     *             listeners, unregister all services registered by this bundle,
+     *             and release all services used by this bundle.
+     */
     protected void startImpl(BundleContext context) {
-        
+        // NOOP
+    }
+
+    /**
+     * Called when this bundle is stopped so the Framework can perform the
+     * bundle-specific activities necessary to stop the bundle. In general, this
+     * method should undo the work that the {@code BundleActivator.start} method
+     * started. There should be no active threads that were started by this
+     * bundle when this bundle returns. A stopped bundle must not call any
+     * Framework objects.
+     * 
+     * <p>
+     * This method must complete and return to its caller in a timely manner.
+     * 
+     * @param context The execution context of the bundle being stopped.
+     * @throws Exception If this method throws an exception, the bundle is still
+     *         marked as stopped, and the Framework will remove the bundle's
+     *         listeners, unregister all services registered by the bundle, and
+     *         release all services used by the bundle.
+     */
+    protected void stopImpl(BundleContext context) {
+        // NOOP
     }
     
     @Override
     public final  void stop(BundleContext context) throws Exception {
-        // TODO Auto-generated method stub
-        
+        stopImpl(context);
     }
 
 }
index 994d3f4..b1a0fe0 100644 (file)
@@ -1,7 +1,16 @@
+/*
+ * 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.api;
 
 import java.util.Collection;
+import java.util.Collections;
 
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.osgi.framework.BundleActivator;
@@ -10,57 +19,132 @@ import org.osgi.framework.ServiceReference;
 
 public abstract class AbstractBindingAwareProvider implements BindingAwareProvider, BundleActivator {
 
+    /**
+     * Initializes the bundle.
+     * 
+     * Implementation of initialization get's the Binding Aware Broker from
+     * service registry and register itself as a {@link BindingAwareProvider}
+     * 
+     * Callback order is:
+     * <ol>
+     * <li>{@link #startImpl(BundleContext)}
+     * <li>{@link #onSessionInitiated(ProviderContext)}
+     * <li>Registration of global {@link RpcService} implementations returned by
+     * {@link #getImplementations()}
+     * <li>Registration of {@link ProviderFunctionality} implementations
+     * returned by {@link #getFunctionality()}
+     * </ol>
+     * 
+     */
     @Override
     public final void start(BundleContext context) throws Exception {
-            ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
-            BindingAwareBroker broker = context.getService(brokerRef);
-            
-            ProviderContext ctx = broker.registerProvider(this, context);
-            registerRpcImplementations(ctx);
-            registerFunctionality(ctx);
-            
-            startImpl(context);
+        startImpl(context);
+        ServiceReference<BindingAwareBroker> brokerRef = context.getServiceReference(BindingAwareBroker.class);
+        BindingAwareBroker broker = context.getService(brokerRef);
+
+        ProviderContext ctx = broker.registerProvider(this, context);
+        registerRpcImplementations(ctx);
+        registerFunctionality(ctx);
     }
-    
+
     private void registerFunctionality(ProviderContext ctx) {
         Collection<? extends ProviderFunctionality> functionality = this.getFunctionality();
-        if(functionality == null || functionality.isEmpty()) {
+        if (functionality == null || functionality.isEmpty()) {
             return;
         }
         for (ProviderFunctionality providerFunctionality : functionality) {
             ctx.registerFunctionality(providerFunctionality);
         }
-        
+
     }
 
     private void registerRpcImplementations(ProviderContext ctx) {
         Collection<? extends RpcService> rpcs = this.getImplementations();
-        if(rpcs == null || rpcs.isEmpty()) {
+        if (rpcs == null || rpcs.isEmpty()) {
             return;
         }
         for (RpcService rpcService : rpcs) {
-            //ctx.addRpcImplementation(type, implementation);
+            // ctx.addRpcImplementation(type, implementation);
         }
-        
+
     }
 
+    /**
+     * Called when this bundle is started (before
+     * {@link #onSessionInitiated(ProviderContext)} so the Framework can perform
+     * the bundle-specific activities necessary to start this bundle. This
+     * method can be used to register services or to allocate any resources that
+     * this bundle needs.
+     * 
+     * <p>
+     * This method must complete and return to its caller in a timely manner.
+     * 
+     * @param context
+     *            The execution context of the bundle being started.
+     * @throws Exception
+     *             If this method throws an exception, this bundle is marked as
+     *             stopped and the Framework will remove this bundle's
+     *             listeners, unregister all services registered by this bundle,
+     *             and release all services used by this bundle.
+     */
     protected void startImpl(BundleContext context) {
         // NOOP
     }
-    
+
+    /**
+     * Called when this bundle is stopped so the Framework can perform the
+     * bundle-specific activities necessary to stop the bundle. In general, this
+     * method should undo the work that the {@code BundleActivator.start} method
+     * started. There should be no active threads that were started by this
+     * bundle when this bundle returns. A stopped bundle must not call any
+     * Framework objects.
+     * 
+     * <p>
+     * This method must complete and return to its caller in a timely manner.
+     * 
+     * @param context The execution context of the bundle being stopped.
+     * @throws Exception If this method throws an exception, the bundle is still
+     *         marked as stopped, and the Framework will remove the bundle's
+     *         listeners, unregister all services registered by the bundle, and
+     *         release all services used by the bundle.
+     */
+    protected void stopImpl(BundleContext context) {
+        // NOOP
+    }
+
+    /**
+     * Bundle stop callback
+     * 
+     * 
+     * Custom implementation of bundle stop could be carried by overriding
+     * {@link #stopImpl(BundleContext)} method.
+     * 
+     */
     @Override
     public final void stop(BundleContext context) throws Exception {
-            
-            
+        stopImpl(context);
     }
-    
+
     @Override
     public Collection<? extends ProviderFunctionality> getFunctionality() {
-        return null;
+        return Collections.emptySet();
     }
-    
+
     @Override
     public Collection<? extends RpcService> getImplementations() {
-        return null;
+        return Collections.emptySet();
+    }
+    
+    /**
+     * Initialization of consumer context.
+     * 
+     * {@link ProviderContext} is replacement of {@link ConsumerContext}
+     * so this method is not needed in case of Provider.
+     * 
+     */
+    @Deprecated
+    @Override
+    public final void onSessionInitialized(ConsumerContext session) {
+        // NOOP
     }
 }
index 14db6e5..84e0561 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.sal.binding.api;
 
+import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
@@ -174,42 +176,43 @@ public interface BindingAwareBroker {
         <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
                 throws IllegalStateException;
 
-        <T extends RpcService> RpcRegistration<T> addMountRpcImplementation(Class<T> type,
-                InstanceIdentifier mount, T implementation) throws IllegalStateException;
+        <T extends RpcService> RpcRegistration<T> addMountRpcImplementation(Class<T> type, InstanceIdentifier<?> mount,
+                T implementation) throws IllegalStateException;
 
         <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
                 throws IllegalStateException;
-        
+
         void registerFunctionality(ProviderFunctionality functionality);
+
         void unregisterFunctionality(ProviderFunctionality functionality);
     }
 
-    public interface RpcRegistration<T extends RpcService> {
+    public interface RpcRegistration<T extends RpcService> extends Registration<T> {
 
         /**
          * 
          * @return instance for which registration does exists.
          */
+        @Deprecated
         T getService();
-
-        /**
-         * Unregister an RpcService from broker.
-         * 
-         */
-        void unregister();
     }
 
-    public interface RoutedRpcRegistration<T extends RpcService> extends RpcRegistration<T> {
+    public interface RoutedRpcRegistration<T extends RpcService> extends RpcRegistration<T>,
+            RoutedRegistration<Class<? extends BaseIdentity>, InstanceIdentifier<?>, T> {
 
         /**
          * Register particular instance identifier to be processed by this
          * RpcService
          * 
+         * Deprecated in favor of {@link RoutedRegistration#registerPath(Object, Object)}. 
+         * 
          * @param context
          * @param instance
          */
-        void registerInstance(Class<? extends BaseIdentity> context, InstanceIdentifier instance);
+        @Deprecated
+        void registerInstance(Class<? extends BaseIdentity> context, InstanceIdentifier<?> instance);
 
-        void unregisterInstance(Class<? extends BaseIdentity> context, InstanceIdentifier instance);
+        @Deprecated
+        void unregisterInstance(Class<? extends BaseIdentity> context, InstanceIdentifier<?> instance);
     }
 }
index 3641d76..120674f 100644 (file)
@@ -28,8 +28,6 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
  */
 public interface BindingAwareProvider {
 
-    void onSessionInitialized(ConsumerContext session);
-
     /**
      * Returns a set of provided implementations of YANG modules and their rpcs.
      * 
@@ -66,4 +64,6 @@ public interface BindingAwareProvider {
 
     void onSessionInitiated(ProviderContext session);
 
+    void onSessionInitialized(ConsumerContext session);
+
 }
index ccc7391..b3309b7 100644 (file)
@@ -1,6 +1,17 @@
+/*
+ * 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.api;
 
-public interface NotificationListener<T> {
+import java.util.EventListener;
+
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public interface NotificationListener<T extends Notification> extends EventListener {
 
     void onNotification(T notification);
 }
index 7052ab0..64aab6e 100644 (file)
@@ -9,11 +9,29 @@ package org.opendaylight.controller.sal.binding.api;
 
 import java.util.concurrent.ExecutorService;
 
+import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishService;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-public interface NotificationProviderService extends NotificationService {
+public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
 
+    @Deprecated
     void notify(Notification notification);
-    
+
+    @Deprecated
     void notify(Notification notification, ExecutorService service);
+
+    @Override
+    void publish(Notification notification);
+
+    @Override
+    void publish(Notification notification, ExecutorService service);
+    
+    @Override
+    public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
+            Class<T> notificationType, NotificationListener<T> listener);
+    
+    @Override
+    public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
+            org.opendaylight.yangtools.yang.binding.NotificationListener listener);
 }
index 38bf7a1..922acb9 100644 (file)
@@ -7,12 +7,28 @@
  */
 package org.opendaylight.controller.sal.binding.api;
 
+import org.opendaylight.controller.md.sal.common.api.notify.NotificationSubscriptionService;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public interface NotificationService extends BindingAwareService {
 
+    @Deprecated
     <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
+
+    @Deprecated
     void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
+
+    @Deprecated
     void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener);
+
+    @Deprecated
     <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
+
+    <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
+            Class<T> notificationType, NotificationListener<T> listener);
+
+
+    Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
+            org.opendaylight.yangtools.yang.binding.NotificationListener listener);
 }
index 7ee6c65..50ee740 100644 (file)
@@ -9,6 +9,9 @@ package org.opendaylight.controller.sal.binding.api.data;
 
 import java.util.concurrent.Future;
 
+import org.opendaylight.controller.md.sal.common.api.data.DataChangePublisher;
+import org.opendaylight.controller.md.sal.common.api.data.DataModificationTransactionFactory;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.binding.api.BindingAwareService;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -23,7 +26,11 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
  * 
  * @see DataProviderService
  */
-public interface DataBrokerService extends BindingAwareService {
+public interface DataBrokerService extends //
+        BindingAwareService, //
+        DataModificationTransactionFactory<InstanceIdentifier<? extends DataObject>, DataObject>, //
+        DataReader<InstanceIdentifier<? extends DataObject>, DataObject>, //
+        DataChangePublisher<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> {
 
     /**
      * Returns a data from specified Data Store.
@@ -36,6 +43,7 @@ public interface DataBrokerService extends BindingAwareService {
      *            Identifier of the store, from which will be data retrieved
      * @return data visible to the consumer
      */
+    @Deprecated
     <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
 
     /**
@@ -139,21 +147,22 @@ public interface DataBrokerService extends BindingAwareService {
     @Deprecated
     Future<RpcResult<Void>> commit(DataStoreIdentifier store);
 
-    
-    DataObject getData(InstanceIdentifier data);
-
-    DataObject getConfigurationData(InstanceIdentifier data);
+    @Deprecated
+    DataObject getData(InstanceIdentifier<? extends DataObject> data);
 
-    
+    @Deprecated
+    DataObject getConfigurationData(InstanceIdentifier<?> data);
     /**
      * Creates a data modification transaction.
      * 
      * @return new blank data modification transaction.
      */
-    DataModification beginTransaction();
+    DataModificationTransaction beginTransaction();
 
-    public void registerChangeListener(InstanceIdentifier path, DataChangeListener changeListener);
-    
-    public void unregisterChangeListener(InstanceIdentifier path, DataChangeListener changeListener);
+    @Deprecated
+    public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);
+
+    @Deprecated
+    public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener);
 
 }
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataChangeEvent.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataChangeEvent.java
deleted file mode 100644 (file)
index bbe328e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.opendaylight.controller.sal.binding.api.data;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public interface DataChangeEvent {
-
-    Map<InstanceIdentifier, DataObject> getCreated();
-
-    Map<InstanceIdentifier, DataObject> getUpdated();
-
-    Set<InstanceIdentifier> getRemoved();
-}
index 63f9a9c..6373cfb 100644 (file)
@@ -1,8 +1,19 @@
+/*
+ * 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.api.data;
 
-public interface DataChangeListener {
+import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-    
-    void onDataChange(DataChangeEvent event);
-    
+public interface DataChangeListener extends
+        org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<InstanceIdentifier<? extends DataObject>, DataObject> {
+
+    @Override
+    public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change);
 }
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java
deleted file mode 100644 (file)
index 5f550c2..0000000
+++ /dev/null
@@ -1,177 +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.api.data;
-
-import java.util.Set;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-/**
- * Two phase commit handler (cohort) of the two-phase commit protocol of data.
- * 
- * <p>
- * The provider should expose the implementation of DataCommitHandler if it's
- * functionality depends on any subset of data stored in data repositories, in
- * order to participate in {@link DataBrokerService#commit(DataStoreIdentifier)
- * operation.
- * 
- * <p>
- * Operations of two-phase commit handlers should not change data in data store,
- * this is responsibility of the coordinator (broker or some component of the
- * broker).
- * 
- * The commit handlers are responsible for changing the internal state of the
- * provider to reflect the commited changes in data.
- * 
- * <h3>Two-phase commit</h3>
- * 
- * <h4>Commit Request Phase</h4>
- * 
- * <ol>
- * <li> <code>Consumer</code> edits data by invocation of
- * <code>DataBrokerService.editCandidateData(DataStoreIdentifier, DataRoot)</code>
- * <li> <code>Consumer</code> starts a commit by invoking
- * <code>DataBrokerService.commit(DataStoreIdentifier)</code>
- * <li> <code>Broker</code> retrieves a list of all registered
- * <code>DataCommitHandlers</code>
- * <li>For each <code>DataCommitHandler</code>
- * <ol>
- * <li><code>Broker</code> invokes a
- * <code>DataCommitHandler.requestCommit(DataStoreIdentifier)</code> operation.
- * <li><code>DataCommitHandler</code> returns a <code>RpcResult</code> with
- * <code>CommitTransaction</code>
- * <li>If the result was successful, broker adds <code>CommitTransaction</code>
- * to the list of opened transactions. If not, brokers stops a commit request
- * phase and starts a rollback phase.
- * </ol>
- * <li><code>Broker</code> starts a commit finish phase
- * </ol>
- * 
- * <h4>Commit Finish Phase</h4>
- * 
- * <ol>
- * <li>For each <code>CommitTransaction</code> from Commit Request phase
- * <ol>
- * <li><code>Broker</code> broker invokes a
- * <code>CommitTransaction.finish()</code>
- * <li>The provider finishes a commit (applies the change) and returns an
- * <code>RpcResult</code>.
- * </ol>
- * <li>
- * <ul>
- * <li>If all returned results means successful, the brokers end two-phase
- * commit by returning a success commit result to the Consumer.
- * <li>If error occured, the broker starts a commit rollback phase.
- * </ul>
- * </ol>
- * 
- * <h4>Commit Rollback Phase</h4>
- * <li>For each <code>CommitTransaction</code> from Commit Request phase
- * <ol>
- * <li><code>Broker</code>
- * broker invokes a {@link CommitTransaction#finish()}
- * <li>The provider rollbacks a commit and returns an {@link RpcResult} of
- * rollback. </ol>
- * <li>Broker returns a error result to the consumer.
- * 
- * 
- * <h3>Registration of functionality</h3>
- * The registration could be done by :
- * <ul>
- * <li>returning an instance of implementation in the return value of
- * {@link Provider#getProviderFunctionality()}
- * <li>passing an instance of implementation and {@link DataStoreIdentifier} of
- * rpc as arguments to the
- * {@link DataProviderService#addCommitHandler(DataStoreIdentifier, DataCommitHandler)}
- * </ul>
- * 
- * 
- * 
- */
-public interface DataCommitHandler extends ProviderFunctionality {
-    /**
-     * A set of Data Stores supported by implementation.
-     * 
-     * The set of {@link DataStoreIdentifier}s which identifies target data
-     * stores which are supported by this commit handler. This set is used, when
-     * {@link Provider} is registered to the SAL, to register and expose the
-     * commit handler functionality to affected data stores.
-     * 
-     * @return Set of Data Store identifiers
-     */
-    @Deprecated
-    Set<DataStoreIdentifier> getSupportedDataStores();
-
-    /**
-     * The provider (commit handler) starts a commit transaction.
-     * 
-     * <p>
-     * The commit handler (provider) prepares an commit scenario, rollback
-     * scenario and validates data.
-     * 
-     * <p>
-     * If the provider is aware that at this point the commit would not be
-     * successful, the transaction is not created, but list of errors which
-     * prevented the start of transaction are returned.
-     * 
-     * @param store
-     * @return Transaction object representing this commit, errors otherwise.
-     */
-    @Deprecated
-    RpcResult<CommitTransaction> requestCommit(DataStoreIdentifier store);
-
-    
-    RpcResult<CommitTransaction> requestCommit(DataModification modification);
-    
-    public interface CommitTransaction {
-        /**
-         * 
-         * @return Data store affected by the transaction
-         */
-        @Deprecated
-        DataStoreIdentifier getDataStore();
-
-        /**
-         * Returns a modification transaction which is the source of this
-         * commit transaction.
-         * 
-         */
-        DataModification getModification();
-        
-        /**
-         * Returns the handler associated with this transaction.
-         * 
-         * @return Handler
-         */
-        DataCommitHandler getHandler();
-
-        /**
-         * 
-         * Finishes a commit.
-         * 
-         * The provider (commit handler) should apply all changes to its state
-         * which are a result of data change-
-         * 
-         * @return
-         */
-        RpcResult<Void> finish() throws IllegalStateException;
-
-        /**
-         * Rollbacks a commit.
-         * 
-         * @return
-         * @throws IllegalStateException
-         *             If the method is invoked after {@link #finish()}
-         */
-        RpcResult<Void> rollback() throws IllegalStateException;
-    }
-
-}
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModification.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModification.java
deleted file mode 100644 (file)
index 4506caf..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.opendaylight.controller.sal.binding.api.data;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-public interface DataModification {
-    
-    /**
-     * Returns transaction identifier
-     * 
-     * @return Transaction identifier
-     */
-    Object getIdentifier();
-    
-    TransactionStatus getStatus();
-    
-    /**
-     * Reads data from overal data storage which includes
-     * runtime and configuration data.
-     * 
-     * @param path
-     * @return
-     */
-    DataObject read(InstanceIdentifier path);
-    
-    /**
-     * Reads data from configuration data storage.
-     * 
-     * @param path Instance identifier which 
-     * @return
-     */
-    DataObject readConfiguration(InstanceIdentifier path);
-    
-    void putRuntimeData(InstanceIdentifier path,DataObject data);
-    void putConfigurationData(InstanceIdentifier path,DataObject data);
-    void removeRuntimeData(InstanceIdentifier path);
-    void removeConfigurationData(InstanceIdentifier path);
-
-
-    Map<InstanceIdentifier,DataObject> getRuntimeDataUpdates();
-    Map<InstanceIdentifier,DataObject> getConfigurationDataUpdates();
-    Set<InstanceIdentifier> getRemovals();
-    Set<InstanceIdentifier> getConfigurationRemovals();
-    
-    /**
-     * Commits transaction to be stored in global data repository.
-     * 
-     * 
-     * @return  Future object which returns RpcResult with TransactionStatus 
-     *          when transaction is processed by store.
-     */
-    Future<RpcResult<TransactionStatus>> commit();
-    
-    void registerListener(DataTransactionListener listener);
-    void unregisterListener(DataTransactionListener listener);
-    
-    public enum TransactionStatus {
-        
-        UNSUBMITTED,
-        COMMITING,
-        COMMITED,
-        FAILED,
-        CANCELED
-    }
-    
-    public interface DataTransactionListener {
-        
-        void onStatusUpdated(DataModification transaction,TransactionStatus status);
-        
-    }
-}
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModificationTransaction.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModificationTransaction.java
new file mode 100644 (file)
index 0000000..4f69f0b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.api.data;
+
+import java.util.EventListener;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface DataModificationTransaction extends DataModification<InstanceIdentifier<? extends DataObject>, DataObject> {
+
+    ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener);
+
+
+    //FIXME: After 0.6 Release of YANG-Binding
+    //public <T extends DataObject> T readOperationalData(InstanceIdentifier<T> path);
+    //public <T extends DataObject> T readConfigurationData(InstanceIdentifier<T> path);
+
+    public interface DataTransactionListener extends EventListener {
+        void onStatusUpdated(DataModificationTransaction transaction,TransactionStatus status);
+    }
+}
index 1057c30..32b1d93 100644 (file)
@@ -7,73 +7,13 @@
  */
 package org.opendaylight.controller.sal.binding.api.data;
 
-import java.util.Map;
-import java.util.Set;
 
+import org.opendaylight.controller.md.sal.common.api.data.DataProvisionService;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public interface DataProviderService extends DataBrokerService {
 
-    /**
-     * Adds {@link DataValidator} for specified Data Store
-     * 
-     * @param store
-     *            Data Store
-     * @param validator
-     *            Validator
-     */
-    @Deprecated
-    public void addValidator(DataStoreIdentifier store, DataValidator validator);
-
-    /**
-     * Removes {@link DataValidator} from specified Data Store
-     * 
-     * @param store
-     * @param validator
-     *            Validator
-     */
-    
-    @Deprecated
-    public void removeValidator(DataStoreIdentifier store, DataValidator validator);
-
-    /**
-     * Adds {@link DataCommitHandler} for specified data store
-     * 
-     * @param store
-     * @param provider
-     */
-    @Deprecated
-    void addCommitHandler(DataStoreIdentifier store, DataCommitHandler provider);
-
-    /**
-     * Removes {@link DataCommitHandler} from specified data store
-     * 
-     * @param store
-     * @param provider
-     */
-    @Deprecated
-    void removeCommitHandler(DataStoreIdentifier store, DataCommitHandler provider);
-
-    /**
-     * Adds {@link DataRefresher} for specified data store
-     * 
-     * @param store
-     * @param refresher
-     */
-    void addRefresher(DataStoreIdentifier store, DataRefresher refresher);
-
-    /**
-     * Removes {@link DataRefresher} from specified data store
-     * 
-     * @param store
-     * @param refresher
-     */
-    void removeRefresher(DataStoreIdentifier store, DataRefresher refresher);
-
-    public void registerCommitHandler(InstanceIdentifier path, DataCommitHandler commitHandler);
-    
-    public void registerValidator(InstanceIdentifier path, DataValidator validator);
+public interface DataProviderService extends DataBrokerService, DataProvisionService<InstanceIdentifier<? extends DataObject>, DataObject> {
 
 }
diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataValidator.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataValidator.java
deleted file mode 100644 (file)
index 8099600..0000000
+++ /dev/null
@@ -1,18 +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.api.data;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.yangtools.yang.binding.DataRoot;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-public interface DataValidator extends ProviderFunctionality {
-
-    RpcResult<Void> validate(DataRoot data);
-}
index 68a2b29..f711659 100644 (file)
@@ -1,56 +1,23 @@
+/*
+ * 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.api.data;
 
 import java.util.Set;
 
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public interface RuntimeDataProvider extends ProviderFunctionality {
-
-    Set<DataStoreIdentifier> getSupportedStores();
-    
-    
-    Set<Class<? extends DataRoot>> getProvidedDataRoots();
+public interface RuntimeDataProvider extends ProviderFunctionality,DataReader<InstanceIdentifier<? extends DataObject>, DataObject> {
     
     
-    /**
-     * Returns a data from specified Data Store.
-     * 
-     * Returns all the data visible to the consumer from specified Data Store.
-     * 
-     * @param <T>
-     *            Interface generated from YANG module representing root of data
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @return data visible to the consumer
-     */
-    <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType);
 
-    /**
-     * Returns a filtered subset of data from specified Data Store.
-     * 
-     * <p>
-     * The filter is modeled as an hierarchy of Java TOs starting with
-     * implementation of {@link DataRoot} representing data root. The semantics
-     * of the filter tree is the same as filter semantics defined in the NETCONF
-     * protocol for rpc operations <code>get</code> and <code>get-config</code>
-     * in Section 6 of RFC6241.
-     * 
-     * 
-     * @see http://tools.ietf.org/html/rfc6241#section-6
-     * @param <T>
-     *            Interface generated from YANG module representing root of data
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @param filter
-     *            Data tree filter similar to the NETCONF filter
-     * @return
-     */
-    <T extends DataRoot> T getData(DataStoreIdentifier store, T filter);
-    
-    
-     <T extends DataObject> T getData(Class<T> dataType, InstanceIdentifier identifier);
 }
index 9fa918f..1644c40 100644 (file)
@@ -12,6 +12,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public interface MountService extends BindingAwareService {
 
-    MountInstance getMountPoint(InstanceIdentifier path);
+    MountInstance getMountPoint(InstanceIdentifier<?> path);
 
 }
index e0721df..34c5643 100644 (file)
             <artifactId>sal-common-util</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-binding-api</artifactId>
index 9f7e05c..0d78109 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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;
 
 import org.opendaylight.controller.sal.binding.spi.DelegateProxy;
index 6bdb3c8..2e73977 100644 (file)
@@ -45,16 +45,16 @@ class RuntimeCodeHelper {
             throw new IllegalArgumentException("delegate class is not assignable to proxy");
     }
 
-    public static def Map<InstanceIdentifier, ? extends RpcService> getRoutingTable(RpcService target,
+    public static def Map<InstanceIdentifier<?>, ? extends RpcService> getRoutingTable(RpcService target,
         Class<? extends BaseIdentity> tableClass) {
         val field = target.class.getField(tableClass.routingTableField)
         if (field == null) throw new UnsupportedOperationException(
             "Unable to get routing table. Table field does not exists");
-        return field.get(target) as Map<InstanceIdentifier, ? extends RpcService>;
+        return field.get(target) as Map<InstanceIdentifier<? extends Object>, ? extends RpcService>;
     }
 
     public static def void setRoutingTable(RpcService target, Class<? extends BaseIdentity> tableClass,
-        Map<InstanceIdentifier, ? extends RpcService> routingTable) {
+        Map<InstanceIdentifier<?>, ? extends RpcService> routingTable) {
          val field = target.class.getField(tableClass.routingTableField)
         if (field == null) throw new UnsupportedOperationException(
             "Unable to set routing table. Table field does not exists");
index 522102b..6481c9d 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.lang.ClassLoader
index 8a3d2c0..ff8cefe 100644 (file)
@@ -39,6 +39,7 @@ class BindingAwareBrokerImpl implements BindingAwareBroker {
     private var RuntimeCodeGenerator generator;
     private Map<Class<? extends RpcService>, RpcProxyContext> managedProxies = new HashMap();
     private var NotificationBrokerImpl notifyBroker
+    private var DataBrokerImpl dataBroker
     private var ServiceRegistration<NotificationProviderService> notifyBrokerRegistration
 
     @Property
@@ -126,7 +127,7 @@ class BindingAwareBrokerImpl implements BindingAwareBroker {
         return new RpcServiceRegistrationImpl<T>(type, service, osgiReg);
     }
 
-    def <T extends RpcService> RpcRegistration<T> registerMountedRpcImplementation(Class<T> tyoe, T service, InstanceIdentifier identifier,
+    def <T extends RpcService> RpcRegistration<T> registerMountedRpcImplementation(Class<T> tyoe, T service, InstanceIdentifier<?> identifier,
         OsgiProviderContext context, Hashtable<String, String> properties) {
         throw new UnsupportedOperationException("TODO: auto-generated method stub")
     }
index c5d54ec..9a5cbff 100644 (file)
@@ -18,28 +18,27 @@ import org.slf4j.LoggerFactory;
 
 public class BrokerActivator implements BundleActivator {
 
-       private static final Logger log = LoggerFactory.getLogger(BrokerActivator.class);
-       private BindingAwareBrokerImpl baSal;
-       private ServiceRegistration<BindingAwareBroker> baSalRegistration;
-       
-       
-       @Override
-       public void start(BundleContext context) throws Exception {
-               log.info("Binding Aware Broker initialized");
-               baSal = new BindingAwareBrokerImpl();
-               baSal.setBrokerBundleContext(context);
-               baSal.start();
-               
-               BindingAwareBroker baSalService = baSal;
-               Hashtable<String, String> properties = new Hashtable<>();
-               this.baSalRegistration = context.registerService(BindingAwareBroker.class,baSalService, properties);
-               
-       }
-
-       @Override
-       public void stop(BundleContext context) throws Exception {
-               log.info("Binding Aware Broker stopped");
-               baSalRegistration.unregister();
-       }
+    private static final Logger log = LoggerFactory.getLogger(BrokerActivator.class);
+    private BindingAwareBrokerImpl baSal;
+    private ServiceRegistration<BindingAwareBroker> baSalRegistration;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        log.info("Binding Aware Broker initialized");
+        baSal = new BindingAwareBrokerImpl();
+        baSal.setBrokerBundleContext(context);
+        baSal.start();
+
+        BindingAwareBroker baSalService = baSal;
+        Hashtable<String, String> properties = new Hashtable<>();
+        this.baSalRegistration = context.registerService(BindingAwareBroker.class, baSalService, properties);
+
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        log.info("Binding Aware Broker stopped");
+        baSalRegistration.unregister();
+    }
 
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.xtend
new file mode 100644 (file)
index 0000000..99afbab
--- /dev/null
@@ -0,0 +1,67 @@
+package org.opendaylight.controller.sal.binding.impl
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.controller.sal.common.DataStoreIdentifier
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.DataRoot
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class DataBrokerImpl implements DataProviderService {
+
+    override beginTransaction() {
+    }
+
+    override commit(DataStoreIdentifier store) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override <T extends DataRoot> getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override getConfigurationData(InstanceIdentifier<?> data) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override <T extends DataRoot> getData(DataStoreIdentifier store, Class<T> rootType) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
+        throw new UnsupportedOperationException("Deprecated")
+    }
+
+    override getData(InstanceIdentifier<? extends DataObject> path) {
+        return readOperationalData(path);
+    }
+
+    override readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
+    }
+
+    override readOperationalData(InstanceIdentifier<? extends DataObject> path) {
+    }
+
+    override registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
+    }
+
+    override registerCommitHandler(InstanceIdentifier<? extends DataObject> path,
+        DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> commitHandler) {
+    }
+
+    override registerDataChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
+    }
+
+    override unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
+    }
+
+}
index 8b0400f..377d12e 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.sal.binding.api.NotificationListener
 import com.google.common.collect.HashMultimap
 import java.util.concurrent.ExecutorService
 import java.util.Collection
+import org.opendaylight.yangtools.concepts.Registration
 
 class NotificationBrokerImpl implements NotificationProviderService {
 
@@ -36,9 +37,7 @@ class NotificationBrokerImpl implements NotificationProviderService {
     }
 
     override notify(Notification notification) {
-        notification.notificationTypes.forEach [
-            listeners.get(it as Class<? extends Notification>)?.notifyAll(notification)
-        ]
+        publish(notification)
     }
 
     def getNotificationTypes(Notification notification) {
@@ -49,17 +48,65 @@ class NotificationBrokerImpl implements NotificationProviderService {
     def notifyAll(Collection<NotificationListener<?>> listeners, Notification notification) {
         listeners.forEach[(it as NotificationListener).onNotification(notification)]
     }
-    
+
     override addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         throw new UnsupportedOperationException("TODO: auto-generated method stub")
-        
+
     }
-    
+
     override removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         throw new UnsupportedOperationException("TODO: auto-generated method stub")
     }
-    
+
     override notify(Notification notification, ExecutorService service) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        publish(notification)
+    }
+
+    override publish(Notification notification) {
+        notification.notificationTypes.forEach [
+            listeners.get(it as Class<? extends Notification>)?.notifyAll(notification)
+        ]
+    }
+
+    override publish(Notification notification, ExecutorService service) {
+        publish(notification)
+    }
+
+    override <T extends Notification> registerNotificationListener(Class<T> notificationType,
+        NotificationListener<T> listener) {
+        val reg = new GenericNotificationRegistration<T>(notificationType,listener,this);
+        listeners.put(notificationType,listener);
+        return reg;
+    }
+
+    override registerNotificationListener(
+        org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+            
+    }
+    
+    
+    protected def unregisterListener(GenericNotificationRegistration<?> reg) {
+        listeners.remove(reg.type,reg.instance);
+    }
+}
+class GenericNotificationRegistration<T extends Notification> implements Registration<NotificationListener<T>> {
+    
+    @Property
+    var NotificationListener<T> instance;
+    
+    @Property
+    val Class<T> type;
+    
+    
+    val NotificationBrokerImpl notificationBroker;
+    
+    public new(Class<T> type, NotificationListener<T> instance,NotificationBrokerImpl broker) {
+        _instance = instance;
+        _type = type;
+        notificationBroker = broker;
+    }
+    
+    override close() {
+        notificationBroker.unregisterListener(this);
     }
 }
index 494118b..29c3845 100644 (file)
@@ -43,7 +43,7 @@ class OsgiProviderContext extends OsgiConsumerContext implements ProviderContext
         return salReg;
     }
 
-    override <T extends RpcService> addMountRpcImplementation(Class<T> type, InstanceIdentifier mount, T implementation) throws IllegalStateException {
+    override <T extends RpcService> addMountRpcImplementation(Class<T> type, InstanceIdentifier<?> mount, T implementation) throws IllegalStateException {
 
         val properties = new Hashtable<String, String>();
         properties.salServiceType = SAL_SERVICE_TYPE_PROVIDER
index 5b31b5f..3169471 100644 (file)
@@ -26,8 +26,12 @@ class RpcServiceRegistrationImpl<T extends RpcService> implements RpcRegistratio
     override getService() {
         this.service
     }
+    
+    override getInstance() {
+        this.service
+    }
 
-    override unregister() {
+    override close() {
         throw new UnsupportedOperationException("TODO: auto-generated method stub")
     }
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/_DataBrokerImpl.xtend b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/_DataBrokerImpl.xtend
deleted file mode 100644 (file)
index 5975144..0000000
+++ /dev/null
@@ -1,108 +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.impl
-
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-import org.opendaylight.controller.sal.common.DataStoreIdentifier
-import org.opendaylight.yangtools.yang.binding.DataRoot
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataCommitHandler
-import org.opendaylight.controller.sal.binding.api.data.DataRefresher
-import org.opendaylight.controller.sal.binding.api.data.DataValidator
-import org.opendaylight.yangtools.yang.common.RpcResult
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider
-import java.util.Map
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener
-
-class _DataBrokerImpl implements DataProviderService {
-
-    Map<DataStoreIdentifier, DataProviderContext> dataProviders;
-    var DataProviderContext defaultDataProvider;
-
-    override <T extends DataRoot> getData(DataStoreIdentifier store, Class<T> rootType) {
-        val dataStore = resolveProvider(store, rootType);
-        return dataStore.provider.getData(store, rootType);
-    }
-
-    override <T extends DataRoot> getData(DataStoreIdentifier store, T filter) {
-    }
-
-    override <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    override <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub");
-    }
-
-    override commit(DataStoreIdentifier store) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override addCommitHandler(DataStoreIdentifier store, DataCommitHandler provider) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override addRefresher(DataStoreIdentifier store, DataRefresher refresher) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override addValidator(DataStoreIdentifier store, DataValidator validator) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override removeRefresher(DataStoreIdentifier store, DataRefresher refresher) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    override removeCommitHandler(DataStoreIdentifier store, DataCommitHandler provider) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
-    }
-
-    override removeValidator(DataStoreIdentifier store, DataValidator validator) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-    def DataProviderContext resolveProvider(DataStoreIdentifier store, Class<? extends DataRoot> root) {
-    }
-    
-    override beginTransaction() {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override getConfigurationData(InstanceIdentifier data) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override getData(InstanceIdentifier data) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override registerCommitHandler(InstanceIdentifier path, DataCommitHandler commitHandler) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override registerValidator(InstanceIdentifier path, DataValidator validator) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override registerChangeListener(InstanceIdentifier path, DataChangeListener changeListener) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-    
-    override unregisterChangeListener(InstanceIdentifier path, DataChangeListener changeListener) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
-}
index 085228c..e34ee28 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.spi;
 
 public interface DelegateProxy<T> {
index 360f039..b7a42ed 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.spi;
 
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
@@ -44,7 +51,7 @@ public interface RpcRouter<T extends RpcService> {
      * @return instance of RpcService which is responsible for processing
      *         particular path.
      */
-    T getService(Class<? extends BaseIdentity> context, InstanceIdentifier path);
+    T getService(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path);
 
     /**
      * Returns a default fallback instance of RpcService which is responsible
index f2d3825..4d9d51b 100644 (file)
@@ -1,38 +1,52 @@
+/*
+ * 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.spi;
 
 import java.util.Map;
 
+import org.opendaylight.controller.md.sal.common.api.routing.MutableRoutingTable;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-public interface RpcRoutingTable<C extends BaseIdentity,S extends RpcService> {
+public interface RpcRoutingTable<C extends BaseIdentity, S extends RpcService> extends
+        MutableRoutingTable<Class<? extends C>, InstanceIdentifier<?>, S> {
+
+    Class<C> getIdentifier();
 
-    Class<C> getContextIdentifier();
-    
     /**
-     * Updates route for particular path to specified instance of {@link RpcService}. 
+     * Updates route for particular path to specified instance of
+     * {@link RpcService}.
      * 
-     * @param path Path for which RpcService routing is to be updated
-     * @param service Instance of RpcService which is responsible for processing Rpc Requests.
+     * @param path
+     *            Path for which RpcService routing is to be updated
+     * @param service
+     *            Instance of RpcService which is responsible for processing Rpc
+     *            Requests.
      */
-    void updateRoute(InstanceIdentifier path,S service);
-    
+    void updateRoute(InstanceIdentifier<?> path, S service);
+
     /**
      * Deletes a route for particular path
      * 
-     * @param path Path for which 
+     * @param path
+     *            Path for which
      */
-    void deleteRoute(InstanceIdentifier path);
-    
+    void removeRoute(InstanceIdentifier<?> path);
+
     /**
      * 
      */
-    S getService(InstanceIdentifier nodeInstance);
-    
+    S getRoute(InstanceIdentifier<?> nodeInstance);
+
     /**
      * 
      * @return
      */
-    Map<InstanceIdentifier,S> getRoutes();
+    Map<InstanceIdentifier<?>, S> getRoutes();
 }
diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/package-info.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/spi/package-info.java
deleted file mode 100644 (file)
index 774571b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * 
- */
-/**
- * @author ttkacik
- *
- */
-package org.opendaylight.controller.sal.binding.spi;
\ No newline at end of file
index 5dddd1a..b483d35 100644 (file)
@@ -9,7 +9,9 @@ import javassist.ClassPool;
 
 import org.junit.Before;
 import org.junit.Test;
+
 import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
+
 import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.test.mock.FooService;
 import org.opendaylight.controller.sal.binding.test.mock.ReferencableObject;
@@ -17,6 +19,7 @@ import org.opendaylight.controller.sal.binding.test.mock.ReferencableObjectKey;
 import org.opendaylight.controller.sal.binding.test.mock.SimpleInput;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
@@ -51,7 +54,7 @@ public class RuntimeCodeGeneratorTest {
     }
 
     private void verifyRouting(FooService product) {
-        Map<InstanceIdentifier,FooService> routingTable = new HashMap<>();
+        Map<InstanceIdentifier<? extends Object>,FooService> routingTable = new HashMap<>();
         setRoutingTable(product, BaseIdentity.class, routingTable);
         
         assertSame("Returned routing table should be same instance",routingTable,getRoutingTable(product, BaseIdentity.class));
@@ -59,14 +62,14 @@ public class RuntimeCodeGeneratorTest {
         int servicesCount = 2;
         int instancesPerService = 3;
         
-        InstanceIdentifier[][] identifiers = identifiers(servicesCount,instancesPerService);
+        InstanceIdentifier<?>[][] identifiers = identifiers(servicesCount,instancesPerService);
         FooService service[] = new FooService[] {
                 mock(FooService.class, "Instance 0"),
                 mock(FooService.class,"Instance 1")
         };
         
         for(int i = 0;i<service.length;i++) {
-            for (InstanceIdentifier instance : identifiers[i]) {
+            for (InstanceIdentifier<?> instance : identifiers[i]) {
                 routingTable.put(instance, service[i]);
             }
         }
@@ -100,12 +103,12 @@ public class RuntimeCodeGeneratorTest {
         verify(service[1]).simple(instance_1_input[0]);
     }
 
-    private InstanceIdentifier[][] identifiers(int serviceSize, int instancesPerService) {
-        InstanceIdentifier[][] ret = new InstanceIdentifier[serviceSize][];
+    private InstanceIdentifier<?>[][] identifiers(int serviceSize, int instancesPerService) {
+        InstanceIdentifier<?>[][] ret = new InstanceIdentifier[serviceSize][];
         int service = 0;
         for (int i = 0;i<serviceSize;i++) {
             
-            InstanceIdentifier[] instanceIdentifiers = new InstanceIdentifier[instancesPerService];
+            InstanceIdentifier<?>[] instanceIdentifiers = new InstanceIdentifier[instancesPerService];
             ret[i] = instanceIdentifiers;
             for(int id = 0;id<instancesPerService;id++) {
                 instanceIdentifiers[id] = referencableIdentifier(service*instancesPerService+id);
@@ -116,16 +119,16 @@ public class RuntimeCodeGeneratorTest {
         return ret;
     }
 
-    private InstanceIdentifier referencableIdentifier(int i) {
+    private InstanceIdentifier<?> referencableIdentifier(int i) {
         ReferencableObjectKey key = new ReferencableObjectKey(i);
         IdentifiableItem<ReferencableObject,ReferencableObjectKey> pathArg = new IdentifiableItem<>(ReferencableObject.class,key);
-        return new InstanceIdentifier(Arrays.<PathArgument>asList(pathArg), ReferencableObject.class);
+        return new InstanceIdentifier<ReferencableObject>(Arrays.<PathArgument>asList(pathArg), ReferencableObject.class);
     }
 
     private static class SimpleInputImpl implements SimpleInput {
-        private final InstanceIdentifier identifier;
+        private final InstanceIdentifier<?> identifier;
 
-        public SimpleInputImpl(InstanceIdentifier _identifier) {
+        public SimpleInputImpl(InstanceIdentifier<?> _identifier) {
             this.identifier = _identifier;
         }
 
@@ -135,7 +138,7 @@ public class RuntimeCodeGeneratorTest {
         }
 
         @Override
-        public InstanceIdentifier getIdentifier() {
+        public InstanceIdentifier<?> getIdentifier() {
             return this.identifier;
         }
     }
index 86624e0..2fa89ab 100644 (file)
@@ -7,5 +7,5 @@ import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
 public interface Grouping {
 
     @RoutingContext(BaseIdentity.class)
-    InstanceIdentifier getInheritedIdentifier();
+    InstanceIdentifier<?> getInheritedIdentifier();
 }
index 280d5ec..0ce8520 100644 (file)
     </scm>
 
     <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>concepts</artifactId>
-            <version>0.1.0</version>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-common</artifactId>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-common</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>concepts</artifactId>
+            <version>0.1.1-SNAPSHOT</version>
+        </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
             <version>5.0.0</version>
         </dependency>
     </dependencies>
+    <packaging>bundle</packaging>
 </project>
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/TransactionStatus.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/TransactionStatus.java
new file mode 100644 (file)
index 0000000..92ff551
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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.md.sal.common.api;
+
+public enum TransactionStatus {
+    NEW,
+    SUBMITED,
+    COMMITED,
+    FAILED,
+    CANCELED
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChange.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChange.java
new file mode 100644 (file)
index 0000000..0fea50b
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * 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.md.sal.common.api.data;
+
+import java.util.Map;
+import java.util.Set;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+
+public interface DataChange<P/* extends Path<P> */,D> {
+
+    Map<P,D> getCreatedOperationalData();
+
+    Map<P,D> getUpdatedOperationalData();
+
+    Set<P> getRemovedOperationalData();
+
+    Map<P,D> getCreatedConfigurationData();
+
+    Map<P,D> getUpdatedConfigurationData();
+
+    Set<P> getRemovedConfigurationData();
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeEvent.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeEvent.java
new file mode 100644 (file)
index 0000000..5905413
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * 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.md.sal.common.api.data;
+
+import org.opendaylight.yangtools.concepts.Immutable;
+
+public interface DataChangeEvent<P,D> extends DataChange<P, D>, Immutable {
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeListener.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangeListener.java
new file mode 100644 (file)
index 0000000..8b87139
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * 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.md.sal.common.api.data;
+
+import java.util.EventListener;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface DataChangeListener<P/* extends Path<P> */,D> extends EventListener {
+
+    void onDataChanged(DataChangeEvent<P, D> change);
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangePublisher.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangePublisher.java
new file mode 100644 (file)
index 0000000..1700411
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.md.sal.common.api.data;
+
+
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.concepts.Registration;
+
+public interface DataChangePublisher<P/* extends Path<P> */,D, L extends DataChangeListener<P,D>> {
+
+    ListenerRegistration<L> registerDataChangeListener(P path, L listener);
+
+}
@@ -5,15 +5,12 @@
  * 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.core.api.data;
-
-import java.util.Set;
+package org.opendaylight.controller.md.sal.common.api.data;
 
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.controller.sal.core.api.Provider;
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-
-
 /**
  * Two phase commit handler (cohort) of the two-phase commit protocol of data.
  * 
@@ -37,7 +34,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
  * 
  * <ol>
  * <li> <code>Consumer</code> edits data by invocation of
- * <code>DataBrokerService.editCandidateData(DataStoreIdentifier, CompositeNodeModification)</code>
+ * <code>DataBrokerService.editCandidateData(DataStoreIdentifier, DataRoot)</code>
  * <li> <code>Consumer</code> starts a commit by invoking
  * <code>DataBrokerService.commit(DataStoreIdentifier)</code>
  * <li> <code>Broker</code> retrieves a list of all registered
@@ -74,77 +71,35 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
  * </ol>
  * 
  * <h4>Commit Rollback Phase</h4>
- * <li>For each <code>CommitTransaction</code> from Commit Request phase
+ * <li>For each <code>DataCommitTransaction</code> from Commit Request phase
  * <ol>
  * <li><code>Broker</code>
- * 
- * broker invokes a {@link CommitTransaction#finish()}
+ * broker invokes a {@link DataCommitTransaction#finish()}
  * <li>The provider rollbacks a commit and returns an {@link RpcResult} of
  * rollback. </ol>
  * <li>Broker returns a error result to the consumer.
  * 
- * 
- * <h3>Registration of functionality</h3>
- * The registration could be done by :
- * <ul>
- * <li>returning an instance of implementation in the return value of
- * {@link Provider#getProviderFunctionality()}
- * <li>passing an instance of implementation and {@link DataStoreIdentifier} of
- * rpc as arguments to the
- * {@link DataProviderService#addCommitHandler(DataStoreIdentifier, DataCommitHandler)}
- * </ul>
- * 
- * 
+ * @param <P> Class representing a path
+ * @param <D> Superclass from which all data objects are derived from.
  */
-public interface DataCommitHandler extends Provider.ProviderFunctionality {
+public interface DataCommitHandler<P/* extends Path<P> */,D> {
 
-    /**
-     * A set of Data Stores supported by implementation.
-     * 
-     * The set of {@link DataStoreIdentifier}s which identifies target data
-     * stores which are supported by this commit handler. This set is used, when
-     * {@link Provider} is registered to the SAL, to register and expose the
-     * commit handler functionality to affected data stores.
-     * 
-     * @return Set of Data Store identifiers
-     */
-    Set<DataStoreIdentifier> getSupportedDataStores();
 
-    /**
-     * The provider (commit handler) starts a commit transaction.
-     * 
-     * <p>
-     * The commit handler (provider) prepares an commit scenario, rollback
-     * scenario and validates data.
-     * 
-     * <p>
-     * If the provider is aware that at this point the commit would not be
-     * successful, the transaction is not created, but list of errors which
-     * prevented the start of transaction are returned.
-     * 
-     * @param store
-     * @return Transaction object representing this commit, errors otherwise.
-     */
-    RpcResult<CommitTransaction> requestCommit(DataStoreIdentifier store);
+    DataCommitTransaction<P, D> requestCommit(DataModification<P,D> modification);
 
-    public interface CommitTransaction {
-        /**
-         * 
-         * @return Data store affected by the transaction
-         */
-        DataStoreIdentifier getDataStore();
+    public interface DataCommitTransaction<P/* extends Path<P> */,D> {
 
-        /**
-         * Returns the handler associated with this transaction.
-         * 
-         * @return Handler
-         */
-        DataCommitHandler getHandler();
+        DataModification<P,D> getModification();
 
         /**
          * 
          * Finishes a commit.
          * 
+         * This callback is invoked by commit coordinator to finish commit action.
+         * 
+         * The implementation is required to finish transaction or return unsuccessful
+         * rpc result if something went wrong.
+         * 
          * The provider (commit handler) should apply all changes to its state
          * which are a result of data change-
          * 
@@ -155,10 +110,16 @@ public interface DataCommitHandler extends Provider.ProviderFunctionality {
         /**
          * Rollbacks a commit.
          * 
+         * This callback is invoked by commit coordinator to finish commit action.
+         * 
+         * The provider (commit handler) should rollback all changes to its state
+         * which were a result of previous request commit.
+         * 
          * @return
          * @throws IllegalStateException
          *             If the method is invoked after {@link #finish()}
          */
         RpcResult<Void> rollback() throws IllegalStateException;
     }
+
 }
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
new file mode 100644 (file)
index 0000000..1ab7c34
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.md.sal.common.api.data;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public interface DataModification<P/* extends Path<P> */, D> extends DataReader<P, D> {
+
+    /**
+     * Returns transaction identifier
+     * 
+     * @return Transaction identifier
+     */
+    Object getIdentifier();
+
+    TransactionStatus getStatus();
+
+    void putRuntimeData(P path, D data);
+
+    void putConfigurationData(P path, D data);
+
+    void removeRuntimeData(P path);
+
+    void removeConfigurationData(P path);
+
+    public Map<P, D> getUpdatedConfigurationData();
+
+    public Map<P, D> getUpdatedOperationalData();
+
+    public Set<P> getRemovedConfigurationData();
+
+    public Set<P> getRemovedOperationalData();
+
+    /**
+     * Initiates a two-phase commit of modification.
+     * 
+     * <p>
+     * The successful commit changes the state of the system and may affect
+     * several components.
+     * 
+     * <p>
+     * The effects of successful commit of data are described in the
+     * specifications and YANG models describing the Provider components of
+     * controller. It is assumed that Consumer has an understanding of this
+     * changes.
+     * 
+     * 
+     * @see DataCommitHandler for further information how two-phase commit is
+     *      processed.
+     * @param store
+     *            Identifier of the store, where commit should occur.
+     * @return Result of the Commit, containing success information or list of
+     *         encountered errors, if commit was not successful. The Future
+     *         blocks until {@link TransactionStatus#COMMITED} or
+     *         {@link TransactionStatus#FAILED} is reached.
+     */
+    Future<RpcResult<TransactionStatus>> commit();
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModificationTransactionFactory.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModificationTransactionFactory.java
new file mode 100644 (file)
index 0000000..64d90f6
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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.md.sal.common.api.data;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface DataModificationTransactionFactory<P/* extends Path<P> */,D> {
+
+    DataModification<P, D> beginTransaction();
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvider.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvider.java
new file mode 100644 (file)
index 0000000..6c108bf
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * 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.md.sal.common.api.data;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface DataProvider<P/* extends Path<P> */,D> extends DataReader<P, D> {
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvisionService.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataProvisionService.java
new file mode 100644 (file)
index 0000000..264d076
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * 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.md.sal.common.api.data;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.concepts.Registration;
+
+
+public interface DataProvisionService<P/* extends Path<P> */, D> {
+
+    public Registration<DataCommitHandler<P, D>> registerCommitHandler(P path, DataCommitHandler<P, D> commitHandler);
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataReader.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataReader.java
new file mode 100644 (file)
index 0000000..ff1703f
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.md.sal.common.api.data;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface DataReader<P/* extends Path<P> */,D> {
+
+    /**
+     * Reads data from Operational data store located at provided path
+     * 
+     * @param path Path to data
+     * @return
+     */
+    D readOperationalData(P path);
+
+    D readConfigurationData(P path);
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationPublishService.java
new file mode 100644 (file)
index 0000000..6a906c5
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.md.sal.common.api.notify;
+
+import java.util.concurrent.ExecutorService;
+
+public interface NotificationPublishService<N> {
+
+    void publish(N notification);
+    
+    void publish(N notification,ExecutorService executor);
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationSubscriptionService.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/notify/NotificationSubscriptionService.java
new file mode 100644 (file)
index 0000000..bfca8f8
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * 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.md.sal.common.api.notify;
+
+import org.opendaylight.yangtools.concepts.Registration;
+
+public interface NotificationSubscriptionService<T,N,L> {
+
+    Registration<L> registerNotificationListener(T type,L listener);
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/MutableRoutingTable.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/MutableRoutingTable.java
new file mode 100644 (file)
index 0000000..1139d03
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * 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.md.sal.common.api.routing;
+
+import org.opendaylight.yangtools.concepts.Mutable;
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface MutableRoutingTable<C,P/* extends Path<P> */,T> extends RoutingTable<C,P,T>, Mutable {
+    
+    void setDefaultRoute(T target);
+    void updateRoute(P path,T target);
+    void removeRoute(P path);
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChange.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RouteChange.java
new file mode 100644 (file)
index 0000000..5f84ec5
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.md.sal.common.api.routing;
+
+import java.util.Map;
+import java.util.Set;
+
+public interface RouteChange<C,P> {
+
+    Map<C,Set<P>> getRemovals();
+    Map<C,Set<P>> getAnnouncements();
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutedRegistration.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutedRegistration.java
new file mode 100644 (file)
index 0000000..37ec2f6
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * 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.md.sal.common.api.routing;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+import org.opendaylight.yangtools.concepts.Registration;
+
+public interface RoutedRegistration<C,P/* extends Path<P> */,S> extends Registration<S> {
+
+    void registerPath(C context, P path);
+    void unregisterPath(C context, P path);
+
+}
diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutingTable.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/routing/RoutingTable.java
new file mode 100644 (file)
index 0000000..211cf18
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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.md.sal.common.api.routing;
+
+import java.util.Map;
+
+// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+// import org.opendaylight.yangtools.concepts.Path;
+
+public interface RoutingTable<C,P/* extends Path<P> */,T> {
+
+    C getIdentifier();
+    
+    T getDefaultRoute();
+    
+    Map<P,T> getRoutes();
+    
+    T getRoute(P path);
+}
diff --git a/opendaylight/md-sal/sal-common-impl/pom.xml b/opendaylight/md-sal/sal-common-impl/pom.xml
new file mode 100644 (file)
index 0000000..8da8f24
--- /dev/null
@@ -0,0 +1,28 @@
+<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>
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>sal-common-impl</artifactId>
+    <scm>
+        <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+        <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+    </dependencies>
+    <packaging>bundle</packaging>
+</project>
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataChange.java
new file mode 100644 (file)
index 0000000..f0e8624
--- /dev/null
@@ -0,0 +1,58 @@
+package org.opendaylight.controller.md.sal.common.impl;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.md.sal.common.api.data.DataChange;
+import org.opendaylight.yangtools.concepts.Path;
+
+public abstract class AbstractDataChange<P extends Path<P>, D> implements DataChange<P, D> {
+
+    private final Map<P, D> createdCfg;
+    private final Map<P, D> createdOperational;
+    private final Set<P> removedCfg;
+    private final Set<P> removedOperational;
+    private final Map<P, D> updatedCfg;
+    private final Map<P, D> updatedOperational;
+
+    public AbstractDataChange(Map<P, D> createdCfg, Map<P, D> createdOperational, Set<P> removedCfg,
+            Set<P> removedOperational, Map<P, D> updatedCfg, Map<P, D> updatedOperational) {
+        this.createdCfg = createdCfg;
+        this.createdOperational =  createdOperational;
+        this.removedCfg =  (removedCfg);
+        this.removedOperational =  (removedOperational);
+        this.updatedCfg =  (updatedCfg);
+        this.updatedOperational =  (updatedOperational);
+    }
+
+    @Override
+    public final Map<P, D> getCreatedConfigurationData() {
+        return this.createdCfg;
+    }
+
+    @Override
+    public final Map<P, D> getCreatedOperationalData() {
+        return this.createdOperational;
+    }
+
+    @Override
+    public final Set<P> getRemovedConfigurationData() {
+        return this.removedCfg;
+    }
+
+    @Override
+    public final Set<P> getRemovedOperationalData() {
+        return this.removedOperational;
+    }
+
+    @Override
+    public final Map<P, D> getUpdatedConfigurationData() {
+        return this.updatedCfg;
+    }
+
+    @Override
+    public final Map<P, D> getUpdatedOperationalData() {
+        return this.updatedOperational;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractDataModification.java
new file mode 100644 (file)
index 0000000..e786b74
--- /dev/null
@@ -0,0 +1,99 @@
+package org.opendaylight.controller.md.sal.common.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.yangtools.concepts.Path;
+
+import static org.opendaylight.controller.md.sal.common.api.TransactionStatus.NEW;
+
+public abstract class AbstractDataModification<P extends Path<P>, D> implements DataModification<P, D>  {
+
+    private final Map<P,D> configurationUpdate;
+    private final Map<P,D> operationalUpdate;
+
+    private final Set<P> configurationRemove;
+    private final Set<P> operationalRemove;
+   
+    private final Map<P, D> unmodifiable_configurationUpdate;
+    private final Map<P, D> unmodifiable_operationalUpdate;
+    private final Set<P> unmodifiable_configurationRemove;
+    private final Set<P> unmodifiable_OperationalRemove;
+
+    
+
+    public AbstractDataModification(Map<P, D> configurationUpdate, Map<P, D> operationalUpdate,
+            Set<P> configurationRemove, Set<P> operationalRemove) {
+        this.configurationUpdate = configurationUpdate;
+        this.operationalUpdate = operationalUpdate;
+        this.configurationRemove = configurationRemove;
+        this.operationalRemove = operationalRemove;
+        
+        unmodifiable_configurationUpdate = Collections.unmodifiableMap(configurationUpdate);
+        unmodifiable_operationalUpdate = Collections.unmodifiableMap(operationalUpdate);
+        unmodifiable_configurationRemove = Collections.unmodifiableSet(configurationRemove);
+        unmodifiable_OperationalRemove = Collections.unmodifiableSet(operationalRemove);
+    }
+    
+    public AbstractDataModification() {
+        this(new HashMap<P,D>(), new HashMap<P,D>(), new HashSet<P>(), new HashSet<P>());
+    }
+
+    @Override
+    public final void putConfigurationData(P path, D data) {
+        checkMutable();
+        configurationUpdate.put(path, data);
+        configurationRemove.remove(path);
+    }
+    
+    @Override
+    public final void putRuntimeData(P path, D data) {
+        checkMutable();
+        operationalUpdate.put(path, data);
+        operationalRemove.remove(path);
+    }
+    
+    @Override
+    public final void removeRuntimeData(P path) {
+        checkMutable();
+        operationalUpdate.remove(path);
+        operationalRemove.add(path);
+    }
+    
+    @Override
+    public final void removeConfigurationData(P path) {
+        checkMutable();
+        configurationUpdate.remove(path);
+        configurationRemove.add(path);
+    }
+
+    private final void checkMutable() {
+        if(!NEW.equals(this.getStatus())) throw new IllegalStateException("Transaction was already submitted");
+    }
+
+    @Override
+    public Map<P, D> getUpdatedConfigurationData() {
+        
+        return unmodifiable_configurationUpdate;
+    }
+
+    @Override
+    public Map<P, D> getUpdatedOperationalData() {
+        return unmodifiable_operationalUpdate;
+    }
+
+    @Override
+    public Set<P> getRemovedConfigurationData() {
+        return unmodifiable_configurationRemove;
+    }
+    
+    @Override
+    public Set<P> getRemovedOperationalData() {
+        return unmodifiable_OperationalRemove;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRegistration.java
new file mode 100644 (file)
index 0000000..4bda399
--- /dev/null
@@ -0,0 +1,20 @@
+package org.opendaylight.controller.md.sal.common.impl;
+
+import org.opendaylight.yangtools.concepts.Registration;
+
+public abstract class AbstractRegistration<T> implements Registration<T> {
+
+
+    private final T instance;
+
+    public AbstractRegistration(T instance) {
+        super();
+        this.instance = instance;
+    }
+
+    @Override
+    public final T getInstance() {
+        return instance;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java b/opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/AbstractRoutedRegistration.java
new file mode 100644 (file)
index 0000000..4fe1566
--- /dev/null
@@ -0,0 +1,12 @@
+package org.opendaylight.controller.md.sal.common.impl;
+
+import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration;
+import org.opendaylight.yangtools.concepts.Path;
+
+public abstract class AbstractRoutedRegistration<C, P extends Path<P>, S> extends AbstractRegistration<S> implements
+        RoutedRegistration<C, P, S> {
+
+    public AbstractRoutedRegistration(S instance) {
+        super(instance);
+    }
+}
index 3d16794..3f70e66 100644 (file)
@@ -54,4 +54,5 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <packaging>bundle</packaging>
 </project>
index b9aedbe..ca923f6 100644 (file)
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-api</artifactId>
+            <version>0.5.9-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-api</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
@@ -34,4 +40,5 @@
             <version>5.0.0</version>
         </dependency>
     </dependencies>
+    <packaging>bundle</packaging>
 </project>
index 5e13aad..1fb73bc 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.core.api;
 
 import java.util.Collection;
@@ -13,25 +20,30 @@ public abstract class AbstractConsumer implements Consumer, BundleActivator {
     ServiceReference<Broker> brokerRef;
     @Override
     public final void start(BundleContext context) throws Exception {
+        this.startImpl(context);
         brokerRef = context.getServiceReference(Broker.class);
         broker = context.getService(brokerRef);
-
-        this.startImpl(context);
-
         broker.registerConsumer(this,context);
     }
 
-    public abstract void startImpl(BundleContext context);
+
 
     @Override
     public final void stop(BundleContext context) throws Exception {
+        stopImpl(context);
         broker = null;
         if(brokerRef != null) {
             context.ungetService(brokerRef);
         }
     }
 
-    
+    protected void startImpl(BundleContext context) {
+        // NOOP
+    }
+    protected void stopImpl(BundleContext context) {
+        // NOOP
+    }
+
     @Override
     public Collection<ConsumerFunctionality> getConsumerFunctionality() {
         return Collections.emptySet();
index c25b2f9..621ef92 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * 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.core.api;
 
 import java.util.Collection;
@@ -28,12 +35,16 @@ public abstract class AbstractProvider implements BundleActivator, Provider {
         broker.registerProvider(this,context);
     }
 
-    public abstract void startImpl(BundleContext context);
+    protected void startImpl(BundleContext context) {
+        // NOOP
+    }
+    protected void stopImpl(BundleContext context) {
+        // NOOP
+    }
 
     @Override
     public final void stop(BundleContext context) throws Exception {
-        // TODO Auto-generated method stub
-
+        stopImpl(context);
     }
 
 }
index b2c3550..632a874 100644 (file)
@@ -9,16 +9,18 @@ package org.opendaylight.controller.sal.core.api;
 
 import java.util.concurrent.Future;
 
+import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration;
 import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.core.api.data.DataProviderService;
-import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
 import org.opendaylight.controller.sal.core.api.notify.NotificationService;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.osgi.framework.BundleContext;
 
-
 /**
  * Core component of the SAL layer responsible for wiring the SAL consumers.
  * 
@@ -36,7 +38,7 @@ import org.osgi.framework.BundleContext;
  * {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)} and
  * {@link RpcImplementation}
  * <li>Notification Service - see {@link NotificationService} and
- * {@link NotificationProviderService}
+ * {@link NotificationPublishService}
  * <li>Functionality and Data model
  * <li>Data Store access and modification - see {@link DataBrokerService} and
  * {@link DataProviderService}
@@ -78,7 +80,7 @@ public interface Broker {
      * 
      * @param cons
      *            Consumer to be registered.
-     * @param context 
+     * @param context
      * @return a session specific to consumer registration
      * @throws IllegalArgumentException
      *             If the consumer is <code>null</code>.
@@ -110,7 +112,7 @@ public interface Broker {
      * 
      * @param prov
      *            Provider to be registered.
-     * @param context 
+     * @param context
      * @return a session unique to the provider registration.
      * @throws IllegalArgumentException
      *             If the provider is <code>null</code>.
@@ -132,7 +134,7 @@ public interface Broker {
      * infrastructure services and other functionality provided by
      * {@link Provider}s.
      * 
-
+     * 
      * 
      */
     public interface ConsumerSession {
@@ -208,22 +210,12 @@ public interface Broker {
          * @throws IllegalArgumentException
          *             If the name of RPC is invalid
          */
-        void addRpcImplementation(QName rpcType,
-                RpcImplementation implementation)
+        RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
                 throws IllegalArgumentException;
 
-        /**
-         * Unregisters an Rpc implementation
-         * 
-         * @param rpcType
-         *            Name of Rpc
-         * @param implementation
-         *            Registered Implementation of the Rpc functionality
-         * @throws IllegalArgumentException
-         */
-        void removeRpcImplementation(QName rpcType,
-                RpcImplementation implementation)
-                throws IllegalArgumentException;
+        RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation);
+
+        RoutedRpcRegistration addMountedRpcImplementation(QName rpcType, RpcImplementation implementation);
 
         /**
          * Closes a session between provider and SAL.
@@ -238,4 +230,12 @@ public interface Broker {
         @Override
         boolean isClosed();
     }
+
+    public interface RpcRegistration extends Registration<RpcImplementation> {
+        QName getType();
+    }
+
+    public interface RoutedRpcRegistration extends RpcRegistration,
+            RoutedRegistration<QName, InstanceIdentifier, RpcImplementation> {
+    }
 }
index fef894b..2d5f4b2 100644 (file)
@@ -7,17 +7,12 @@
  */
 package org.opendaylight.controller.sal.core.api.data;
 
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.controller.md.sal.common.api.data.DataChangePublisher;
+import org.opendaylight.controller.md.sal.common.api.data.DataModificationTransactionFactory;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Consumer;
-import org.opendaylight.controller.sal.core.api.Provider;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
-import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 
 
 /**
@@ -28,109 +23,18 @@ import org.opendaylight.yangtools.yang.data.api.Node;
  * @see DataProviderService
  * 
  */
-public interface DataBrokerService extends BrokerService {
-
-    
-    Set<DataStoreIdentifier> getDataStores();
-    
-    /**
-     * Returns a data from specified Data Store.
-     * 
-     * Returns all the data visible to the consumer from specified Data Store.
-     * 
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @return data visible to the consumer
-     */
-    CompositeNode getData(DataStoreIdentifier store);
-
-    /**
-     * Returns a filtered subset of data from specified Data Store.
-     * 
-     * <p>
-     * The filter is modeled as an hierarchy of {@link Node} starting with
-     * {@link CompositeNode} representing data root. The semantics of the filter
-     * tree is the same as filter semantics defined in the NETCONF protocol for
-     * rpc operations <code>get</code> and <code>get-config</code> in Section 6
-     * of RFC6241.
-     * 
-     * 
-     * @see http://tools.ietf.org/html/rfc6241#section-6
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @param filter
-     *            Data tree filter similar to the NETCONF filter
-     * @return
-     */
-    CompositeNode getData(DataStoreIdentifier store, CompositeNode filter);
+public interface DataBrokerService extends 
+    BrokerService, //
+    DataReader<InstanceIdentifier, CompositeNode>, //
+    DataModificationTransactionFactory<InstanceIdentifier, CompositeNode>, //
+    DataChangePublisher<InstanceIdentifier, CompositeNode, DataChangeListener> {
 
-    /**
-     * Returns a candidate data which are not yet commited.
-     * 
-     * 
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @return
-     */
-    CompositeNode getCandidateData(DataStoreIdentifier store);
 
-    /**
-     * Returns a filtered subset of candidate data from specified Data Store.
-     * 
-     * <p>
-     * The filter is modeled as an hierarchy of {@link Node} starting with
-     * {@link CompositeNode} representing data root. The semantics of the filter
-     * tree is the same as filter semantics defined in the NETCONF protocol for
-     * rpc operations <code>get</code> and <code>get-config</code> in Section 6
-     * of RFC6241.
-     * 
-     * 
-     * @see http://tools.ietf.org/html/rfc6241#section-6
-     * @param store
-     *            Identifier of the store, from which will be data retrieved
-     * @param filter
-     *            A CompositeNode filter
-     * @return
-     */
-    CompositeNode getCandidateData(DataStoreIdentifier store,
-            CompositeNode filter);
+    @Override
+    public CompositeNode readConfigurationData(InstanceIdentifier path);
 
-    /**
-     * 
-     * @param store
-     *            Identifier of the store, in which will be the candidate data
-     *            modified
-     * @param changeSet
-     *            Modification of data tree.
-     * @return Result object containing the modified data tree if the operation
-     *         was successful, otherwise list of the encountered errors.
-     */
-    RpcResult<CompositeNode> editCandidateData(DataStoreIdentifier store,
-            MutableCompositeNode changeSet);
+    @Override
+    public CompositeNode readOperationalData(InstanceIdentifier path);
 
-    /**
-     * Initiates a two-phase commit of candidate data.
-     * 
-     * <p>
-     * The {@link Consumer} could initiate a commit of candidate data
-     * 
-     * <p>
-     * The successful commit changes the state of the system and may affect
-     * several components.
-     * 
-     * <p>
-     * The effects of successful commit of data are described in the
-     * specifications and YANG models describing the {@link Provider} components
-     * of controller. It is assumed that {@link Consumer} has an understanding
-     * of this changes.
-     * 
-     * 
-     * @see DataCommitHandler for further information how two-phase commit is
-     *      processed.
-     * @param store
-     *            Identifier of the store, where commit should occur.
-     * @return Result of the commit, containing success information or list of
-     *         encountered errors, if commit was not successful.
-     */
-    Future<RpcResult<Void>> commit(DataStoreIdentifier store);
+    DataModificationTransaction beginTransaction();
 }
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataChangeListener.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataChangeListener.java
new file mode 100644 (file)
index 0000000..944ccc5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * 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.core.api.data;
+
+import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+
+public interface DataChangeListener
+        extends
+        org.opendaylight.controller.md.sal.common.api.data.DataChangeListener<InstanceIdentifier, CompositeNode> {
+
+    @Override
+    public void onDataChanged(DataChangeEvent<InstanceIdentifier, CompositeNode> change);
+}
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataModificationTransaction.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataModificationTransaction.java
new file mode 100644 (file)
index 0000000..774de27
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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.core.api.data;
+
+import java.util.EventListener;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+
+public interface DataModificationTransaction extends DataModification<InstanceIdentifier, CompositeNode>{
+
+    /**
+     * Returns transaction identifier
+     * 
+     * @return Transaction identifier
+     */
+    Object getIdentifier();
+    
+    TransactionStatus getStatus();
+    
+    /**
+     * Commits transaction to be stored in global data repository.
+     * 
+     * 
+     * @return  Future object which returns RpcResult with TransactionStatus 
+     *          when transaction is processed by store.
+     */
+    Future<RpcResult<TransactionStatus>> commit();
+    
+    ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener);
+    
+    
+    public interface DataTransactionListener extends EventListener {
+        
+        void onStatusUpdated(DataModificationTransaction transaction,TransactionStatus status);
+        
+    }
+    
+    
+    
+}
index 32035ea..3024c89 100644 (file)
@@ -7,10 +7,16 @@
  */
 package org.opendaylight.controller.sal.core.api.data;
 
+import org.opendaylight.controller.md.sal.common.api.data.DataProvisionService;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 
-public interface DataProviderService extends DataBrokerService {
+public interface DataProviderService extends 
+    DataBrokerService, //
+    DataProvisionService<InstanceIdentifier, CompositeNode>
+    {
 
     /**
      * Adds {@link DataValidator} for specified Data Store
@@ -32,23 +38,6 @@ public interface DataProviderService extends DataBrokerService {
     public void removeValidator(DataStoreIdentifier store,
             DataValidator validator);
 
-    /**
-     * Adds {@link DataCommitHandler} for specified data store
-     * 
-     * @param store
-     * @param provider
-     */
-    void addCommitHandler(DataStoreIdentifier store, DataCommitHandler provider);
-
-    /**
-     * Removes {@link DataCommitHandler} from specified data store
-     * 
-     * @param store
-     * @param provider
-     */
-    void removeCommitHandler(DataStoreIdentifier store,
-            DataCommitHandler provider);
-
     /**
      * Adds {@link DataRefresher} for specified data store
      * 
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountInstance.java
new file mode 100644 (file)
index 0000000..1596165
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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.core.api.mount;
+
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationService;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+public interface MountInstance extends NotificationService, DataBrokerService {
+
+    Future<RpcResult<CompositeNode>> rpc(QName type, CompositeNode input);
+}
diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountService.java
new file mode 100644 (file)
index 0000000..530b02b
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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.core.api.mount;
+
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+
+
+public interface MountService {
+
+    MountInstance getMountPoint(InstanceIdentifier path);
+}
index 5b0c992..f87fee5 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.sal.core.api.notify;
 
+import java.util.EventListener;
 import java.util.Set;
 
 import org.opendaylight.controller.sal.core.api.Consumer;
@@ -17,7 +18,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 /**
  * Notification listener for SAL notifications.
  */
-public interface NotificationListener extends Consumer.ConsumerFunctionality {
+public interface NotificationListener extends Consumer.ConsumerFunctionality, EventListener {
     /**
      * A set of notification types supported by listeners.
      * 
@@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.CompositeNode;
  * 
  * 
  */
-public interface NotificationProviderService extends NotificationService {
+public interface NotificationPublishService extends NotificationService {
 
     /**
      * Publishes a notification.
@@ -41,6 +41,8 @@ public interface NotificationProviderService extends NotificationService {
      * @param notification
      *            Notification to publish
      */
+    @Deprecated
     void sendNotification(CompositeNode notification);
 
+    void publish(CompositeNode notification);
 }
index 3bf1054..f654ca9 100644 (file)
@@ -11,6 +11,7 @@ import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.Provider;
 import org.opendaylight.controller.sal.core.api.RpcImplementation;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.QName;
 
 
@@ -40,15 +41,6 @@ public interface NotificationService extends BrokerService {
      * @param notification
      * @param listener
      */
-    void addNotificationListener(QName notification,
-            NotificationListener listener);
-
-    /**
-     * Removes a notification listener for supplied notification type.
-     * 
-     * @param notification
-     * @param listener
-     */
-    void removeNotificationListener(QName notification,
+    Registration<NotificationListener> addNotificationListener(QName notification,
             NotificationListener listener);
 }
index d79eeee..6d57a4e 100644 (file)
@@ -49,7 +49,7 @@ class ConsumerContextImpl implements ConsumerSession {
         val toStop = instantiatedServices.values();
         this.closed = true;
         for (BrokerService brokerService : toStop) {
-            brokerService.closeSession();
+            //brokerService.closeSession();
         }
         broker.consumerSessionClosed(this);
     }
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerModule.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataBrokerModule.java
deleted file mode 100644 (file)
index 7fa20d7..0000000
+++ /dev/null
@@ -1,419 +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.dom.broker;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.controller.sal.common.util.Rpcs;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
-import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.core.api.data.DataCommitHandler;
-import org.opendaylight.controller.sal.core.api.data.DataProviderService;
-import org.opendaylight.controller.sal.core.api.data.DataValidator;
-import org.opendaylight.controller.sal.core.api.data.DataCommitHandler.CommitTransaction;
-import org.opendaylight.controller.sal.core.api.data.DataProviderService.DataRefresher;
-import org.opendaylight.controller.sal.core.spi.BrokerModule;
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableSet;
-
-public class DataBrokerModule implements BrokerModule {
-
-    private static final Logger log = LoggerFactory
-            .getLogger(DataBrokerModule.class);
-
-    private static final Set<Class<? extends ProviderFunctionality>> SUPPORTED_PROVIDER_FUNCTIONALITY = ImmutableSet
-            .of((Class<? extends ProviderFunctionality>) DataValidator.class,
-                    DataRefresher.class, DataCommitHandler.class);
-
-    private static final Set<Class<? extends BrokerService>> PROVIDED_SESSION_SERVICES = ImmutableSet
-            .of((Class<? extends BrokerService>) DataBrokerService.class,
-                    DataProviderService.class);
-
-    private Map<DataStoreIdentifier, StoreContext> storeContext;
-
-    private ExecutorService executor;
-    
-    private SequentialCommitHandlerCoordinator coordinator = new SequentialCommitHandlerCoordinator();
-
-    @Override
-    public Set<Class<? extends BrokerService>> getProvidedServices() {
-        return PROVIDED_SESSION_SERVICES;
-    }
-
-    @Override
-    public Set<Class<? extends ProviderFunctionality>> getSupportedProviderFunctionality() {
-        return SUPPORTED_PROVIDER_FUNCTIONALITY;
-    }
-
-    @Override
-    public Set<Class<? extends ConsumerFunctionality>> getSupportedConsumerFunctionality() {
-        return Collections.emptySet();
-    }
-
-    @Override
-    public <T extends BrokerService> T getServiceForSession(Class<T> service,
-            ConsumerSession session) {
-        if (DataProviderService.class.equals(service)
-                && session instanceof ProviderSession) {
-            @SuppressWarnings("unchecked")
-            T ret = (T) newDataProviderService(session);
-            return ret;
-        } else if (DataBrokerService.class.equals(service)) {
-
-            @SuppressWarnings("unchecked")
-            T ret = (T) newDataConsumerService(session);
-            return ret;
-        }
-
-        throw new IllegalArgumentException(
-                "The requested session-specific service is not provided by this module.");
-    }
-
-    private DataProviderService newDataProviderService(ConsumerSession session) {
-        return new DataProviderSession();
-    }
-
-    private DataBrokerService newDataConsumerService(ConsumerSession session) {
-        return new DataConsumerSession();
-    }
-
-    private StoreContext context(DataStoreIdentifier store) {
-        return storeContext.get(store);
-    }
-
-    private static class StoreContext {
-        private Set<DataCommitHandler> commitHandlers = Collections
-                .synchronizedSet(new HashSet<DataCommitHandler>());
-        private Set<DataValidator> validators = Collections
-                .synchronizedSet(new HashSet<DataValidator>());
-        private Set<DataRefresher> refreshers = Collections
-                .synchronizedSet(new HashSet<DataRefresher>());
-    }
-
-    private class DataConsumerSession implements DataBrokerService {
-
-        @Override
-        public CompositeNode getData(DataStoreIdentifier store) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public CompositeNode getData(DataStoreIdentifier store,
-                CompositeNode filter) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public CompositeNode getCandidateData(DataStoreIdentifier store) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public CompositeNode getCandidateData(DataStoreIdentifier store,
-                CompositeNode filter) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public RpcResult<CompositeNode> editCandidateData(
-                DataStoreIdentifier store, MutableCompositeNode changeSet) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public void closeSession() {
-            // TODO Implement this method
-            throw new UnsupportedOperationException("Not implemented");
-        }
-
-        @Override
-        public Set<DataStoreIdentifier> getDataStores() {
-            // TODO Auto-generated method stub
-            return null;
-        }
-
-    }
-
-    private class DataProviderSession extends DataConsumerSession implements
-            DataProviderService {
-
-        private Set<DataCommitHandler> providerCommitHandlers = new HashSet<DataCommitHandler>();
-        private Set<DataValidator> providerValidators = new HashSet<DataValidator>();
-        private Set<DataRefresher> providerRefreshers = new HashSet<DataRefresher>();
-
-        @Override
-        public void addValidator(DataStoreIdentifier store,
-                DataValidator validator) {
-            if (validator == null)
-                throw new IllegalArgumentException(
-                        "Validator should not be null");
-
-            providerValidators.add(validator);
-            context(store).validators.add(validator);
-        }
-
-        @Override
-        public void removeValidator(DataStoreIdentifier store,
-                DataValidator validator) {
-            if (validator == null)
-                throw new IllegalArgumentException(
-                        "Validator should not be null");
-
-            providerValidators.remove(validator);
-            context(store).validators.remove(validator);
-        }
-
-        @Override
-        public void addCommitHandler(DataStoreIdentifier store,
-                DataCommitHandler provider) {
-            if (provider == null)
-                throw new IllegalArgumentException(
-                        "CommitHandler should not be null");
-
-            providerCommitHandlers.add(provider);
-            context(store).commitHandlers.add(provider);
-        }
-
-        @Override
-        public void removeCommitHandler(DataStoreIdentifier store,
-                DataCommitHandler provider) {
-            if (provider == null)
-                throw new IllegalArgumentException(
-                        "CommitHandler should not be null");
-
-            providerCommitHandlers.remove(provider);
-            context(store).commitHandlers.remove(provider);
-        }
-
-        @Override
-        public void addRefresher(DataStoreIdentifier store,
-                DataRefresher provider) {
-            if (provider == null)
-                throw new IllegalArgumentException(
-                        "Refresher should not be null");
-
-            providerRefreshers.add(provider);
-            context(store).refreshers.add(provider);
-        }
-
-        @Override
-        public void removeRefresher(DataStoreIdentifier store,
-                DataRefresher provider) {
-            if (provider == null)
-                throw new IllegalArgumentException(
-                        "Refresher should not be null");
-
-            providerRefreshers.remove(provider);
-            context(store).refreshers.remove(provider);
-        }
-
-    }
-
-    private class SequentialCommitHandlerCoordinator implements
-            DataCommitHandler {
-
-        @Override
-        public RpcResult<CommitTransaction> requestCommit(
-                DataStoreIdentifier store) {
-            List<RpcError> errors = new ArrayList<RpcError>();
-            Set<CommitTransaction> transactions = new HashSet<DataCommitHandler.CommitTransaction>();
-            boolean successful = true;
-
-            for (DataCommitHandler commitHandler : context(store).commitHandlers) {
-                try {
-                    RpcResult<CommitTransaction> partialResult = commitHandler
-                            .requestCommit(store);
-                    successful = partialResult.isSuccessful() & successful;
-                    if (partialResult.isSuccessful()) {
-                        transactions.add(partialResult.getResult());
-                    }
-
-                    errors.addAll(partialResult.getErrors());
-                } catch (Exception e) {
-                    log.error("Uncaught exception prevented commit request."
-                            + e.getMessage(), e);
-                    successful = false;
-                    // FIXME: Add RPC Error with exception.
-                }
-                if (successful == false)
-                    break;
-            }
-            CommitTransaction transaction = new SequentialCommitTransaction(
-                    store, transactions);
-            return Rpcs.getRpcResult(successful, transaction, errors);
-        }
-
-        @Override
-        public Set<DataStoreIdentifier> getSupportedDataStores() {
-            return Collections.emptySet();
-        }
-    }
-
-    private class SequentialCommitTransaction implements CommitTransaction {
-
-        final Set<CommitTransaction> transactions;
-        final DataStoreIdentifier store;
-
-        public SequentialCommitTransaction(DataStoreIdentifier s,
-                Set<CommitTransaction> t) {
-            transactions = t;
-            store = s;
-        }
-
-        @Override
-        public RpcResult<Void> finish() {
-            List<RpcError> errors = new ArrayList<RpcError>();
-            boolean successful = true;
-
-            for (CommitTransaction commitHandler : transactions) {
-                try {
-                    RpcResult<Void> partialResult = commitHandler.finish();
-                    successful = partialResult.isSuccessful() & successful;
-                    errors.addAll(partialResult.getErrors());
-                } catch (Exception e) {
-                    log.error(
-                            "Uncaught exception prevented finishing of commit."
-                                    + e.getMessage(), e);
-                    successful = false;
-                    // FIXME: Add RPC Error with exception.
-                }
-                if (successful == false)
-                    break;
-            }
-
-            return Rpcs.getRpcResult(successful, null, errors);
-        }
-
-        @Override
-        public RpcResult<Void> rollback() {
-            List<RpcError> errors = new ArrayList<RpcError>();
-            boolean successful = true;
-
-            for (CommitTransaction commitHandler : transactions) {
-                try {
-                    RpcResult<Void> partialResult = commitHandler.rollback();
-                    successful = partialResult.isSuccessful() & successful;
-                    errors.addAll(partialResult.getErrors());
-                } catch (Exception e) {
-                    log.error(
-                            "Uncaught exception prevented rollback of commit."
-                                    + e.getMessage(), e);
-                    successful = false;
-                    // FIXME: Add RPC Error with exception.
-                }
-                if (successful == false)
-                    break;
-            }
-
-            return Rpcs.getRpcResult(successful, null, errors);
-        }
-
-        @Override
-        public DataStoreIdentifier getDataStore() {
-            return this.store;
-        }
-
-        @Override
-        public DataCommitHandler getHandler() {
-            return coordinator;
-        }
-    }
-
-    private class ValidationCoordinator implements DataValidator {
-
-        private final DataStoreIdentifier store;
-
-        ValidationCoordinator(DataStoreIdentifier store) {
-            this.store = store;
-        }
-
-        @Override
-        public RpcResult<Void> validate(CompositeNode toValidate) {
-            List<RpcError> errors = new ArrayList<RpcError>();
-            boolean successful = true;
-
-            for (DataValidator validator : context(store).validators) {
-                try {
-                    RpcResult<Void> partialResult = validator
-                            .validate(toValidate);
-                    successful = partialResult.isSuccessful() & successful;
-                    errors.addAll(partialResult.getErrors());
-                } catch (Exception e) {
-                    log.error(
-                            "Uncaught exception prevented validation."
-                                    + e.getMessage(), e);
-                    successful = false;
-                    // FIXME: Add RPC Error with exception.
-                }
-                if (successful == false)
-                    break;
-            }
-
-            return Rpcs.getRpcResult(successful, null, errors);
-        }
-
-        @Override
-        public Set<DataStoreIdentifier> getSupportedDataStores() {
-            return Collections.emptySet();
-        }
-
-    }
-
-    private class DataRefreshCoordinator implements DataRefresher {
-
-        private final DataStoreIdentifier store;
-
-        DataRefreshCoordinator(DataStoreIdentifier store) {
-            this.store = store;
-        }
-
-        @Override
-        public void refreshData() {
-
-            for (DataRefresher refresher : context(store).refreshers) {
-                try {
-                    refresher.refreshData();
-                } catch (Exception e) {
-                    log.error(
-                            "Uncaught exception during refresh of data: "
-                                    + e.getMessage(), e);
-                }
-
-            }
-        }
-    }
-}
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataConsumerServiceImpl.xtend b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/DataConsumerServiceImpl.xtend
new file mode 100644 (file)
index 0000000..3bccc4e
--- /dev/null
@@ -0,0 +1,27 @@
+package org.opendaylight.controller.sal.dom.broker
+
+import org.opendaylight.controller.sal.core.api.data.DataBrokerService
+import org.opendaylight.controller.sal.common.DataStoreIdentifier
+import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode
+import org.opendaylight.yangtools.yang.data.api.CompositeNode
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
+import org.opendaylight.controller.sal.core.api.data.DataChangeListener
+
+class DataConsumerServiceImpl implements DataBrokerService {
+    
+    override beginTransaction() {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+
+    override readConfigurationData(InstanceIdentifier path) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+    override readOperationalData(InstanceIdentifier path) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+    override registerDataChangeListener(InstanceIdentifier path, DataChangeListener listener) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+}
\ No newline at end of file
index 9a002ec..8c272e5 100644 (file)
@@ -20,9 +20,10 @@ import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
 import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.controller.sal.core.api.notify.NotificationProviderService;
+import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
 import org.opendaylight.controller.sal.core.api.notify.NotificationService;
 import org.opendaylight.controller.sal.core.spi.BrokerModule;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.slf4j.Logger;
@@ -40,8 +41,8 @@ public class NotificationModule implements BrokerModule {
             .create();
 
     private static final Set<Class<? extends BrokerService>> PROVIDED_SERVICE_TYPE = ImmutableSet
-            .of((Class<? extends BrokerService>) NotificationService.class,
-                    NotificationProviderService.class);
+            .<Class<? extends BrokerService>>of(NotificationService.class,
+                    NotificationPublishService.class);
 
     private static final Set<Class<? extends ConsumerFunctionality>> SUPPORTED_CONSUMER_FUNCTIONALITY = ImmutableSet
             .of((Class<? extends ConsumerFunctionality>) NotificationListener.class,
@@ -63,10 +64,10 @@ public class NotificationModule implements BrokerModule {
     @Override
     public <T extends BrokerService> T getServiceForSession(Class<T> service,
             ConsumerSession session) {
-        if (NotificationProviderService.class.equals(service)
+        if (NotificationPublishService.class.equals(service)
                 && session instanceof ProviderSession) {
             @SuppressWarnings("unchecked")
-            T ret = (T) newNotificationProviderService(session);
+            T ret = (T) newNotificationPublishService(session);
             return ret;
         } else if (NotificationService.class.equals(service)) {
 
@@ -105,7 +106,7 @@ public class NotificationModule implements BrokerModule {
         return new NotificationConsumerSessionImpl();
     }
 
-    private NotificationProviderService newNotificationProviderService(
+    private NotificationPublishService newNotificationPublishService(
             ConsumerSession session) {
         return new NotificationProviderSessionImpl();
     }
@@ -117,8 +118,8 @@ public class NotificationModule implements BrokerModule {
                 .create();
         private boolean closed = false;
 
-        @Override
-        public void addNotificationListener(QName notification,
+    
+        public Registration<NotificationListener> addNotificationListener(QName notification,
                 NotificationListener listener) {
             checkSessionState();
             if (notification == null) {
@@ -132,9 +133,9 @@ public class NotificationModule implements BrokerModule {
             consumerListeners.put(notification, listener);
             listeners.put(notification, listener);
             log.info("Registered listener for notification: " + notification);
+            return null; // Return registration Object.
         }
 
-        @Override
         public void removeNotificationListener(QName notification,
                 NotificationListener listener) {
             checkSessionState();
@@ -149,7 +150,6 @@ public class NotificationModule implements BrokerModule {
             listeners.remove(notification, listener);
         }
 
-        @Override
         public void closeSession() {
             closed = true;
             Map<QName, Collection<NotificationListener>> toRemove = consumerListeners
@@ -168,7 +168,7 @@ public class NotificationModule implements BrokerModule {
 
     private class NotificationProviderSessionImpl extends
             NotificationConsumerSessionImpl implements
-            NotificationProviderService {
+            NotificationPublishService {
 
         @Override
         public void sendNotification(CompositeNode notification) {
@@ -178,6 +178,11 @@ public class NotificationModule implements BrokerModule {
                         "Notification must not be null.");
             NotificationModule.this.sendNotification(notification);
         }
+
+        @Override
+        public void publish(CompositeNode notification) {
+            sendNotification(notification);
+        }
     }
 
     @Override
index 8e402e2..11f68d6 100644 (file)
@@ -30,9 +30,11 @@ class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession
         }
         broker.addRpcImplementation(rpcType, implementation);
         rpcImpls.put(rpcType, implementation);
+        //FIXME: Return registration
+        return null;
     }
 
-    override removeRpcImplementation(QName rpcType, RpcImplementation implToRemove) throws IllegalArgumentException {
+    def removeRpcImplementation(QName rpcType, RpcImplementation implToRemove) throws IllegalArgumentException {
         val localImpl = rpcImpls.get(rpcType);
         if(localImpl != implToRemove) {
             throw new IllegalStateException(
@@ -42,5 +44,13 @@ class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession
         broker.removeRpcImplementation(rpcType, implToRemove);
         rpcImpls.remove(rpcType);
     }
-
+    
+    override addMountedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+    override addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation) {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
 }
index 7b9bcf0..01dca01 100644 (file)
@@ -20,4 +20,5 @@
             <version>1.0-SNAPSHOT</version>\r
         </dependency>\r
     </dependencies>\r
+    <packaging>bundle</packaging>\r
 </project>\r
index 97bbdc4..996f257 100644 (file)
 <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>
-       <parent>
-               <artifactId>sal-samples</artifactId>
-               <groupId>org.opendaylight.controller.samples</groupId>
-               <version>1.0-SNAPSHOT</version>
-       </parent>
-       <artifactId>sample-toaster-it</artifactId>
+    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>
+    <parent>
+        <artifactId>sal-samples</artifactId>
+        <groupId>org.opendaylight.controller.samples</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>sample-toaster-it</artifactId>
     <scm>
-      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
-      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+        <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+        <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
     </scm>
 
-       <properties>
-               <exam.version>3.0.0</exam.version>
-               <url.version>1.5.0</url.version>
-       </properties>
+    <properties>
+        <exam.version>3.0.0</exam.version>
+        <url.version>1.5.0</url.version>
+    </properties>
 
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.ops4j.pax.exam</groupId>
-                               <artifactId>maven-paxexam-plugin</artifactId>
-                               <version>1.2.4</version>
-                               <executions>
-                                       <execution>
-                                               <id>generate-config</id>
-                                               <goals>
-                                                       <goal>generate-depends-file</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                       </plugin>
-               </plugins>
-               <pluginManagement>
-                       <plugins>
-                               <!--This plugin's configuration is used to store Eclipse m2e settings 
-                                       only. It has no influence on the Maven build itself. -->
-                               <plugin>
-                                       <groupId>org.eclipse.m2e</groupId>
-                                       <artifactId>lifecycle-mapping</artifactId>
-                                       <version>1.0.0</version>
-                                       <configuration>
-                                               <lifecycleMappingMetadata>
-                                                       <pluginExecutions>
-                                                               <pluginExecution>
-                                                                       <pluginExecutionFilter>
-                                                                               <groupId>
-                                                                                       org.ops4j.pax.exam
-                                                                               </groupId>
-                                                                               <artifactId>
-                                                                                       maven-paxexam-plugin
-                                                                               </artifactId>
-                                                                               <versionRange>
-                                                                                       [1.2.4,)
-                                                                               </versionRange>
-                                                                               <goals>
-                                                                                       <goal>
-                                                                                               generate-depends-file
-                                                                                       </goal>
-                                                                               </goals>
-                                                                       </pluginExecutionFilter>
-                                                                       <action>
-                                                                               <ignore></ignore>
-                                                                       </action>
-                                                               </pluginExecution>
-                                                       </pluginExecutions>
-                                               </lifecycleMappingMetadata>
-                                       </configuration>
-                               </plugin>
-                       </plugins>
-               </pluginManagement>
-       </build>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.ops4j.pax.exam</groupId>
+                <artifactId>maven-paxexam-plugin</artifactId>
+                <version>1.2.4</version>
+                <executions>
+                    <execution>
+                        <id>generate-config</id>
+                        <goals>
+                            <goal>generate-depends-file</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <pluginManagement>
+            <plugins>
+                <!--This plugin's configuration is used to store Eclipse m2e settings 
+                    only. It has no influence on the Maven build itself. -->
+                <plugin>
+                    <groupId>org.eclipse.m2e</groupId>
+                    <artifactId>lifecycle-mapping</artifactId>
+                    <version>1.0.0</version>
+                    <configuration>
+                        <lifecycleMappingMetadata>
+                            <pluginExecutions>
+                                <pluginExecution>
+                                    <pluginExecutionFilter>
+                                        <groupId>
+                                            org.ops4j.pax.exam
+                                        </groupId>
+                                        <artifactId>
+                                            maven-paxexam-plugin
+                                        </artifactId>
+                                        <versionRange>
+                                            [1.2.4,)
+                                        </versionRange>
+                                        <goals>
+                                            <goal>
+                                                generate-depends-file
+                                            </goal>
+                                        </goals>
+                                    </pluginExecutionFilter>
+                                    <action>
+                                        <ignore></ignore>
+                                    </action>
+                                </pluginExecution>
+                            </pluginExecutions>
+                        </lifecycleMappingMetadata>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
 
-       <dependencies>
-               <dependency>
-                       <groupId>org.opendaylight.controller.samples</groupId>
-                       <artifactId>sample-toaster</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.opendaylight.controller.samples</groupId>
-                       <artifactId>sample-toaster-consumer</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.opendaylight.controller.samples</groupId>
-                       <artifactId>sample-toaster-provider</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.opendaylight.controller</groupId>
-                       <artifactId>sal-binding-broker-impl</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.ops4j.pax.exam</groupId>
-                       <artifactId>pax-exam-container-native</artifactId>
-                       <version>${exam.version}</version>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.ops4j.pax.exam</groupId>
-                       <artifactId>pax-exam-junit4</artifactId>
-                       <version>${exam.version}</version>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.ops4j.pax.exam</groupId>
-                       <artifactId>pax-exam-link-mvn</artifactId>
-                       <version>${exam.version}</version>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>equinoxSDK381</groupId>
-                       <artifactId>org.eclipse.osgi</artifactId>
-                       <version>3.8.1.v20120830-144521</version>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.slf4j</groupId>
-                       <artifactId>log4j-over-slf4j</artifactId>
-                       <version>1.7.2</version>
-               </dependency>
-               <dependency>
-                       <groupId>ch.qos.logback</groupId>
-                       <artifactId>logback-core</artifactId>
-                       <version>1.0.9</version>
-               </dependency>
-               <dependency>
-                       <groupId>ch.qos.logback</groupId>
-                       <artifactId>logback-classic</artifactId>
-                       <version>1.0.9</version>
-               </dependency>
-       </dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller.samples</groupId>
+            <artifactId>sample-toaster</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.samples</groupId>
+            <artifactId>sample-toaster-consumer</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.samples</groupId>
+            <artifactId>sample-toaster-provider</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-broker-impl</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-native</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>equinoxSDK381</groupId>
+            <artifactId>org.eclipse.osgi</artifactId>
+            <version>3.8.1.v20120830-144521</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>log4j-over-slf4j</artifactId>
+            <version>1.7.2</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>1.0.9</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>1.0.9</version>
+        </dependency>
+    </dependencies>
 </project>
index 0561a36..4b4cb48 100644 (file)
@@ -30,55 +30,51 @@ import org.osgi.framework.ServiceReference;
 @RunWith(PaxExam.class)
 public class ToasterTest {
 
-       public static final String ODL = "org.opendaylight.controller";
-       public static final String YANG = "org.opendaylight.yangtools";
-       public static final String SAMPLE = "org.opendaylight.controller.samples";
+    public static final String ODL = "org.opendaylight.controller";
+    public static final String YANG = "org.opendaylight.yangtools";
+    public static final String SAMPLE = "org.opendaylight.controller.samples";
 
-       @Test
-       public void properInitialized() throws Exception {
+    @Test
+    public void properInitialized() throws Exception {
 
-               Collection<ServiceReference<ToasterService>> references = ctx
-                               .getServiceReferences(ToasterService.class, null);
-               assertEquals(2, references.size());
-               
-               consumer.createToast(WhiteBread.class, 5);
-               
-       }
+        Collection<ServiceReference<ToasterService>> references = ctx.getServiceReferences(ToasterService.class, null);
+        assertEquals(2, references.size());
 
-       @Inject
-       BindingAwareBroker broker;
+        consumer.createToast(WhiteBread.class, 5);
 
-       @Inject
-       ToastConsumer consumer;
+    }
 
-       @Inject
-       BundleContext ctx;
+    @Inject
+    BindingAwareBroker broker;
 
-       @Configuration
-       public Option[] config() {
-               return options(systemProperty("osgi.console").value("2401"),
-                               mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
-                               mavenBundle("org.slf4j", "log4j-over-slf4j")
-                                               .versionAsInProject(),
-                               mavenBundle("ch.qos.logback", "logback-core")
-                                               .versionAsInProject(),
-                               mavenBundle("ch.qos.logback", "logback-classic")
-                                               .versionAsInProject(),
-                               mavenBundle(ODL, "sal-binding-api").versionAsInProject(),
-                               mavenBundle(ODL, "sal-binding-broker-impl")
-                                               .versionAsInProject(), mavenBundle(ODL, "sal-common")
-                                               .versionAsInProject(),
-                               mavenBundle(ODL, "sal-common-util").versionAsInProject(),
-                               mavenBundle(SAMPLE, "sample-toaster").versionAsInProject(),
-                               mavenBundle(SAMPLE, "sample-toaster-consumer")
-                                               .versionAsInProject(),
-                               mavenBundle(SAMPLE, "sample-toaster-provider")
-                                               .versionAsInProject(),
-                               mavenBundle(YANG, "yang-binding").versionAsInProject(),
-                               mavenBundle(YANG, "yang-common").versionAsInProject(),
-                               mavenBundle("com.google.guava", "guava").versionAsInProject(),
-                               junitBundles(), mavenBundle("org.javassist", "javassist")
-                                               .versionAsInProject());
-       }
+    @Inject
+    ToastConsumer consumer;
+
+    @Inject
+    BundleContext ctx;
+
+    @Configuration
+    public Option[] config() {
+        return options(systemProperty("osgi.console").value("2401"), 
+                mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), //
+                mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), //
+                mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), //
+                mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
+                mavenBundle(ODL, "sal-binding-api").versionAsInProject(), //
+                mavenBundle(ODL, "sal-binding-broker-impl").versionAsInProject(), //
+                mavenBundle(ODL, "sal-common").versionAsInProject(), //
+                mavenBundle(ODL, "sal-common-api").versionAsInProject(),
+                mavenBundle(ODL, "sal-common-util").versionAsInProject(), //
+                mavenBundle(SAMPLE, "sample-toaster").versionAsInProject(), //
+                mavenBundle(SAMPLE, "sample-toaster-consumer").versionAsInProject(), //
+                mavenBundle(SAMPLE, "sample-toaster-provider").versionAsInProject(), //
+                mavenBundle(YANG, "concepts").versionAsInProject(),
+                mavenBundle(YANG, "yang-binding").versionAsInProject(), //
+                mavenBundle(YANG, "yang-common").versionAsInProject(), //
+                mavenBundle("com.google.guava", "guava").versionAsInProject(), //
+                mavenBundle("org.javassist", "javassist").versionAsInProject(),
+                junitBundles()
+                );
+    }
 
 }
index 92c836a..510f316 100644 (file)
@@ -1,49 +1,49 @@
 <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>
-       <parent>
-               <artifactId>sal-samples</artifactId>
-               <groupId>org.opendaylight.controller.samples</groupId>
-               <version>1.0-SNAPSHOT</version>
-       </parent>
-       <artifactId>sample-toaster-provider</artifactId>
-       <packaging>bundle</packaging>
+    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>
+    <parent>
+        <artifactId>sal-samples</artifactId>
+        <groupId>org.opendaylight.controller.samples</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>sample-toaster-provider</artifactId>
+    <packaging>bundle</packaging>
     <scm>
-      <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
-      <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-      <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+        <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+        <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
     </scm>
 
 
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                       <Bundle-Activator>org.opendaylight.controller.sample.toaster.provider.ToasterProvider</Bundle-Activator>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Bundle-Activator>org.opendaylight.controller.sample.toaster.provider.ToasterProvider</Bundle-Activator>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
-       <dependencies>
-               <dependency>
-                       <groupId>${project.groupId}</groupId>
-                       <artifactId>sample-toaster</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.opendaylight.controller</groupId>
-                       <artifactId>sal-binding-api</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.opendaylight.controller</groupId>
-                       <artifactId>sal-common-util</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-       </dependencies>
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>sample-toaster</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-common-util</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
 </project>
index 64f2787..3762740 100644 (file)
@@ -1,8 +1,8 @@
 package org.opendaylight.controller.sample.toaster.provider;
+
 import java.util.Collection;
 import java.util.Collections;
 
-
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
@@ -17,50 +17,32 @@ import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 public class ToasterProvider extends AbstractBindingAwareProvider {
     private static final Logger log = LoggerFactory.getLogger(ToasterProvider.class);
 
-       private ConsumerContext consumerContext;
-       private ProviderContext providerContext;
-       private OpendaylightToaster toaster;
-       
-       
-       public ToasterProvider() {
-               toaster = new OpendaylightToaster();
-       }
-       
-       @Override
-       public void onSessionInitialized(ConsumerContext session) {
-               log.info("Consumer Session initialized");
-               this.consumerContext = session;
+    private ProviderContext providerContext;
+    private OpendaylightToaster toaster;
+
+    public ToasterProvider() {
+        toaster = new OpendaylightToaster();
+    }
+
+    @Override
+    public void onSessionInitiated(ProviderContext session) {
+        log.info("Provider Session initialized");
 
-       }
+        this.providerContext = session;
+        toaster.setNotificationProvider(session.getSALService(NotificationProviderService.class));
+        providerContext.addRpcImplementation(ToasterService.class, toaster);
+    }
 
-       @Override
-       public void onSessionInitiated(ProviderContext session) {
-               log.info("Provider Session initialized");
-               
-               this.providerContext = session;
-               toaster.setNotificationProvider(session.getSALService(NotificationProviderService.class));
-               providerContext.addRpcImplementation(ToasterService.class, toaster);
-       }       
-       
-       
-       @Override
-       public Collection<? extends RpcService> getImplementations() {
-               return Collections.emptySet();
-       }
+    @Override
+    public Collection<? extends RpcService> getImplementations() {
+        return Collections.emptySet();
+    }
 
-       @Override
-       public Collection<? extends ProviderFunctionality> getFunctionality() {
-               return Collections.emptySet();
-       }
-       
-       @Override
-       @Deprecated
-       protected void startImpl(BundleContext context) {
-           // TODO Auto-generated method stub
-           
-       }
+    @Override
+    public Collection<? extends ProviderFunctionality> getFunctionality() {
+        return Collections.emptySet();
+    }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.