Merge "The code through out hosttracker assumes the switch manager service reference...
authorAlessandro Boch <aboch@cisco.com>
Mon, 3 Mar 2014 22:33:59 +0000 (22:33 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 3 Mar 2014 22:33:59 +0000 (22:33 +0000)
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModuleFactory.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/SchemaServiceImplSingletonModuleFactory.java
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/ControllerContext.xtend
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageHeaderTest.java
opendaylight/netconf/netconf-util/pom.xml
third-party/com.siemens.ct.exi/pom.xml [deleted file]

index 64e23e887ccdba0f7094733e489d7d58d31d2a1c..407b41d29df1df9afcad7473ead9fd3a9dc464a6 100644 (file)
@@ -7,49 +7,34 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
-import java.util.Collections;
-import java.util.Set;
-
 import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DependencyResolverFactory;
-import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 /**
-*
-*/
+ *
+ */
 public class RuntimeMappingModuleFactory extends
         org.opendaylight.controller.config.yang.md.sal.binding.impl.AbstractRuntimeMappingModuleFactory {
 
-    private static RuntimeMappingModule SINGLETON = null;
-    private static ModuleIdentifier IDENTIFIER = new ModuleIdentifier(NAME, "runtime-mapping-singleton");
+    public static final String SINGLETON_NAME = "runtime-mapping-singleton";
 
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        throw new UnsupportedOperationException("Only default instance supported");
-    }
-
-    @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver,
-            DynamicMBeanWithInstance old, BundleContext bundleContext) throws Exception {
-        RuntimeMappingModule module = (RuntimeMappingModule) super.createModule(instanceName, dependencyResolver, old,
-                bundleContext);
+    public RuntimeMappingModule instantiateModule(String instanceName, DependencyResolver dependencyResolver, RuntimeMappingModule  oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        checkArgument(SINGLETON_NAME.equals(instanceName),"Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
+        RuntimeMappingModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
+        // FIXME bundle context should not be passed around
         module.setBundleContext(bundleContext);
         return module;
     }
 
     @Override
-    public Set<RuntimeMappingModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
-            BundleContext bundleContext) {
-        if (SINGLETON == null) {
-            DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(IDENTIFIER);
-            SINGLETON = new RuntimeMappingModule(IDENTIFIER, dependencyResolver);
-            SINGLETON.setBundleContext(bundleContext);
-        }
-
-        return Collections.singleton(SINGLETON);
+    public RuntimeMappingModule  instantiateModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+        checkArgument(SINGLETON_NAME.equals(instanceName),"Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
+        RuntimeMappingModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        // FIXME bundle context should not be passed around
+        module.setBundleContext(bundleContext);
+        return module;
     }
-
 }
index 22ad3fde0029707302201cf079ce3bdfc12295b1..0908fe573bbf28ba4d285e046f13e14ce5ece55f 100644 (file)
@@ -7,38 +7,31 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.dom.impl;
 
-import java.util.Collections;
-import java.util.Set;
-
 import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DependencyResolverFactory;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.config.spi.Module;
 import org.osgi.framework.BundleContext;
 
-/**
-*
-*/
+import static com.google.common.base.Preconditions.checkArgument;
+
 public class SchemaServiceImplSingletonModuleFactory extends
         org.opendaylight.controller.config.yang.md.sal.dom.impl.AbstractSchemaServiceImplSingletonModuleFactory {
 
-    private static final ModuleIdentifier IDENTIFIER = new ModuleIdentifier(NAME, "yang-schema-service");
-    public static SchemaServiceImplSingletonModule SINGLETON;
+    public static final String SINGLETON_NAME = "yang-schema-service";
 
     @Override
-    public Module createModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        throw new UnsupportedOperationException("Only default instance supported.");
+    public SchemaServiceImplSingletonModule  instantiateModule(String instanceName, DependencyResolver dependencyResolver, SchemaServiceImplSingletonModule  oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        checkArgument(SINGLETON_NAME.equals(instanceName),"Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
+        SchemaServiceImplSingletonModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
+        // FIXME bundle context should not be passed around
+        module.setBundleContext(bundleContext);
+        return module;
     }
 
     @Override
-    public Set<SchemaServiceImplSingletonModule> getDefaultModules(DependencyResolverFactory dependencyResolverFactory,
-            BundleContext bundleContext) {
-        DependencyResolver dependencyResolver = dependencyResolverFactory.createDependencyResolver(IDENTIFIER);
-
-        if (SINGLETON == null) {
-            SINGLETON = new SchemaServiceImplSingletonModule(IDENTIFIER, dependencyResolver);
-            SINGLETON.setBundleContext(bundleContext);
-        }
-        return Collections.singleton(SINGLETON);
+    public SchemaServiceImplSingletonModule  instantiateModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+        checkArgument(SINGLETON_NAME.equals(instanceName),"Illegal instance name '" + instanceName + "', only allowed name is " + SINGLETON_NAME);
+        SchemaServiceImplSingletonModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        // FIXME bundle context should not be passed around
+        module.setBundleContext(bundleContext);
+        return module;
     }
 }
index 9b5c507811c18257f19abf7dacaf2452d849081e..837d7ae5b7d147b59aa762b1fda4a32de0b86175 100644 (file)
@@ -43,14 +43,14 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode
 import org.opendaylight.yangtools.yang.model.api.Module
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition
 import org.opendaylight.yangtools.yang.model.api.SchemaContext
-import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener
 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition
 import org.slf4j.LoggerFactory
 
 import static com.google.common.base.Preconditions.*
 import static javax.ws.rs.core.Response.Status.*
 
-class ControllerContext implements SchemaServiceListener {
+class ControllerContext implements SchemaContextListener {
     val static LOG = LoggerFactory.getLogger(ControllerContext)
     val static ControllerContext INSTANCE = new ControllerContext
     val static NULL_VALUE = "null"
@@ -548,12 +548,18 @@ class ControllerContext implements SchemaServiceListener {
         val typedef = (node as LeafSchemaNode).type;
         
         var decoded = TypeDefinitionAwareCodec.from(typedef)?.deserialize(urlDecoded)
+        var additionalInfo = ""
         if(decoded === null) {
             var baseType = RestUtil.resolveBaseTypeFrom(typedef)
             if(baseType instanceof IdentityrefTypeDefinition) {
                 decoded = toQName(urlDecoded)
+                additionalInfo = "For key which is of type identityref it should be in format module_name:identity_name."
             }
         }
+        if (decoded === null) {
+            throw new ResponseException(BAD_REQUEST, uriValue + " from URI can't be resolved. "+  additionalInfo )
+        }                
+        
         map.put(node.QName, decoded);
     }
 
index 959e2ff144810c2017131e8041229e86b1cabd64..eb975216e25f65f25124074be05d63071e1a8da7 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
 
+@Deprecated
 public class MessageHeaderTest {
     @Test
     public void testFromBytes() {
index 5df329def023f2c5216b08a3f9a7bbef29bccc23..d623dd979646e8f724f7abdefc9ce287a528a9fa 100644 (file)
             <groupId>io.netty</groupId>
             <artifactId>netty-handler</artifactId>
         </dependency>
-        <!--dependency>
-            <groupId>com.siemens.ct.exi</groupId>
-            <artifactId>exificient</artifactId>
-        </dependency-->
         <dependency>
             <groupId>org.opendaylight.controller.thirdparty</groupId>
             <artifactId>ganymed</artifactId>
diff --git a/third-party/com.siemens.ct.exi/pom.xml b/third-party/com.siemens.ct.exi/pom.xml
deleted file mode 100644 (file)
index 7a4f32f..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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/maven-v4_0_0.xsd">
-  <!-- Get some common settings for the project we are using it in -->
-  <parent>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>commons.thirdparty</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
-    <relativePath>../commons/thirdparty</relativePath>
-  </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:Main</url>
-    <tag>HEAD</tag>
-  </scm>
-
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.opendaylight.controller.thirdparty</groupId>
-  <artifactId>exificient</artifactId>
-  <version>0.9.2-SNAPSHOT</version>
-  <packaging>bundle</packaging>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.3.6</version>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Embed-Dependency>*;scope=!provided;type=!pom;inline=false</Embed-Dependency>
-            <Embed-Transitive>false</Embed-Transitive>
-            <Export-Package>
-              com.siemens.ct.exi.*,
-            </Export-Package>
-            <Import-Package>
-                javax.xml.namespace,
-                javax.xml.parsers,
-                javax.xml.stream,
-                javax.xml.stream.events,
-                javax.xml.transform.sax,
-                org.apache.xerces.impl.xs,
-                org.apache.xerces.impl.xs.models,
-                org.apache.xerces.xni,
-                org.apache.xerces.xni.grammars,
-                org.apache.xerces.xni.parser,
-                org.apache.xerces.xs,
-                org.w3c.dom,
-                org.xml.sax,
-                org.xml.sax.ext,
-                org.xml.sax.helpers
-            </Import-Package>
-          </instructions>
-          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-
-  <dependencies>
-    <dependency>
-        <groupId>com.siemens.ct.exi</groupId>
-        <artifactId>exificient</artifactId>
-        <version>0.9.2</version>
-    </dependency>
-  </dependencies>
-
-</project>