*/
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;
}
-
}
*/
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;
}
}
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"
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);
}
import org.junit.Test;
import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
+@Deprecated
public class MessageHeaderTest {
@Test
public void testFromBytes() {
<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>
+++ /dev/null
-<?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>