Merge "Refactor Additional header for netconf hello message."
authorEd Warnicke <eaw@cisco.com>
Thu, 13 Feb 2014 11:44:11 +0000 (11:44 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 13 Feb 2014 11:44:11 +0000 (11:44 +0000)
38 files changed:
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcConsumerRegistry.java
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/service/DataChangeEventImpl.java
opendaylight/md-sal/sal-dom-broker/pom.xml
opendaylight/md-sal/sal-remote/pom.xml
opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java [deleted file]
opendaylight/md-sal/sal-restconf-broker/pom.xml
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java [deleted file]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/binding/impl/DataBrokerServiceImpl.java [moved from opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerServiceImpl.java with 98% similarity]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/SalRemoteServiceBroker.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RpcConsumerRegistryImpl.java [moved from opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcConsumerRegistryImpl.java with 58% similarity]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java [new file with mode: 0644]

index 5aba5ca..fca4936 100644 (file)
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>sal-broker-impl</artifactId>
           <version>${mdsal.version}</version>
+        </dependency>
+          <dependency>
+              <groupId>org.opendaylight.controller</groupId>
+              <artifactId>sal-remote</artifactId>
+              <version>${mdsal.version}</version>
+          </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-restconf-broker</artifactId>
+            <version>${mdsal.version}</version>
         </dependency>
         <dependency>
           <groupId>org.opendaylight.controller</groupId>
           <artifactId>concepts</artifactId>
           <version>${yangtools.version}</version>
         </dependency>
+          <dependency>
+              <groupId>org.opendaylight.yangtools</groupId>
+              <artifactId>restconf-client-api</artifactId>
+              <version>${yangtools.version}</version>
+          </dependency>
+          <dependency>
+              <groupId>org.opendaylight.yangtools</groupId>
+              <artifactId>restconf-client-impl</artifactId>
+              <version>${yangtools.version}</version>
+          </dependency>
 
         <!-- config-->
         <dependency>
index 8b4e478..f900c0b 100644 (file)
                 <artifactId>sal-connector-api</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-binding-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>sal</artifactId>
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-remote</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.controller</groupId>
+                <artifactId>sal-binding-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
             <!-- Supporting Libraries -->
             <dependency>
index 33b384a..69a2108 100644 (file)
@@ -19,8 +19,6 @@ public interface RpcConsumerRegistry extends BindingAwareService {
      * Returns a session specific instance (implementation) of requested
      * YANG module implentation / service provided by consumer.
      * 
-     * @param service
-     *            Broker service
      * @return Session specific implementation of service
      */
     <T extends RpcService> T getRpcService(Class<T> module);
index e5a74e4..fd2c8a2 100644 (file)
                             org.opendaylight.controller.sal.binding.impl.*,
                             org.opendaylight.controller.sal.binding.codegen,
                             org.opendaylight.controller.sal.binding.codegen.*,
-                            org.opendaylight.controller.sal.binding.dom.*,
+                            <!--org.opendaylight.controller.sal.binding.dom.*,-->
                             org.opendaylight.controller.sal.binding.osgi.*,
                         </Private-Package>
                     </instructions>
index 0762739..14006a3 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 import java.util.Hashtable;
 import java.util.Map.Entry;
 import java.util.Set;
-
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
@@ -27,9 +28,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-
 /**
 *
 */
@@ -63,7 +61,7 @@ public final class RuntimeMappingModule extends
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-
+        
         RuntimeGeneratedMappingServiceProxy potential = tryToReuseGlobalInstance();
         if(potential != null) {
             return potential;
@@ -100,7 +98,7 @@ public final class RuntimeMappingModule extends
     BindingIndependentMappingService, //
     Delegator<BindingIndependentMappingService>, //
     AutoCloseable {
-
+        
         private BindingIndependentMappingService delegate;
         private ServiceReference<BindingIndependentMappingService> reference;
         private BundleContext bundleContext;
@@ -113,56 +111,48 @@ public final class RuntimeMappingModule extends
             this.delegate = Preconditions.checkNotNull(delegate);
         }
 
-        @Override
         public CodecRegistry getCodecRegistry() {
             return delegate.getCodecRegistry();
         }
 
-        @Override
         public CompositeNode toDataDom(DataObject data) {
             return delegate.toDataDom(data);
         }
 
-        @Override
         public Entry<InstanceIdentifier, CompositeNode> toDataDom(
                 Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> entry) {
             return delegate.toDataDom(entry);
         }
 
-        @Override
         public InstanceIdentifier toDataDom(
                 org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path) {
             return delegate.toDataDom(path);
         }
 
-        @Override
         public DataObject dataObjectFromDataDom(
                 org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path,
                 CompositeNode result) throws DeserializationException {
             return delegate.dataObjectFromDataDom(path, result);
         }
 
-        @Override
         public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(InstanceIdentifier entry)
                 throws DeserializationException {
             return delegate.fromDataDom(entry);
         }
 
-        @Override
         public Set<QName> getRpcQNamesFor(Class<? extends RpcService> service) {
             return delegate.getRpcQNamesFor(service);
         }
 
-        @Override
-        public DataContainer dataObjectFromDataDom(Class<? extends DataContainer> inputClass, CompositeNode domInput) {
-            return delegate.dataObjectFromDataDom(inputClass, domInput);
-        }
-
         @Override
         public Optional<Class<? extends RpcService>> getRpcServiceClassFor(String namespace, String revision) {
-            return delegate.getRpcServiceClassFor(namespace, revision);
+            return delegate.getRpcServiceClassFor(namespace,revision);
         }
 
+        public DataContainer dataObjectFromDataDom(Class<? extends DataContainer> inputClass, CompositeNode domInput) {
+            return delegate.dataObjectFromDataDom(inputClass, domInput);
+        }
+        
         @Override
         public void close() throws Exception {
             if(delegate != null) {
index 5292487..3ad1dab 100644 (file)
@@ -7,8 +7,7 @@
  */
 package org.opendaylight.controller.sal.binding.impl;
 
-import static com.google.common.base.Preconditions.checkState;
-
+import com.google.common.collect.ImmutableClassToInstanceMap;
 import org.opendaylight.controller.md.sal.binding.util.AbstractBindingSalProviderInstance;
 import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
@@ -33,8 +32,7 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableClassToInstanceMap;
+import static com.google.common.base.Preconditions.checkState;
 
 public class RootBindingAwareBroker implements //
         Mutable, //
index 7f5e466..691c303 100644 (file)
@@ -20,8 +20,6 @@ public class DataChangeEventImpl<P extends Path<P>, D> implements DataChangeEven
     private final DataChange<P, D> dataChange;
 
     private final D originalConfigurationSubtree;
-
-
     private final D originalOperationalSubtree;
     private final D updatedOperationalSubtree;
     private final D updatedConfigurationSubtree;
index 8b193e0..8553d9e 100644 (file)
@@ -64,6 +64,7 @@
 
     <build>
         <plugins>
+            <!-- TODO - unite yang-maven-plugin configuration in md-sal-->
             <plugin>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-maven-plugin</artifactId>
index b6d0632..d4f5d43 100644 (file)
@@ -6,13 +6,20 @@
         <version>1.1-SNAPSHOT</version>
     </parent>
     <artifactId>sal-remote</artifactId>
-    <packaging>jar</packaging>
+    <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>
       <tag>HEAD</tag>
   </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-api</artifactId>
+            <version>1.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
     <build>
         <plugins>
             <plugin>
             </plugin>
         </plugins>
     </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>sal-binding-api</artifactId>
-            <version>1.1-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
 </project>
diff --git a/opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java b/opendaylight/md-sal/sal-remote/src/main/java/org/opendaylight/controller/sal/restconf/service/impl/SalRemoteServiceImpl.java
deleted file mode 100644 (file)
index 1da6032..0000000
+++ /dev/null
@@ -1,34 +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.restconf.service.impl;
-
-import java.util.concurrent.Future;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.BeginTransactionOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-public class SalRemoteServiceImpl implements SalRemoteService {
-    @Override
-    public Future<RpcResult<BeginTransactionOutput>> beginTransaction() {
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<CreateDataChangeEventSubscriptionOutput>> createDataChangeEventSubscription(CreateDataChangeEventSubscriptionInput input) {
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<CreateNotificationStreamOutput>> createNotificationStream(CreateNotificationStreamInput input) {
-        return null;
-    }
-}
index 8294c10..bef2943 100644 (file)
         <version>1.1-SNAPSHOT</version>
     </parent>
     <artifactId>sal-restconf-broker</artifactId>
-    <packaging>jar</packaging>
+    <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>
       <tag>HEAD</tag>
   </scm>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-        </plugins>
-    </build>
-
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-binding-api</artifactId>
-            <version>1.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-util</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-remote</artifactId>
-            <version>1.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-broker-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-config</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal-core-api</artifactId>
-            <version>1.1-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>restconf-client-api</artifactId>
             <version>${yangtools.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>restconf-client-impl</artifactId>
+            <version>${yangtools.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                        <Bundle-Activator>org.opendaylight.controller.sal.restconf.broker.osgi.Activator</Bundle-Activator>
+                        <Import-Package>
+                                *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>${yangtools.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate-sources</goal>
+                        </goals>
+                        <configuration>
+                            <codeGenerators>
+                                <generator>
+                                    <codeGeneratorClass>
+                                        org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                                    </codeGeneratorClass>
+                                    <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                                    <additionalConfiguration>
+                                        <namespaceToPackage1>
+                                            urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                                        </namespaceToPackage1>
+                                    </additionalConfiguration>
+                                </generator>
+                                <generator>
+                                    <codeGeneratorClass>org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl</codeGeneratorClass>
+                                    <outputBaseDir>target/site/models</outputBaseDir>
+                                </generator>
+                            </codeGenerators>
+                            <inspectDependencies>true</inspectDependencies>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.opendaylight.controller</groupId>
+                        <artifactId>yang-jmx-generator-plugin</artifactId>
+                        <version>0.2.4-SNAPSHOT</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.opendaylight.yangtools</groupId>
+                        <artifactId>maven-sal-api-gen-plugin</artifactId>
+                        <version>${yangtools.version}</version>
+                        <type>jar</type>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModule.java
new file mode 100644 (file)
index 0000000..7b7f089
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-data-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public final class DataBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractDataBrokerImplModule
+ {
+
+    public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public DataBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            DataBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/DataBrokerImplModuleFactory.java
new file mode 100644 (file)
index 0000000..1722f6d
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-data-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public class DataBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractDataBrokerImplModuleFactory
+{
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModule.java
new file mode 100644 (file)
index 0000000..ac42452
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-notification-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public final class NotificationBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractNotificationBrokerImplModule
+ {
+
+    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public NotificationBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            NotificationBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/NotificationBrokerImplModuleFactory.java
new file mode 100644 (file)
index 0000000..bb05e06
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-notification-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public class NotificationBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractNotificationBrokerImplModuleFactory
+{
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModule.java
new file mode 100644 (file)
index 0000000..3460ed0
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-rpc-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public final class RpcBrokerImplModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRpcBrokerImplModule
+ {
+
+    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public RpcBrokerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            RpcBrokerImplModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RpcBrokerImplModuleFactory.java
new file mode 100644 (file)
index 0000000..5d11f8d
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-rpc-broker
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public class RpcBrokerImplModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRpcBrokerImplModuleFactory
+{
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModule.java
new file mode 100644 (file)
index 0000000..1b4a8f5
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-runtime-generated-mapping
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public final class RuntimeMappingModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRuntimeMappingModule
+ {
+
+    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public RuntimeMappingModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            RuntimeMappingModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/RuntimeMappingModuleFactory.java
new file mode 100644 (file)
index 0000000..007b886
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-runtime-generated-mapping
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public class RuntimeMappingModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractRuntimeMappingModuleFactory
+{
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModule.java
new file mode 100644 (file)
index 0000000..7022603
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-broker-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public final class SalRemoteServiceBrokerModule extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractSalRemoteServiceBrokerModule
+ {
+
+    public SalRemoteServiceBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+        super(identifier, dependencyResolver);
+    }
+
+    public SalRemoteServiceBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+            SalRemoteServiceBrokerModule oldModule, java.lang.AutoCloseable oldInstance) {
+
+        super(identifier, dependencyResolver, oldModule, oldInstance);
+    }
+
+    @Override
+    protected void customValidation(){
+        // Add custom validation for module attributes here.
+    }
+
+    @Override
+    public java.lang.AutoCloseable createInstance() {
+        //TODO:implement
+        throw new java.lang.UnsupportedOperationException("Unimplemented stub method");
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/restconf/broker/SalRemoteServiceBrokerModuleFactory.java
new file mode 100644 (file)
index 0000000..ed10cc0
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+* Generated file
+
+* Generated from: yang module name: opendaylight-sal-restconf-broker-impl  yang module local name: restconf-broker-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Mon Feb 10 15:32:31 CET 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.md.sal.restconf.broker;
+
+/**
+*
+*/
+public class SalRemoteServiceBrokerModuleFactory extends org.opendaylight.controller.config.yang.md.sal.restconf.broker.AbstractSalRemoteServiceBrokerModuleFactory
+{
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/NotificationServiceImpl.java
deleted file mode 100644 (file)
index 76c98e3..0000000
+++ /dev/null
@@ -1,47 +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.NotificationListener;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.Notification;
-
-public class NotificationServiceImpl implements NotificationService {
-    @Override
-    public <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
-
-    }
-
-    @Override
-    public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-
-    }
-
-    @Override
-    public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-
-    }
-
-    @Override
-    public <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
-
-    }
-
-    @Override
-    public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
-        //TODO implementation using sal-remote
-        return null;
-    }
-
-    @Override
-    public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        //TODO implementation using sal-remote
-        return null;
-    }
-}
index 988bfd8..74b2320 100644 (file)
@@ -8,25 +8,60 @@
 package org.opendaylight.controller.sal.restconf.broker;
 
 
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.Consumer;
-import org.opendaylight.controller.sal.core.api.Provider;
+import com.google.common.collect.ImmutableClassToInstanceMap;
+import org.opendaylight.controller.md.sal.binding.util.BindingContextUtils;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareService;
+import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.restconf.broker.impl.RemoteServicesFactory;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import static com.google.common.base.Preconditions.checkState;
 
-public class SalRemoteServiceBroker implements Broker,AutoCloseable {
+public class SalRemoteServiceBroker implements BindingAwareBroker,AutoCloseable {
 
-    @Override
-    public void close() throws Exception {
 
+    private static final Logger logger = LoggerFactory.getLogger(SalRemoteServiceBroker.class.toString());
+    private ImmutableClassToInstanceMap<BindingAwareService> supportedConsumerServices;
+
+    private final String identifier;
+
+    private RpcConsumerRegistry rpcBroker;
+    private NotificationService notificationBroker;
+    private DataBrokerService dataBroker;
+    private final RemoteServicesFactory servicesFactory;
+
+    public SalRemoteServiceBroker(String instanceName,RestconfClientContext clientContext){
+        this.identifier = instanceName;
+        this.servicesFactory = new RemoteServicesFactory(clientContext);
     }
 
-    @Override
-    public ConsumerSession registerConsumer(Consumer cons, BundleContext context) {
-        return null;
+    public void start() {
+        logger.info("Starting Binding Aware Broker: {}", identifier);
+
+        supportedConsumerServices = ImmutableClassToInstanceMap.<BindingAwareService> builder()
+                .put(NotificationService.class, servicesFactory.getNotificationService()) //
+                .put(DataBrokerService.class,servicesFactory.getDataBrokerService() ) //
+                .put(RpcConsumerRegistry.class,servicesFactory.getRpcConsumerRegistry() ).build();
     }
 
+    public ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx) {
+        throw new UnsupportedOperationException();
+    }
+    @Override
+    public void close() throws Exception {
+        //TODO decide if serviceFactory should close clientContext or it has to be closed by consumer
+    }
     @Override
-    public ProviderSession registerProvider(Provider prov, BundleContext context) {
-        return null;
+    public ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx) {
+        checkState(supportedConsumerServices != null, "Broker is not initialized.");
+        return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
     }
+
 }
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/event/RemoteDataChangeEvent.java
new file mode 100644 (file)
index 0000000..5fad76f
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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.restconf.broker.event;
+
+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.DataChangeEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.DataChangedNotification;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class RemoteDataChangeEvent implements DataChangeEvent<InstanceIdentifier<? extends DataObject>,DataObject> {
+
+
+    private final DataChangedNotification dataChangedNotification;
+
+
+    public RemoteDataChangeEvent(DataChangedNotification dataChangedNotification){
+
+        this.dataChangedNotification = dataChangedNotification;
+    }
+
+    @Override
+    public DataObject getOriginalConfigurationSubtree() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public DataObject getOriginalOperationalSubtree() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public DataObject getUpdatedConfigurationSubtree() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public DataObject getUpdatedOperationalSubtree() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getCreatedOperationalData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 0 && d.getStore().getIntValue() == 1){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getCreatedConfigurationData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 0 && d.getStore().getIntValue() == 0){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getUpdatedOperationalData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 1){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getUpdatedConfigurationData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 0){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Set<InstanceIdentifier<?>> getRemovedConfigurationData() {
+        return new HashSet<InstanceIdentifier<?>>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 2 && d.getStore().getIntValue() == 0){
+                    add(d.getPath());
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Set<InstanceIdentifier<?>> getRemovedOperationalData() {
+        return new HashSet<InstanceIdentifier<?>>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 2 && d.getStore().getIntValue() == 1){
+                    add(d.getPath());
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getOriginalConfigurationData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 0){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+
+    @Override
+    public Map<InstanceIdentifier<?>, DataObject> getOriginalOperationalData() {
+        return new HashMap<InstanceIdentifier<?>, DataObject>(){{
+            for (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.data.changed.notification.DataChangeEvent d :dataChangedNotification.getDataChangeEvent()){
+                if (d.getOperation().getIntValue() == 1 && d.getStore().getIntValue() == 1){
+                    put(d.getPath(),d);
+                }
+            }
+        }};
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/DataBrokerServiceImpl.java
new file mode 100644 (file)
index 0000000..e6659c2
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * 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.restconf.broker.impl;
+
+import com.google.common.base.Optional;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteDataChangeNotificationListener;
+import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools;
+import org.opendaylight.controller.sal.restconf.broker.transactions.RemoteDataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.BeginTransactionOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateDataChangeEventSubscriptionOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
+import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo;
+import org.opendaylight.yangtools.restconf.client.api.event.ListenableEventStreamContext;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataBrokerServiceImpl implements DataBrokerService  {
+
+    private static final Logger logger = LoggerFactory.getLogger(DataBrokerServiceImpl.class.toString());
+    private RestconfClientContext restconfClientContext;
+    private SalRemoteService salRemoteService;
+
+    public DataBrokerServiceImpl(RestconfClientContext restconfClientContext) {
+        this.restconfClientContext = restconfClientContext;
+        this.salRemoteService =  this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService();
+    }
+    @Override
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public DataObject getConfigurationData(InstanceIdentifier<?> data) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public DataModificationTransaction beginTransaction() {
+        Future<RpcResult<BeginTransactionOutput>> rpcResultFuture = this.salRemoteService.beginTransaction();
+        //TODO finish yang model for proper remoteDataModificationTransaction setup
+        RemoteDataModificationTransaction remoteDataModificationTransaction = new RemoteDataModificationTransaction();
+        return remoteDataModificationTransaction;
+    }
+
+    @Override
+    public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
+        throw new UnsupportedOperationException("Deprecated");
+    }
+
+    @Override
+    public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
+        try {
+            Optional<DataObject> optDataObject = (Optional<DataObject>) this.restconfClientContext.getConfigurationDatastore().readData(path).get();
+            if (optDataObject.isPresent()){
+                return optDataObject.get();
+            }
+        } catch (InterruptedException e) {
+            logger.trace("Reading configuration data interrupted {}",e);
+        } catch (ExecutionException e) {
+            logger.trace("Reading configuration execution exception {}",e);
+        }
+        throw new IllegalStateException("No data to return.");
+    }
+
+    @Override
+    public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
+        try {
+            Optional<DataObject> optDataObject = (Optional<DataObject>) this.restconfClientContext.getOperationalDatastore().readData(path).get();
+            if (optDataObject.isPresent()){
+                return optDataObject.get();
+            }
+        } catch (InterruptedException e) {
+            logger.trace("Reading configuration data interrupted {}",e);
+        } catch (ExecutionException e) {
+            logger.trace("Reading configuration execution exception {}",e);
+        }
+        throw new IllegalStateException("No data to return.");
+    }
+    @Override
+    public ListenerRegistration<DataChangeListener> registerDataChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
+        CreateDataChangeEventSubscriptionInputBuilder inputBuilder = new CreateDataChangeEventSubscriptionInputBuilder();
+        Future<RpcResult<CreateDataChangeEventSubscriptionOutput>> rpcResultFuture =  salRemoteService.createDataChangeEventSubscription(inputBuilder.setPath(path).build());
+        String streamName = "";
+        try {
+            if (rpcResultFuture.get().isSuccessful()){
+                streamName = rpcResultFuture.get().getResult().getStreamName();
+            }
+        } catch (InterruptedException e) {
+            logger.trace("Interupted while getting rpc result due to {}",e);
+        } catch (ExecutionException e) {
+            logger.trace("Execution exception while getting rpc result due to {}",e);
+        }
+        final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext,streamName);
+        ListenableEventStreamContext restConfListenableEventStreamContext = restconfClientContext.getEventStreamContext(desiredEventStream.get(streamName));
+        RemoteDataChangeNotificationListener remoteDataChangeNotificationListener = new RemoteDataChangeNotificationListener(listener);
+        restConfListenableEventStreamContext.registerNotificationListener(remoteDataChangeNotificationListener);
+        return new SalRemoteDataListenerRegistration(listener);
+    }
+
+    private class SalRemoteDataListenerRegistration implements ListenerRegistration<DataChangeListener> {
+        private DataChangeListener dataChangeListener;
+        public SalRemoteDataListenerRegistration(DataChangeListener dataChangeListener){
+            this.dataChangeListener = dataChangeListener;
+        }
+        @Override
+        public DataChangeListener getInstance() {
+            return this.dataChangeListener;
+        }
+        @Override
+        public void close() throws Exception {
+            //noop
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java
new file mode 100644 (file)
index 0000000..a016239
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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.restconf.broker.impl;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.restconf.broker.listeners.RemoteNotificationListener;
+import org.opendaylight.controller.sal.restconf.broker.tools.RemoteStreamTools;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
+import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public class NotificationServiceImpl implements NotificationService {
+    private SalRemoteService salRemoteService;
+    private RestconfClientContext restconfClientContext;
+
+    private final Multimap<Class<? extends Notification>,NotificationListener<? extends Object>> listeners;
+    private ExecutorService _executor;
+
+    public NotificationServiceImpl(RestconfClientContext restconfClienetContext){
+        this.restconfClientContext = restconfClienetContext;
+        this.salRemoteService = this.restconfClientContext.getRpcServiceContext(SalRemoteService.class).getRpcService();
+
+        HashMultimap<Class<? extends Notification>,NotificationListener<? extends Object>> _create = HashMultimap.<Class<? extends Notification>, NotificationListener<? extends Object>>create();
+        SetMultimap<Class<? extends Notification>,NotificationListener<? extends Object>> _synchronizedSetMultimap = Multimaps.<Class<? extends Notification>, NotificationListener<? extends Object>>synchronizedSetMultimap(_create);
+        this.listeners = _synchronizedSetMultimap;
+
+    }
+    public ExecutorService getExecutor() {
+        return this._executor;
+    }
+
+    public void setExecutor(final ExecutorService executor) {
+        this._executor = executor;
+    }
+
+    @Override
+    public <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
+        this.listeners.put(notificationType, listener);
+    }
+
+    @Override
+    public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead.");
+        throw _unsupportedOperationException;
+    }
+
+    @Override
+    public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException(
+                "Deprecated method. Use RegisterNotificationListener returned value to close registration.");
+        throw _unsupportedOperationException;
+    }
+
+    @Override
+    public <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
+        this.listeners.remove(notificationType, listener);
+    }
+
+    @Override
+    public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(Class<T> notificationType, NotificationListener<T> listener) {
+        //TODO implementation using sal-remote
+        List<QName> notifications = new ArrayList<QName>();
+        notifications.add(new QName(notificationType.toString()));
+        String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications);
+        final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
+        RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener);
+        ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(remoteNotificationListener);
+        SalNotificationRegistration salNotificationRegistration = new SalNotificationRegistration(listenerRegistration);
+        return salNotificationRegistration;
+    }
+
+    @Override
+    public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
+        //TODO implementation using sal-remote
+        String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, null);
+        final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
+        ListenerRegistration listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName))).registerNotificationListener(listener);
+        return listenerRegistration;
+    }
+
+    private class SalNotificationRegistration<T extends Notification> implements Registration<NotificationListener<T>>{
+        private Registration registration;
+
+        public SalNotificationRegistration(ListenerRegistration listenerRegistration){
+            this.registration = listenerRegistration;
+        }
+
+        @Override
+        public NotificationListener<T> getInstance() {
+            return this.getInstance();
+        }
+
+        @Override
+        public void close() throws Exception {
+            this.registration.close();
+        }
+    }
+
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/RemoteServicesFactory.java
new file mode 100644 (file)
index 0000000..65ecd8b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.restconf.broker.impl;
+
+import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
+
+public class RemoteServicesFactory {
+
+    private final RestconfClientContext restconfClientContext;
+
+    public RemoteServicesFactory(RestconfClientContext restconfClientContext){
+        this.restconfClientContext = restconfClientContext;
+    }
+
+    public DataBrokerService getDataBrokerService(){
+        return new DataBrokerServiceImpl(this.restconfClientContext);
+    }
+
+    public NotificationService getNotificationService(){
+        return  new NotificationServiceImpl(this.restconfClientContext);
+    }
+
+    public RpcConsumerRegistry getRpcConsumerRegistry(){
+        return new RpcConsumerRegistryImpl(this.restconfClientContext);
+    }
+
+}
@@ -5,15 +5,21 @@
  * 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;
+package org.opendaylight.controller.sal.restconf.broker.impl;
 
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 public class RpcConsumerRegistryImpl implements RpcConsumerRegistry {
+
+    private RestconfClientContext restconfClientContext;
+
+    public RpcConsumerRegistryImpl(RestconfClientContext restconfClientContext){
+        this.restconfClientContext = restconfClientContext;
+    }
     @Override
     public <T extends RpcService> T getRpcService(Class<T> module) {
-        //TODO implementation using restconf-client
-        return null;
+        return restconfClientContext.getRpcServiceContext(module).getRpcService();
     }
 }
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteDataChangeNotificationListener.java
new file mode 100644 (file)
index 0000000..df72ac8
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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.restconf.broker.listeners;
+
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.restconf.broker.event.RemoteDataChangeEvent;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.DataChangedNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteListener;
+
+public class RemoteDataChangeNotificationListener implements SalRemoteListener {
+
+
+    private final DataChangeListener dataChangeListener;
+
+    public RemoteDataChangeNotificationListener(DataChangeListener dataChangeListener){
+        this.dataChangeListener = dataChangeListener;
+    }
+    @Override
+    public void onDataChangedNotification(DataChangedNotification notification) {
+        this.dataChangeListener.onDataChanged(new RemoteDataChangeEvent(notification));
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java
new file mode 100644 (file)
index 0000000..895a503
--- /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.restconf.broker.listeners;
+
+import org.opendaylight.controller.sal.binding.api.NotificationListener;
+
+public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener {
+
+    org.opendaylight.controller.sal.binding.api.NotificationListener listener;
+
+    public RemoteNotificationListener(NotificationListener listener){
+        this.listener = listener;
+    }
+    public NotificationListener getListener(){
+        return this.listener;
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java
new file mode 100644 (file)
index 0000000..16ca0ae
--- /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.sal.restconf.broker.listeners;
+
+import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+
+public class SalNotificationListener implements NotificationListener {
+    private NotificationListener notificationListener;
+
+    public SalNotificationListener( NotificationListener notificationListener){
+        this.notificationListener = notificationListener;
+    }
+    @Override
+    public void onNotification(Notification notification) {
+        this.notificationListener.onNotification(notification);
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/osgi/Activator.java
new file mode 100644 (file)
index 0000000..13535ee
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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.restconf.broker.osgi;
+
+import java.util.Hashtable;
+import javassist.ClassPool;
+import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
+import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+
+    private ServiceRegistration<BindingIndependentMappingService> mappingReg;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        RuntimeGeneratedMappingServiceImpl service = new RuntimeGeneratedMappingServiceImpl();
+        service.setPool(new ClassPool());
+        service.init();
+        startRuntimeMappingService(service, context);
+    }
+
+    private void startRuntimeMappingService(RuntimeGeneratedMappingServiceImpl service, BundleContext context) {
+        Hashtable<String, String> properties = new Hashtable<String, String>();
+        mappingReg = context.registerService(BindingIndependentMappingService.class, service, properties);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        if(mappingReg != null) {
+            mappingReg.unregister();
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/tools/RemoteStreamTools.java
new file mode 100644 (file)
index 0000000..726f7f0
--- /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.sal.restconf.broker.tools;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.CreateNotificationStreamOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.QName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.remote.rev140114.SalRemoteService;
+import org.opendaylight.yangtools.restconf.client.api.RestconfClientContext;
+import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RemoteStreamTools {
+    private static final Logger logger = LoggerFactory.getLogger(RemoteStreamTools.class.toString());
+
+    public static String createNotificationStream(SalRemoteService salRemoteService,List<QName> notifications){
+        CreateNotificationStreamInputBuilder notificationStreamInputBuilder = new CreateNotificationStreamInputBuilder();
+
+        if (null == notifications){
+            notificationStreamInputBuilder.setNotifications(notifications);
+        }
+
+        Future<RpcResult<CreateNotificationStreamOutput>> notificationStream = salRemoteService.createNotificationStream(notificationStreamInputBuilder.build());
+
+        String nofiticationStreamIdentifier = "";
+        try {
+            if (notificationStream.get().isSuccessful()){
+                nofiticationStreamIdentifier  = notificationStream.get().getResult().getNotificationStreamIdentifier();
+            }
+        } catch (InterruptedException e) {
+            logger.trace("Interrupted while resolving notification stream identifier due to {}",e);
+        } catch (ExecutionException e) {
+            logger.trace("Execution exception while resolving notification stream identifier due to {}",e);
+        }
+        return nofiticationStreamIdentifier;
+    }
+
+    public static Map<String,EventStreamInfo> createEventStream(RestconfClientContext restconfClientContext, String desiredStreamName){
+        ListenableFuture<Set<EventStreamInfo>> availableEventStreams = restconfClientContext.getAvailableEventStreams();
+        final Map<String,EventStreamInfo> desiredEventStream = new HashMap<String,EventStreamInfo>();
+
+        try {
+            Iterator<EventStreamInfo> it = availableEventStreams.get().iterator();
+            while (it.hasNext()){
+                if (it.next().getIdentifier().equals(desiredStreamName)){
+                    desiredEventStream.put(desiredStreamName,it.next());
+                }
+            }
+        } catch (InterruptedException e) {
+            logger.trace("Resolving of event stream interrupted due to  {}",e);
+        } catch (ExecutionException e) {
+            logger.trace("Resolving of event stream failed due to {}",e);
+        }
+        return desiredEventStream;
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java b/opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/transactions/RemoteDataModificationTransaction.java
new file mode 100644 (file)
index 0000000..7f9cc8f
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * 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.restconf.broker.transactions;
+
+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.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public class RemoteDataModificationTransaction implements DataModificationTransaction {
+    //TODO implement this
+
+    @Override
+    public Object getIdentifier() {
+        return null;
+    }
+
+    @Override
+    public TransactionStatus getStatus() {
+        return null;
+    }
+
+    @Override
+    public void putRuntimeData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
+
+    }
+
+    @Override
+    public void putOperationalData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
+
+    }
+
+    @Override
+    public void putConfigurationData(InstanceIdentifier<? extends DataObject> path, DataObject data) {
+
+    }
+
+    @Override
+    public void removeRuntimeData(InstanceIdentifier<? extends DataObject> path) {
+
+    }
+
+    @Override
+    public void removeOperationalData(InstanceIdentifier<? extends DataObject> path) {
+
+    }
+
+    @Override
+    public void removeConfigurationData(InstanceIdentifier<? extends DataObject> path) {
+
+    }
+
+    @Override
+    public Future<RpcResult<TransactionStatus>> commit() {
+        return null;
+    }
+
+    @Override
+    public ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener) {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getCreatedOperationalData() {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getCreatedConfigurationData() {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getUpdatedOperationalData() {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getUpdatedConfigurationData() {
+        return null;
+    }
+
+    @Override
+    public Set<InstanceIdentifier<? extends DataObject>> getRemovedConfigurationData() {
+        return null;
+    }
+
+    @Override
+    public Set<InstanceIdentifier<? extends DataObject>> getRemovedOperationalData() {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getOriginalConfigurationData() {
+        return null;
+    }
+
+    @Override
+    public Map<InstanceIdentifier<? extends DataObject>, DataObject> getOriginalOperationalData() {
+        return null;
+    }
+
+    @Override
+    public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
+        return null;
+    }
+
+    @Override
+    public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
+        return null;
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang b/opendaylight/md-sal/sal-restconf-broker/src/main/yang/opendaylight-restconf-broker-impl.yang
new file mode 100644 (file)
index 0000000..634a2ba
--- /dev/null
@@ -0,0 +1,142 @@
+// vi: set smarttab et sw=4 tabstop=4:
+module opendaylight-sal-restconf-broker-impl {
+       yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:controller:md:sal:restconf:broker";
+    prefix "restconf-impl";
+
+    import config { prefix config; revision-date 2013-04-05; }
+    import opendaylight-md-sal-binding {prefix sal;}
+    import opendaylight-md-sal-dom {prefix dom;}
+    import opendaylight-md-sal-common {prefix common;}
+
+    description
+        "Service definition for Restconf MD-SAL.";
+    revision "2014-02-10" {
+        description
+            "Initial revision";
+    }
+
+    identity binding-dom-mapping-service {
+        base config:service-type;
+        config:java-class "org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService";
+    }
+
+
+    identity restconf-broker-impl {
+        base config:module-type;
+        config:provided-service sal:binding-data-consumer-broker;
+        config:provided-service sal:binding-notification-subscription-service;
+        /*TODO provide RpcConsumerRegistry*/
+        config:java-name-prefix SalRemoteServiceBroker;
+    }
+    
+    identity restconf-data-broker {
+        base config:module-type;
+        config:provided-service sal:binding-data-broker;
+        config:java-name-prefix DataBrokerImpl;
+    }
+    
+    identity restconf-rpc-broker {
+        base config:module-type;
+        config:provided-service sal:binding-rpc-registry;
+        config:java-name-prefix RpcBrokerImpl;
+    }
+    
+    identity restconf-notification-broker {
+        base config:module-type;
+        config:provided-service sal:binding-notification-service;
+        config:java-name-prefix NotificationBrokerImpl;
+    }
+
+    identity restconf-runtime-generated-mapping {
+        base config:module-type;
+        config:provided-service binding-dom-mapping-service;
+        config:java-name-prefix RuntimeMapping;
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case restconf-broker-impl {
+            when "/config:modules/config:module/config:type = 'restconf-broker-impl'";
+            
+            /*
+            container rpc-registry {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal:binding-rpc-registry;
+                    }
+                }
+            }*/
+            
+            container data-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal:binding-data-broker;
+                    }
+                }
+            }
+            
+            container notification-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal:binding-notification-service;
+                    }
+                }
+            }
+        }
+    }
+
+    augment "/config:modules/config:module/config:configuration" {
+        case restconf-data-broker {
+            when "/config:modules/config:module/config:type = 'restconf-data-broker'";
+            container dom-broker {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity dom:dom-broker-osgi-registry;
+                    }
+                }
+            }
+
+            container mapping-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity binding-dom-mapping-service;
+                    }
+                }
+            } 
+        }
+    }
+    
+
+    augment "/config:modules/config:module/config:state" {
+        case restconf-runtime-generated-mapping {
+            when "/config:modules/config:module/config:type = 'restconf-runtime-generated-mapping'";
+        }
+    }
+
+    augment "/config:modules/config:module/config:state" {
+        case restconf-data-broker {
+            when "/config:modules/config:module/config:type = 'restconf-data-broker'";
+            container data {
+                uses common:data-state;
+            }
+        }
+    }
+    augment "/config:modules/config:module/config:state" {
+        case restconf-rpc-broker {
+            when "/config:modules/config:module/config:type = 'restconf-rpc-broker'";
+            uses common:rpc-state;
+        }
+    }
+    augment "/config:modules/config:module/config:state" {
+        case restconf-notification-broker {
+            when "/config:modules/config:module/config:type = 'restconf-notification-broker'";
+            uses common:notification-state;
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/DataBrokerImplTest.java
new file mode 100644 (file)
index 0000000..eafc47d
--- /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.sal.binding.impl.test;
+
+public class DataBrokerImplTest {
+
+    public static void main(String[] args){
+
+    }
+}
diff --git a/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java b/opendaylight/md-sal/sal-restconf-broker/src/test/java/org/opendaylight/controller/sal/binding/impl/test/NotificationServiceImplTest.java
new file mode 100644 (file)
index 0000000..a91b06e
--- /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.sal.binding.impl.test;
+
+public class NotificationServiceImplTest {
+
+    public static void main(String[] args){
+
+    }
+}